Skip to content

Commit 27a6f72

Browse files
committed
Release 2.0.5.2 - Nuget - Update and package documentation + Readme
1 parent 0f62ea0 commit 27a6f72

16 files changed

+104
-76
lines changed

DokanNet/Dokan.cs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class Dokan : IDisposable
1717
/// <summary>
1818
/// Initialize all required Dokan internal resources.
1919
///
20-
/// This needs to be called only once before trying to use <see cref="Mount"/> or <see cref="CreateFileSystem"/> for the first time.
20+
/// This needs to be called only once before trying to use <see cref="DokanInstance.DokanInstance"/> for the first time.
2121
/// Otherwise both will fail and raise an exception.
2222
/// </summary>
2323
/// <param name="logger"><see cref="ILogger"/> that will log all DokanNet debug informations.</param>
@@ -64,7 +64,7 @@ public bool RemoveMountPoint(string mountPoint)
6464
/// <summary>
6565
/// Dokan User FS file-change notifications
6666
/// </summary>
67-
/// <remarks> If <see cref="DokanOptions.EnableNotificationAPI"/> is passed to <see cref="Dokan.Mount"/>,
67+
/// <remarks> If <see cref="DokanOptions.EnableNotificationAPI"/> is passed to <see cref="DOKAN_OPTIONS.Options"/>,
6868
/// the application implementing the user file system can notify
6969
/// the Dokan kernel driver of external file- and directory-changes.
7070
///
@@ -84,7 +84,7 @@ public class Notify
8484
/// <summary>
8585
/// Notify Dokan that a file or directory has been created.
8686
/// </summary>
87-
/// <param name="dokanInstance">The dokan mount context created by <see cref="DokanCreateFileSystem"/></param>
87+
/// <param name="dokanInstance">The dokan mount context created by <see cref="DokanInstance.DokanInstance"/></param>
8888
/// <param name="filePath">Absolute path to the file or directory, including the mount-point of the file system.</param>
8989
/// <param name="isDirectory">Indicates if the path is a directory.</param>
9090
/// <returns>true if the notification succeeded.</returns>
@@ -96,7 +96,7 @@ public static bool Create(DokanInstance dokanInstance, string filePath, bool isD
9696
/// <summary>
9797
/// Notify Dokan that a file or directory has been deleted.
9898
/// </summary>
99-
/// <param name="dokanInstance">The dokan mount context created by <see cref="DokanCreateFileSystem"/></param>
99+
/// <param name="dokanInstance">The dokan mount context created by <see cref="DokanInstance.DokanInstance"/></param>
100100
/// <param name="filePath">Absolute path to the file or directory, including the mount-point of the file system.</param>
101101
/// <param name="isDirectory">Indicates if the path is a directory.</param>
102102
/// <returns>true if notification succeeded.</returns>
@@ -109,7 +109,7 @@ public static bool Delete(DokanInstance dokanInstance, string filePath, bool isD
109109
/// <summary>
110110
/// Notify Dokan that file or directory attributes have changed.
111111
/// </summary>
112-
/// <param name="dokanInstance">The dokan mount context created by <see cref="DokanCreateFileSystem"/></param>
112+
/// <param name="dokanInstance">The dokan mount context created by <see cref="DokanInstance.DokanInstance"/></param>
113113
/// <param name="filePath">Absolute path to the file or directory, including the mount-point of the file system.</param>
114114
/// <returns>true if notification succeeded.</returns>
115115
/// <remarks><see cref="DokanOptions.EnableNotificationAPI"/> must be set in the mount options for this to succeed.</remarks>
@@ -121,7 +121,7 @@ public static bool Update(DokanInstance dokanInstance, string filePath)
121121
/// <summary>
122122
/// Notify Dokan that file or directory extended attributes have changed.
123123
/// </summary>
124-
/// <param name="dokanInstance">The dokan mount context created by <see cref="DokanCreateFileSystem"/></param>
124+
/// <param name="dokanInstance">The dokan mount context created by <see cref="DokanInstance.DokanInstance"/></param>
125125
/// <param name="filePath">Absolute path to the file or directory, including the mount-point of the file system.</param>
126126
/// <returns>true if notification succeeded.</returns>
127127
/// <remarks><see cref="DokanOptions.EnableNotificationAPI"/> must be set in the mount options for this to succeed.</remarks>
@@ -134,7 +134,7 @@ public static bool XAttrUpdate(DokanInstance dokanInstance, string filePath)
134134
/// Notify Dokan that a file or directory has been renamed.
135135
/// This method supports in-place rename for file/directory within the same parent.
136136
/// </summary>
137-
/// <param name="dokanInstance">The dokan mount context created by <see cref="DokanCreateFileSystem"/></param>
137+
/// <param name="dokanInstance">The dokan mount context created by <see cref="DokanInstance.DokanInstance"/></param>
138138
/// <param name="oldPath">Old, absolute path to the file or directory, including the mount-point of the file system.</param>
139139
/// <param name="newPath">New, absolute path to the file or directory, including the mount-point of the file system.</param>
140140
/// <param name="isDirectory">Indicates if the path is a directory.</param>
@@ -150,6 +150,10 @@ public static bool Rename(DokanInstance dokanInstance, string oldPath, string ne
150150
}
151151
}
152152

153+
/// <summary>
154+
/// Dispose the native Dokan Library resources
155+
/// </summary>
156+
/// <param name="disposing">Whether this was called from <see cref="Dispose()"/></param>
153157
protected virtual void Dispose(bool disposing)
154158
{
155159
if (!_disposed)
@@ -165,14 +169,19 @@ protected virtual void Dispose(bool disposing)
165169
}
166170
}
167171

