@@ -63,12 +63,12 @@ public virtual void CloseFile(string fileName, IDokanFileInfo info)
63
63
public virtual NtStatus FlushFileBuffers ( string fileName , IDokanFileInfo info )
64
64
{
65
65
if ( handlesManager . GetHandle < FileHandle > ( GetContextValue ( info ) ) is not { } fileHandle )
66
- return Trace ( DokanResult . InvalidHandle , nameof ( FlushFileBuffers ) , fileName , info ) ;
66
+ return Trace ( DokanResult . InvalidHandle , fileName , info ) ;
67
67
68
68
try
69
69
{
70
70
fileHandle . Stream . Flush ( ) ;
71
- return Trace ( DokanResult . Success , nameof ( FlushFileBuffers ) , fileName , info ) ;
71
+ return Trace ( DokanResult . Success , fileName , info ) ;
72
72
}
73
73
catch ( IOException )
74
74
{
@@ -86,10 +86,10 @@ public virtual NtStatus FindFiles(string fileName, out IList<FileInformation> fi
86
86
public virtual NtStatus SetEndOfFile ( string fileName , long length , IDokanFileInfo info )
87
87
{
88
88
if ( handlesManager . GetHandle < FileHandle > ( GetContextValue ( info ) ) is not { } fileHandle )
89
- return Trace ( DokanResult . InvalidHandle , nameof ( SetEndOfFile ) , fileName , info ) ;
89
+ return Trace ( DokanResult . InvalidHandle , fileName , info ) ;
90
90
91
91
fileHandle . Stream . SetLength ( length ) ;
92
- return Trace ( DokanResult . Success , nameof ( SetEndOfFile ) , fileName , info ) ;
92
+ return Trace ( DokanResult . Success , fileName , info ) ;
93
93
}
94
94
95
95
/// <inheritdoc/>
@@ -107,27 +107,27 @@ public virtual NtStatus GetVolumeInformation(out string volumeLabel, out FileSys
107
107
maximumComponentLength = volumeModel . MaximumComponentLength ;
108
108
features = volumeModel . FileSystemFeatures ;
109
109
110
- return Trace ( DokanResult . Success , nameof ( GetVolumeInformation ) , null , info ) ;
110
+ return Trace ( DokanResult . Success , null , info ) ;
111
111
}
112
112
113
113
/// <inheritdoc/>
114
114
public virtual NtStatus Mounted ( string mountPoint , IDokanFileInfo info )
115
115
{
116
116
_ = mountPoint ; // TODO: Check if mountPoint is different and update the RootFolder (?)
117
- return Trace ( DokanResult . Success , nameof ( Mounted ) , null , info ) ;
117
+ return Trace ( DokanResult . Success , null , info ) ;
118
118
}
119
119
120
120
/// <inheritdoc/>
121
121
public virtual NtStatus Unmounted ( IDokanFileInfo info )
122
122
{
123
- return Trace ( DokanResult . Success , nameof ( Unmounted ) , null , info ) ;
123
+ return Trace ( DokanResult . Success , null , info ) ;
124
124
}
125
125
126
126
/// <inheritdoc/>
127
127
public virtual NtStatus FindStreams ( string fileName , out IList < FileInformation > streams , IDokanFileInfo info )
128
128
{
129
129
streams = Array . Empty < FileInformation > ( ) ;
130
- return Trace ( DokanResult . NotImplemented , nameof ( FindStreams ) , fileName , info ) ;
130
+ return Trace ( DokanResult . NotImplemented , fileName , info ) ;
131
131
}
132
132
133
133
/// <inheritdoc/>
@@ -143,7 +143,7 @@ public virtual unsafe NtStatus ReadFile(string fileName, IntPtr buffer, uint buf
143
143
if ( ciphertextPath is null )
144
144
{
145
145
bytesRead = 0 ;
146
- return Trace ( DokanResult . PathNotFound , nameof ( ReadFile ) , fileName , info ) ;
146
+ return Trace ( DokanResult . PathNotFound , fileName , info ) ;
147
147
}
148
148
149
149
// Memory-mapped
@@ -170,22 +170,22 @@ public virtual unsafe NtStatus ReadFile(string fileName, IntPtr buffer, uint buf
170
170
var bufferSpan = new Span < byte > ( buffer . ToPointer ( ) , ( int ) bufferLength ) ;
171
171
bytesRead = fileHandle . Stream . Read ( bufferSpan ) ;
172
172
173
- return Trace ( DokanResult . Success , nameof ( ReadFile ) , fileName , info ) ;
173
+ return Trace ( DokanResult . Success , fileName , info ) ;
174
174
}
175
175
catch ( PathTooLongException )
176
176
{
177
177
bytesRead = 0 ;
178
- return Trace ( DokanResult . InvalidName , nameof ( ReadFile ) , fileName , info ) ;
178
+ return Trace ( DokanResult . InvalidName , fileName , info ) ;
179
179
}
180
180
catch ( CryptographicException )
181
181
{
182
182
bytesRead = 0 ;
183
- return Trace ( NtStatus . CrcError , nameof ( ReadFile ) , fileName , info ) ;
183
+ return Trace ( NtStatus . CrcError , fileName , info ) ;
184
184
}
185
185
catch ( UnavailableStreamException )
186
186
{
187
187
bytesRead = 0 ;
188
- return Trace ( NtStatus . HandleNoLongerValid , nameof ( ReadFile ) , fileName , info ) ;
188
+ return Trace ( NtStatus . HandleNoLongerValid , fileName , info ) ;
189
189
}
190
190
finally
191
191
{
@@ -207,7 +207,7 @@ public virtual unsafe NtStatus WriteFile(string fileName, IntPtr buffer, uint bu
207
207
if ( ciphertextPath is null )
208
208
{
209
209
bytesWritten = 0 ;
210
- return Trace ( DokanResult . PathNotFound , nameof ( WriteFile ) , fileName , info ) ;
210
+ return Trace ( DokanResult . PathNotFound , fileName , info ) ;
211
211
}
212
212
213
213
// Memory-mapped
@@ -235,29 +235,29 @@ public virtual unsafe NtStatus WriteFile(string fileName, IntPtr buffer, uint bu
235
235
fileHandle . Stream . Write ( bufferSpan ) ;
236
236
bytesWritten = alignedBytesToCopy ;
237
237
238
- return Trace ( DokanResult . Success , nameof ( WriteFile ) , fileName , info ) ;
238
+ return Trace ( DokanResult . Success , fileName , info ) ;
239
239
}
240
240
catch ( PathTooLongException )
241
241
{
242
242
bytesWritten = 0 ;
243
- return Trace ( DokanResult . InvalidName , nameof ( WriteFile ) , fileName , info ) ;
243
+ return Trace ( DokanResult . InvalidName , fileName , info ) ;
244
244
}
245
245
catch ( CryptographicException )
246
246
{
247
247
bytesWritten = 0 ;
248
- return Trace ( NtStatus . CrcError , nameof ( WriteFile ) , fileName , info ) ;
248
+ return Trace ( NtStatus . CrcError , fileName , info ) ;
249
249
}
250
250
catch ( UnavailableStreamException )
251
251
{
252
252
bytesWritten = 0 ;
253
- return Trace ( NtStatus . HandleNoLongerValid , nameof ( WriteFile ) , fileName , info ) ;
253
+ return Trace ( NtStatus . HandleNoLongerValid , fileName , info ) ;
254
254
}
255
255
catch ( IOException ioEx )
256
256
{
257
257
if ( ErrorHandlingHelpers . NtStatusFromException ( ioEx , out var ntStatus ) )
258
258
{
259
259
bytesWritten = 0 ;
260
- return Trace ( ( NtStatus ) ntStatus , nameof ( WriteFile ) , fileName , info ) ;
260
+ return Trace ( ( NtStatus ) ntStatus , fileName , info ) ;
261
261
}
262
262
263
263
throw ;
@@ -354,8 +354,8 @@ protected static int AlignSizeForPagingIo(int bufferLength, long offset, long st
354
354
return bufferLength ;
355
355
}
356
356
357
- protected static NtStatus Trace ( NtStatus result , string methodName , string fileName , IDokanFileInfo info ,
358
- FileAccess access , FileShare share , FileMode mode , FileOptions options , FileAttributes attributes )
357
+ protected static NtStatus Trace ( NtStatus result , string fileName , IDokanFileInfo info ,
358
+ FileAccess access , FileShare share , FileMode mode , FileOptions options , FileAttributes attributes , [ CallerMemberName ] string methodName = "" )
359
359
{
360
360
#if ! DEBUG
361
361
return result ;
@@ -373,7 +373,7 @@ protected static NtStatus Trace(NtStatus result, string methodName, string fileN
373
373
return result ;
374
374
}
375
375
376
- protected static NtStatus Trace ( NtStatus result , string methodName , string ? fileName , IDokanFileInfo info , params object [ ] ? args )
376
+ protected static NtStatus Trace ( NtStatus result , string ? fileName , IDokanFileInfo info , [ CallerMemberName ] string methodName = "" , params object [ ] ? args )
377
377
{
378
378
#if ! DEBUG
379
379
return result ;
0 commit comments