diff --git a/SteamCleaner/Properties/AssemblyInfo.cs b/SteamCleaner/Properties/AssemblyInfo.cs
index ffb0956..37d7c6e 100644
--- a/SteamCleaner/Properties/AssemblyInfo.cs
+++ b/SteamCleaner/Properties/AssemblyInfo.cs
@@ -39,5 +39,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.2.0.0")]
-[assembly: AssemblyFileVersion("2.2.0.0")]
\ No newline at end of file
+[assembly: AssemblyVersion("2.3.0.0")]
+[assembly: AssemblyFileVersion("2.3.0.0")]
\ No newline at end of file
diff --git a/SteamCleaner/Utilities/Files/SymbolicLink.cs b/SteamCleaner/Utilities/Files/SymbolicLink.cs
index bd1cc1d..0f2e646 100644
--- a/SteamCleaner/Utilities/Files/SymbolicLink.cs
+++ b/SteamCleaner/Utilities/Files/SymbolicLink.cs
@@ -1,33 +1,34 @@
-using System;
-using System.Collections.Generic;
+#region
+
+using System;
using System.IO;
-using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
-using System.Threading.Tasks;
using Microsoft.Win32.SafeHandles;
+#endregion
+
namespace SteamCleaner.Utilities.Files
{
public static class SymbolicLink
{
- private const uint genericReadAccess = 0x80000000;
+ private const uint GenericReadAccess = 0x80000000;
- private const uint fileFlagsForOpenReparsePointAndBackupSemantics = 0x02200000;
+ private const uint FileFlagsForOpenReparsePointAndBackupSemantics = 0x02200000;
- private const int ioctlCommandGetReparsePoint = 0x000900A8;
+ private const int IoctlCommandGetReparsePoint = 0x000900A8;
- private const uint openExisting = 0x3;
+ private const uint OpenExisting = 0x3;
- private const uint pathNotAReparsePointError = 0x80071126;
+ private const uint PathNotAReparsePointError = 0x80071126;
- private const uint shareModeAll = 0x7; // Read, Write, Delete
+ private const uint ShareModeAll = 0x7; // Read, Write, Delete
- private const uint symLinkTag = 0xA000000C;
+ private const uint SymLinkTag = 0xA000000C;
- private const int targetIsAFile = 0;
+ private const int TargetIsAFile = 0;
- private const int targetIsADirectory = 1;
+ private const int TargetIsADirectory = 1;
[DllImport("kernel32.dll", SetLastError = true)]
private static extern SafeFileHandle CreateFile(
@@ -40,7 +41,7 @@ private static extern SafeFileHandle CreateFile(
IntPtr hTemplateFile);
[DllImport("kernel32.dll", SetLastError = true)]
- static extern bool CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, int dwFlags);
+ private static extern bool CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, int dwFlags);
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool DeviceIoControl(
@@ -52,14 +53,16 @@ private static extern bool DeviceIoControl(
int nOutBufferSize,
out int lpBytesReturned,
IntPtr lpOverlapped);
+
public static bool IsSymbolic(string path)
{
- FileInfo pathInfo = new FileInfo(path);
+ var pathInfo = new FileInfo(path);
return pathInfo.Attributes.HasFlag(FileAttributes.ReparsePoint);
}
+
public static void CreateDirectoryLink(string linkPath, string targetPath)
{
- if (!CreateSymbolicLink(linkPath, targetPath, targetIsADirectory) || Marshal.GetLastWin32Error() != 0)
+ if (!CreateSymbolicLink(linkPath, targetPath, TargetIsADirectory) || Marshal.GetLastWin32Error() != 0)
{
try
{
@@ -74,7 +77,7 @@ public static void CreateDirectoryLink(string linkPath, string targetPath)
public static void CreateFileLink(string linkPath, string targetPath)
{
- if (!CreateSymbolicLink(linkPath, targetPath, targetIsAFile))
+ if (!CreateSymbolicLink(linkPath, targetPath, TargetIsAFile))
{
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
}
@@ -86,49 +89,49 @@ public static bool Exists(string path)
{
return false;
}
- string target = GetTarget(path);
+ var target = GetTarget(path);
return target != null;
}
- private static SafeFileHandle getFileHandle(string path)
+ private static SafeFileHandle GetFileHandle(string path)
{
- return CreateFile(path, genericReadAccess, shareModeAll, IntPtr.Zero, openExisting,
- fileFlagsForOpenReparsePointAndBackupSemantics, IntPtr.Zero);
+ return CreateFile(path, GenericReadAccess, ShareModeAll, IntPtr.Zero, OpenExisting,
+ FileFlagsForOpenReparsePointAndBackupSemantics, IntPtr.Zero);
}
public static string GetTarget(string path)
{
SymbolicLinkReparseData reparseDataBuffer;
- using (SafeFileHandle fileHandle = getFileHandle(path))
+ using (var fileHandle = GetFileHandle(path))
{
if (fileHandle.IsInvalid)
{
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
}
- int outBufferSize = Marshal.SizeOf(typeof(SymbolicLinkReparseData));
- IntPtr outBuffer = IntPtr.Zero;
+ var outBufferSize = Marshal.SizeOf(typeof(SymbolicLinkReparseData));
+ var outBuffer = IntPtr.Zero;
try
{
outBuffer = Marshal.AllocHGlobal(outBufferSize);
int bytesReturned;
- bool success = DeviceIoControl(
- fileHandle.DangerousGetHandle(), ioctlCommandGetReparsePoint, IntPtr.Zero, 0,
+ var success = DeviceIoControl(
+ fileHandle.DangerousGetHandle(), IoctlCommandGetReparsePoint, IntPtr.Zero, 0,
outBuffer, outBufferSize, out bytesReturned, IntPtr.Zero);
fileHandle.Close();
if (!success)
{
- if (((uint)Marshal.GetHRForLastWin32Error()) == pathNotAReparsePointError)
+ if ((uint) Marshal.GetHRForLastWin32Error() == PathNotAReparsePointError)
{
return null;
}
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
}
- reparseDataBuffer = (SymbolicLinkReparseData)Marshal.PtrToStructure(
+ reparseDataBuffer = (SymbolicLinkReparseData) Marshal.PtrToStructure(
outBuffer, typeof(SymbolicLinkReparseData));
}
finally
@@ -136,12 +139,12 @@ public static string GetTarget(string path)
Marshal.FreeHGlobal(outBuffer);
}
}
- if (reparseDataBuffer.ReparseTag != symLinkTag)
+ if (reparseDataBuffer.ReparseTag != SymLinkTag)
{
return null;
}
- string target = Encoding.Unicode.GetString(reparseDataBuffer.PathBuffer,
+ var target = Encoding.Unicode.GetString(reparseDataBuffer.PathBuffer,
reparseDataBuffer.PrintNameOffset, reparseDataBuffer.PrintNameLength);
return target;
diff --git a/SteamCleaner/Utilities/Files/SymbolicLinkReparseData.cs b/SteamCleaner/Utilities/Files/SymbolicLinkReparseData.cs
index e3b7eb2..9990b8b 100644
--- a/SteamCleaner/Utilities/Files/SymbolicLinkReparseData.cs
+++ b/SteamCleaner/Utilities/Files/SymbolicLinkReparseData.cs
@@ -1,20 +1,19 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
+#region
+
using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
+
+#endregion
namespace SteamCleaner.Utilities.Files
{
///
- /// Refer to http://msdn.microsoft.com/en-us/library/windows/hardware/ff552012%28v=vs.85%29.aspx
+ /// Refer to http://msdn.microsoft.com/en-us/library/windows/hardware/ff552012%28v=vs.85%29.aspx
///
[StructLayout(LayoutKind.Sequential)]
public struct SymbolicLinkReparseData
{
// Not certain about this!
- private const int maxUnicodePathLength = 260 * 2;
+ private const int MaxUnicodePathLength = 260*2;
public uint ReparseTag;
public ushort ReparseDataLength;
@@ -24,7 +23,6 @@ public struct SymbolicLinkReparseData
public ushort PrintNameOffset;
public ushort PrintNameLength;
public uint Flags;
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = maxUnicodePathLength)]
- public byte[] PathBuffer;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = MaxUnicodePathLength)] public byte[] PathBuffer;
}
-}
+}
\ No newline at end of file
diff --git a/version.xml b/version.xml
index 63e4277..b03622e 100644
--- a/version.xml
+++ b/version.xml
@@ -1,5 +1,5 @@
- 2.2
+ 2.3
https://github.com/Codeusa/SteamCleaner/releases/latest