172+
/// <summary>
173+
/// Dispose the native Dokan Library resources
174+
/// </summary>
168175
public void Dispose()
169176
{
170177
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
171178
Dispose(disposing: true);
172179
GC.SuppressFinalize(this);
173180
}
174181

175-
// override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources
182+
/// <summary>
183+
/// Override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources
184+
/// </summary>
176185
~Dokan()
177186
{
178187
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method

DokanNet/DokanInstance.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace DokanNet
66
{
77
/// <summary>
8-
/// Created by <see cref="Dokan.CreateFileSystem"/>.
8+
/// Created by <see cref="DokanInstance.DokanInstance"/>.
99
/// It holds all the resources required to be alive for the time of the mount.
1010
/// </summary>
1111
public class DokanInstance : IDisposable
@@ -49,6 +49,10 @@ private static DOKAN_OPERATIONS PrepareOperations(ILogger logger, IDokanOperatio
4949
internal DokanHandle DokanHandle { get; private set; }
5050
private readonly object _disposeLock;
5151
private bool _disposed = false;
52+
53+
/// <summary>
54+
/// Whether the object was already disposed.
55+
/// </summary>
5256
public bool IsDisposed
5357
{
5458
get { lock (_disposeLock) return _disposed; }
@@ -68,6 +72,10 @@ internal DokanInstance(ILogger logger, DOKAN_OPTIONS options, IDokanOperations o
6872
DokanHandle = handle;
6973
}
7074

75+
/// <summary>
76+
/// Dispose the native Dokan Library resources
77+
/// </summary>
78+
/// <param name="disposing">Whether this was called from <see cref="Dispose()"/></param>
7179
protected virtual void Dispose(bool disposing)
7280
{
7381
lock (_disposeLock)
@@ -76,7 +84,6 @@ protected virtual void Dispose(bool disposing)
7684
{
7785
if (disposing)
7886
{
79-
// Dispose managed state (managed objects)
8087
DokanHandle?.Dispose(); // This calls DokanCloseHandle and waits for dismount
8188
DokanOptions?.Dispose(); // After that, it is safe to free unmanaged memory
8289
DokanOperations?.Dispose();
@@ -94,12 +101,18 @@ protected virtual void Dispose(bool disposing)
94101
}
95102
}
96103

104+
/// <summary>
105+
/// Destructor that force dispose
106+
/// </summary>
97107
~DokanInstance()
98108
{
99109
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
100110
Dispose(disposing: false);
101111
}
102112

113+
/// <summary>
114+
/// Dispose the native Dokan Library resources
115+
/// </summary>
103116
public void Dispose()
104117
{
105118
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method

DokanNet/DokanInstanceBuilder.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,32 @@
99

1010
namespace DokanNet
1111
{
12+
/// <summary>
13+
/// Dokan FileSystem build helper. Allows to create one or multiple <see cref="DokanInstance"/> based on a given configuration.
14+
/// </summary>
1215
public class DokanInstanceBuilder
1316
{
17+
/// <summary>
18+
/// Delegate used by <see cref="ConfigureOptions"/> to customize th internal <see cref="DOKAN_OPTIONS"/>.
19+
/// </summary>
1420
public delegate void OptionsConfigurationDelegate(DOKAN_OPTIONS options);
21+
1522
/// <summary>
1623
/// The Dokan version that DokanNet is compatible with.
1724
/// </summary>
1825
/// <see cref="DOKAN_OPTIONS.Version"/>
1926
public const ushort DOKAN_VERSION = 200;
27+
2028
private readonly DOKAN_OPTIONS _options;
29+
2130
[SuppressMessage("CodeQuality", "IDE0052:Remove unread private members", Justification = "Dokan instance isn't really needed, a reference is kept to enforce a workflow")]
2231
private readonly Dokan _dokan;
32+
2333
private ILogger _logger;
2434

35+
/// <summary>
36+
/// Constructure an object with a <see cref="NullLogger"/> and default <see cref="DOKAN_OPTIONS"/> that will use the given <paramref name="dokan"/>.
37+
/// </summary>
2538
public DokanInstanceBuilder(Dokan dokan)
2639
{
2740
_logger = new NullLogger();
@@ -40,21 +53,40 @@ public DokanInstanceBuilder(Dokan dokan)
4053
};
4154
_dokan = dokan;
4255
}
56+
57+
/// <summary>
58+
/// Allows to set a custom <see cref="ILogger"/> like <see cref="Logger"/>, <see cref="TraceLogger"/> to be used
59+
/// for the instance created by <see cref="Build"/>.
60+
/// </summary>
4361
public DokanInstanceBuilder ConfigureLogger(Func<ILogger> IlogegrFactory)
4462
{
4563
_logger = IlogegrFactory();
4664
return this;
4765
}
66+
67+
/// <summary>
68+
/// Allows to personalize the <see cref="DOKAN_OPTIONS"/> use for <see cref="Build"/>.
69+
/// </summary>
4870
public DokanInstanceBuilder ConfigureOptions(OptionsConfigurationDelegate optionsConfigurationDelegate)
4971
{
5072
optionsConfigurationDelegate(_options);
5173
return this;
5274
}
75+
76+
/// <summary>
77+
/// Verify that the provided configuration is valid.
78+
/// Note: Has no effect for now.
79+
/// </summary>
5380
public DokanInstanceBuilder Validate()
5481
{
5582
// throw on errors
5683
return this;
5784
}
85+
86+
/// <summary>
87+
/// Create a <see cref="DokanInstance"/> based on the previously provided information
88+
/// through <see cref="ConfigureOptions"/> and <see cref="ConfigureLogger"/>.
89+
/// </summary>
5890
public DokanInstance Build(IDokanOperations operations)
5991
{
6092
return new DokanInstance(_logger, _options, operations);

DokanNet/DokanNet.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88

99
This is a .NET wrapper over Dokan, and allows you to create your own file systems in Windows.</Description>
1010
<Copyright>Copyright (C) 2022</Copyright>
11-
<Version>2.0.5.1</Version>
12-
<AssemblyVersion>2.0.5.1</AssemblyVersion>
13-
<FileVersion>2.0.5.1</FileVersion>
11+
<Version>2.0.5.2</Version>
12+
<AssemblyVersion>2.0.5.2</AssemblyVersion>
13+
<FileVersion>2.0.5.2</FileVersion>
1414
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
1515
<GenerateDocumentationFile>true</GenerateDocumentationFile>
16+
<PackageReadmeFile>README.md</PackageReadmeFile>
1617
<Company>Dokan-dev</Company>
1718
<Authors>AdrienJ, MaximeC, Hiroki Asakawa</Authors>
1819
<PackageProjectUrl>https://dokan-dev.github.io/</PackageProjectUrl>
@@ -34,6 +35,7 @@ This is a .NET wrapper over Dokan, and allows you to create your own file system
3435

3536
<ItemGroup>
3637
<None Include="..\dokan_logo.png" Pack="true" PackagePath="\" />
38+
<None Include="..\README.md" Pack="true" PackagePath="\"/>
3739
</ItemGroup>
3840

3941
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">

DokanNet/DokanOperationProxy.cs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,6 @@ public delegate NtStatus SetFileSecurityDelegate(
155155
uint rawSecurityDescriptorLength,
156156
[MarshalAs(UnmanagedType.LPStruct), In /*, Out*/] DokanFileInfo rawFileInfo);
157157

158-
/// <summary>
159-
/// Retrieve all FileStreams informations on the file.
160-
/// This is only called if <see cref="DokanOptions.AltStream"/> is enabled.
161-
/// </summary>
162-
/// <remarks>Supported since 0.8.0.
163-
/// You must specify the version at <see cref="DOKAN_OPTIONS.Version"/>.</remarks>
164-
/// <param name="rawFileName">Filename</param>
165-
/// <param name="rawFillFindData">A <see cref="IntPtr"/> to a <see cref="FILL_FIND_STREAM_DATA"/>.</param>
166-
/// <param name="rawFileInfo">A <see cref="DokanFileInfo"/>.</param>
167-
/// <returns></returns>
168158
public delegate NtStatus FindStreamsDelegate(
169159
[MarshalAs(UnmanagedType.LPWStr)] string rawFileName,
170160
IntPtr rawFillFindData,
@@ -781,7 +771,7 @@ public NtStatus FindStreamsProxy(string rawFileName, IntPtr rawFillFindData, Int
781771
/// <returns>A instance of the specified delegate type.</returns>
782772
/// <param name="rawDelegate">The unmanaged function pointer to convert. </param>
783773
/// <typeparam name="TDelegate">The type of the delegate to return. </typeparam>
784-
/// <exception cref="T:System.ArgumentException">The <typeparam name="TDelegate" /> generic parameter is not a delegate, or it is an open generic type.</exception>
774+
/// <exception cref="T:System.ArgumentException">The <typeparamref name="TDelegate" /> generic parameter is not a delegate, or it is an open generic type.</exception>
785775
/// <exception cref="T:System.ArgumentNullException">The <paramref name="rawDelegate" /> parameter is null.</exception>
786776
private static TDelegate GetDataFromPointer<TDelegate>(IntPtr rawDelegate) where TDelegate : class
787777
{
@@ -793,10 +783,10 @@ private static TDelegate GetDataFromPointer<TDelegate>(IntPtr rawDelegate) where
793783
}
794784

795785
/// <summary>
796-
/// Call the delegate <paramref name="fill"/> using data in <paramref name="rawFileInfo"/> and <paramref name="fi"/>.
786+
/// Call the delegate <paramref name="fill"/> using data in <paramref name="fi"/> and <paramref name="findStreamContext"/>.
797787
/// </summary>
798788
/// <param name="fill">The delegate of type <see cref="FILL_FIND_STREAM_DATA"/> to be called.</param>
799-
/// <param name="rawFileInfo">A <see cref="DokanFileInfo"/> to be used when calling <paramref name="fill"/>.</param>
789+
/// <param name="findStreamContext">A <see cref="IntPtr"/> to be used when calling <paramref name="fill"/>.</param>
800790
/// <param name="fi">A <see cref="FileInformation"/> with information to be used when calling <paramref name="fill"/>.</param>
801791
/// <returns>Whether the buffer is full or not.</returns>
802792
private static bool AddTo(FILL_FIND_STREAM_DATA fill, IntPtr findStreamContext, FileInformation fi)

DokanNet/Extensions.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55

66
namespace DokanNet
77
{
8+
/// <summary>
9+
/// <see cref="DokanInstance"/> extensions allowing to check whether it is running or to wait until it is unmount.
10+
/// </summary>
811
public static class Extensions
912
{
1013
/// <summary>
1114
/// Check if the FileSystem is still running or not.
1215
/// </summary>
13-
/// <param name="dokanInstance">The dokan mount context created by <see cref="CreateFileSystem"/>.</param>
16+
/// <param name="dokanInstance">The dokan mount context created by <see cref="DokanInstance.DokanInstance"/>.</param>
1417
/// <returns>Whether the FileSystem is still running or not.</returns>
1518
public static Boolean IsFileSystemRunning(this DokanInstance dokanInstance)
1619
{
@@ -20,9 +23,9 @@ public static Boolean IsFileSystemRunning(this DokanInstance dokanInstance)
2023
/// <summary>
2124
/// Wait until the FileSystem is unmount.
2225
/// </summary>
23-
/// <param name="dokanInstance">The dokan mount context created by <see cref="CreateFileSystem"/>.</param>
24-
/// <param name="milliSeconds">The time-out interval, in milliseconds. If a nonzero value is specified, the function waits until the object is signaled or the interval elapses. If <param name="milliSeconds"> is zero,
25-
/// the function does not enter a wait state if the object is not signaled; it always returns immediately. If <param name="milliSeconds"> is INFINITE, the function will return only when the object is signaled.</param>
26+
/// <param name="dokanInstance">The dokan mount context created by <see cref="DokanInstance.DokanInstance"/>.</param>
27+
/// <param name="milliSeconds">The time-out interval, in milliseconds. If a nonzero value is specified, the function waits until the object is signaled or the interval elapses. If set to zero,
28+
/// the function does not enter a wait state if the object is not signaled; it always returns immediately. If set to INFINITE, the function will return only when the object is signaled.</param>
2629
/// <returns>See <a href="https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitforsingleobject">WaitForSingleObject</a> for a description of return values.</returns>
2730
public static UInt32 WaitForFileSystemClosed(this DokanInstance dokanInstance, UInt32 milliSeconds)
2831
{

DokanNet/FileAccess.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public enum FileAccess : long
2727
/// </summary>
2828
/// \native
2929
/// \table
30-
/// \nativeconst{FILE_READ_DATA,0x00000001,File & pipe}
30+
/// \nativeconst{FILE_READ_DATA,0x00000001,File &amp; pipe}
3131
/// \nativeconst{FILE_LIST_DIRECTORY,0x00000001,Directory}
3232
/// \endtable
3333
/// \endnative
@@ -38,7 +38,7 @@ public enum FileAccess : long
3838
/// </summary>
3939
/// \native
4040
/// \table
41-
/// \nativeconst{FILE_WRITE_DATA,0x00000002,File & pipe}
41+
/// \nativeconst{FILE_WRITE_DATA,0x00000002,File &amp; pipe}
4242
/// \nativeconst{FILE_ADD_FILE,0x00000002,Directory}
4343
/// \endtable
4444
/// \endnative
@@ -61,7 +61,7 @@ public enum FileAccess : long
6161
/// </summary>
6262
/// \native
6363
/// \table
64-
/// \nativeconst{FILE_READ_EA,0x00000008,File & directory}
64+
/// \nativeconst{FILE_READ_EA,0x00000008,File &amp; directory}
6565
/// \endtable
6666
/// \endnative
6767
ReadExtendedAttributes = 1L << 3,
@@ -71,7 +71,7 @@ public enum FileAccess : long
7171
/// </summary>
7272
/// \native
7373
/// \table
74-
/// \nativeconst{FILE_WRITE_EA,0x00000010,File & directory}
74+
/// \nativeconst{FILE_WRITE_EA,0x00000010,File &amp; directory}
7575
/// \endtable
7676
/// \endnative
7777
WriteExtendedAttributes = 1L << 4,

0 commit comments

Comments
 (0)