Skip to content

feat(widgets): Reduce default padding by 18-25 percent #8850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.ComponentModel;
using System.Threading.Tasks;

namespace Files.Backend.Services.Settings
namespace Files.Backend.Services
{
public interface IUpdateSettingsService : IBaseSettingsService, INotifyPropertyChanged
public interface IUpdateService : INotifyPropertyChanged
{
/// <summary>
/// Gets a value indicating whether updates are available.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,10 @@ public interface IAppearanceSettingsService : IBaseSettingsService, INotifyPrope
/// Gets or sets a value indicating whether or not recycle bin should be pinned to the sidebar.
/// </summary>
bool PinRecycleBinToSidebar { get; set; }

/// <summary>
/// Gets or sets a value indicating whether or not to use the compact styles.
/// </summary>
bool UseCompactStyles { get; set; }
}
}
4 changes: 1 addition & 3 deletions src/Files.Launcher/Helpers/FileUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static extern int RmGetList(uint dwSessionHandle,
/// http://wyupdate.googlecode.com/svn-history/r401/trunk/frmFilesInUse.cs (no copyright in code at time of viewing)
///
/// </remarks>
static public List<Process> WhoIsLocking(string path)
public static List<Process> WhoIsLocking(string[] resources)
{
string key = Guid.NewGuid().ToString();
List<Process> processes = new List<Process>();
Expand All @@ -94,8 +94,6 @@ static public List<Process> WhoIsLocking(string path)
uint pnProcInfo = 0;
uint lpdwRebootReasons = RmRebootReasonNone;

string[] resources = new string[] { path }; // Just checking on one resource.

res = RmRegisterResources(handle, (uint)resources.Length, resources, 0, null, 0, null);

if (res != 0) throw new Exception("Could not register resource.");
Expand Down
7 changes: 4 additions & 3 deletions src/Files.Launcher/Helpers/ShellNewMenuHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ private static async Task<ShellNewEntry> GetShellNewRegistryEntries(RegistryKey
private static async Task<ShellNewEntry> ParseShellNewRegistryEntry(RegistryKey key, RegistryKey root)
{
var valueNames = key.GetValueNames();
if (!valueNames.Contains("NullFile") &&
!valueNames.Contains("ItemName") &&
!valueNames.Contains("FileName"))
if (!valueNames.Contains("NullFile", StringComparer.OrdinalIgnoreCase) &&
!valueNames.Contains("ItemName", StringComparer.OrdinalIgnoreCase) &&
!valueNames.Contains("FileName", StringComparer.OrdinalIgnoreCase) &&
!valueNames.Contains("Command", StringComparer.OrdinalIgnoreCase))
{
return null;
}
Expand Down
25 changes: 25 additions & 0 deletions src/Files.Launcher/MessageHandlers/FileOperationsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,31 @@ await Win32API.StartSTATask(() =>
}
break;

case "CheckFileInUse":
{
var fileToCheckPath = ((string)message["filepath"]).Split('|');
var processes = SafetyExtensions.IgnoreExceptions(() => FileUtils.WhoIsLocking(fileToCheckPath), Program.Logger);
if (processes != null)
{
var win32proc = processes.Select(x => new Win32Process()
{
Name = x.ProcessName,
Pid = x.Id,
FileName = x.MainModule?.FileName
}).ToList();
processes.ForEach(x => x.Dispose());
await Win32API.SendMessageAsync(connection, new ValueSet() {
{ "Processes", JsonConvert.SerializeObject(win32proc) }
}, message.Get("RequestID", (string)null));
}
else
{
await Win32API.SendMessageAsync(connection, new ValueSet(),
message.Get("RequestID", (string)null));
}
}
break;

case "ParseLink":
try
{
Expand Down
2 changes: 1 addition & 1 deletion src/Files.Launcher/MessageHandlers/Win32MessageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public async Task ParseArgumentsAsync(PipeStream connection, Dictionary<string,
var dataPath = Environment.ExpandEnvironmentVariables("%LocalAppData%\\Files");
if (enable)
{
if (!Win32API.RunPowershellCommand($"-command \"New-Item -Force -Path {dataPath} -ItemType Directory; Copy-Item -Filter *.* -Path '{destFolder}\\*' -Recurse -Force -Destination '{dataPath}'\"", false))
if (!Win32API.RunPowershellCommand($"-command \"New-Item -Force -Path '{dataPath}' -ItemType Directory; Copy-Item -Filter *.* -Path '{destFolder}\\*' -Recurse -Force -Destination '{dataPath}'\"", false))
{
// Error copying files
DetectIsSetAsDefaultFileManager();
Expand Down
12 changes: 6 additions & 6 deletions src/Files.OpenDialog/CustomOpenDialog/CustomOpenDialog.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
<OutputFile>$(OutDir)CustomOpenDialog$(PlatformArchitecture)$(TargetExt)</OutputFile>
</Link>
<PostBuildEvent>
<Command>xcopy /s /y $(ProjectDir)$(OutDir)*.dll $(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog</Command>
<Command>xcopy /s /y "$(ProjectDir)$(OutDir)*.dll" "$(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand Down Expand Up @@ -205,7 +205,7 @@
<OutputFile>$(OutDir)CustomOpenDialog$(PlatformArchitecture)$(TargetExt)</OutputFile>
</Link>
<PostBuildEvent>
<Command>xcopy /s /y $(ProjectDir)$(OutDir)*.dll $(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog</Command>
<Command>xcopy /s /y "$(ProjectDir)$(OutDir)*.dll" "$(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm64'">
Expand Down Expand Up @@ -242,7 +242,7 @@
<OutputFile>$(OutDir)CustomOpenDialog$(PlatformArchitecture)$(TargetExt)</OutputFile>
</Link>
<PostBuildEvent>
<Command>xcopy /s /y $(ProjectDir)$(OutDir)*.dll $(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog</Command>
<Command>xcopy /s /y "$(ProjectDir)$(OutDir)*.dll" "$(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down Expand Up @@ -281,7 +281,7 @@
<OutputFile>$(OutDir)CustomOpenDialog$(PlatformArchitecture)$(TargetExt)</OutputFile>
</Link>
<PostBuildEvent>
<Command>xcopy /s /y $(ProjectDir)$(OutDir)*.dll $(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog</Command>
<Command>xcopy /s /y "$(ProjectDir)$(OutDir)*.dll" "$(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand Down Expand Up @@ -319,7 +319,7 @@
<OutputFile>$(OutDir)CustomOpenDialog$(PlatformArchitecture)$(TargetExt)</OutputFile>
</Link>
<PostBuildEvent>
<Command>xcopy /s /y $(ProjectDir)$(OutDir)*.dll $(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog</Command>
<Command>xcopy /s /y "$(ProjectDir)$(OutDir)*.dll" "$(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|arm64'">
Expand Down Expand Up @@ -358,7 +358,7 @@
<OutputFile>$(OutDir)CustomOpenDialog$(PlatformArchitecture)$(TargetExt)</OutputFile>
</Link>
<PostBuildEvent>
<Command>xcopy /s /y $(ProjectDir)$(OutDir)*.dll $(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog</Command>
<Command>xcopy /s /y "$(ProjectDir)$(OutDir)*.dll" "$(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion src/Files.OpenDialog/FilesLauncher/FilesLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ bool OpenInExistingShellWindow(const TCHAR* folderPath)

bool opened = false;
IShellWindows* shellWindows;
long shellWindowsCount;
if (SUCCEEDED(CoCreateInstance(CLSID_ShellWindows, NULL, CLSCTX_LOCAL_SERVER, IID_IShellWindows, (void**)&shellWindows)))
{
VARIANT v;
Expand Down
18 changes: 12 additions & 6 deletions src/Files.OpenDialog/FilesLauncher/FilesLauncher.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,15 @@
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(OutDir)FilesLauncher$(TargetExt)</OutputFile>
</Link>
<PostBuildEvent>
<Command>xcopy /s /y $(ProjectDir)$(OutDir)*.exe $(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog</Command>
<Command>xcopy /s /y "$(ProjectDir)$(OutDir)*.exe" "$(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand All @@ -147,6 +148,7 @@
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -156,7 +158,7 @@
<OutputFile>$(OutDir)FilesLauncher$(TargetExt)</OutputFile>
</Link>
<PostBuildEvent>
<Command>xcopy /s /y $(ProjectDir)$(OutDir)*.exe $(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog</Command>
<Command>xcopy /s /y "$(ProjectDir)$(OutDir)*.exe" "$(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand All @@ -166,14 +168,15 @@
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(OutDir)FilesLauncher$(TargetExt)</OutputFile>
</Link>
<PostBuildEvent>
<Command>xcopy /s /y $(ProjectDir)$(OutDir)*.exe $(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog</Command>
<Command>xcopy /s /y "$(ProjectDir)$(OutDir)*.exe" "$(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm64'">
Expand All @@ -183,14 +186,15 @@
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(OutDir)FilesLauncher$(TargetExt)</OutputFile>
</Link>
<PostBuildEvent>
<Command>xcopy /s /y $(ProjectDir)$(OutDir)*.exe $(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog</Command>
<Command>xcopy /s /y "$(ProjectDir)$(OutDir)*.exe" "$(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -202,6 +206,7 @@
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -211,7 +216,7 @@
<OutputFile>$(OutDir)FilesLauncher$(TargetExt)</OutputFile>
</Link>
<PostBuildEvent>
<Command>xcopy /s /y $(ProjectDir)$(OutDir)*.exe $(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog</Command>
<Command>xcopy /s /y "$(ProjectDir)$(OutDir)*.exe" "$(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|arm64'">
Expand All @@ -223,6 +228,7 @@
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -232,7 +238,7 @@
<OutputFile>$(OutDir)FilesLauncher$(TargetExt)</OutputFile>
</Link>
<PostBuildEvent>
<Command>xcopy /s /y $(ProjectDir)$(OutDir)*.exe $(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog</Command>
<Command>xcopy /s /y "$(ProjectDir)$(OutDir)*.exe" "$(ProjectDir)..\..\..\src\Files.Launcher\Assets\FilesOpenDialog"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down
82 changes: 82 additions & 0 deletions src/Files.Shared/Enums/CopyEngineResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
namespace Files.Shared.Enums
{
public struct CopyEngineResult
{
// https://github.com/RickStrahl/DeleteFiles/blob/master/DeleteFiles/ZetaLongPaths/Native/FileOperations/Interop/CopyEngineResult.cs
// Ok
public const int S_OK = 0;
public const int COPYENGINE_S_DONT_PROCESS_CHILDREN = 2555912;
public const int COPYENGINE_E_USER_CANCELLED = -2144927744;
// Access denied
public const int COPYENGINE_E_ACCESS_DENIED_SRC = -2144927711;
public const int COPYENGINE_E_ACCESS_DENIED_DEST = -2144927710;
public const int COPYENGINE_E_REQUIRES_ELEVATION = -2144927742;
// Path too long
public const int COPYENGINE_E_PATH_TOO_DEEP_SRC = -2144927715;
public const int COPYENGINE_E_PATH_TOO_DEEP_DEST = -2144927714;
public const int COPYENGINE_E_RECYCLE_PATH_TOO_LONG = -2144927688;
public const int COPYENGINE_E_NEWFILE_NAME_TOO_LONG = -2144927685;
public const int COPYENGINE_E_NEWFOLDER_NAME_TOO_LONG = -2144927684;
// Not found
public const int COPYENGINE_E_RECYCLE_BIN_NOT_FOUND = -2144927686;
public const int COPYENGINE_E_PATH_NOT_FOUND_SRC = -2144927709;
public const int COPYENGINE_E_PATH_NOT_FOUND_DEST = -2144927708;
public const int COPYENGINE_E_NET_DISCONNECT_DEST = -2144927706;
public const int COPYENGINE_E_NET_DISCONNECT_SRC = -2144927707;
public const int COPYENGINE_E_CANT_REACH_SOURCE = -2144927691;
// File in use
public const int COPYENGINE_E_SHARING_VIOLATION_SRC = -2144927705;
public const int COPYENGINE_E_SHARING_VIOLATION_DEST = -2144927704;
// Already exists
public const int COPYENGINE_E_ALREADY_EXISTS_NORMAL = -2144927703;
public const int COPYENGINE_E_ALREADY_EXISTS_READONLY = -2144927702;
public const int COPYENGINE_E_ALREADY_EXISTS_SYSTEM = -2144927701;
public const int COPYENGINE_E_ALREADY_EXISTS_FOLDER = -2144927700;
// File too big
//public const int COPYENGINE_E_FILE_TOO_LARGE = -2144927731;
//public const int COPYENGINE_E_REMOVABLE_FULL = -2144927730;
//public const int COPYENGINE_E_DISK_FULL = -2144927694;
//public const int COPYENGINE_E_DISK_FULL_CLEAN = -2144927693;
//public const int COPYENGINE_E_RECYCLE_SIZE_TOO_BIG = -2144927689;
// Invalid path
public const int COPYENGINE_E_FILE_IS_FLD_DEST = -2144927732;
public const int COPYENGINE_E_FLD_IS_FILE_DEST = -2144927733;
//public const int COPYENGINE_E_INVALID_FILES_SRC = -2144927717;
//public const int COPYENGINE_E_INVALID_FILES_DEST = -2144927716;
//public const int COPYENGINE_E_SAME_FILE = -2144927741;
//public const int COPYENGINE_E_DEST_SAME_TREE = -2144927734;
//public const int COPYENGINE_E_DEST_SUBTREE = -2144927735;

public static FileSystemStatusCode Convert(int? hres)
{
return hres switch
{
CopyEngineResult.S_OK => FileSystemStatusCode.Success,
CopyEngineResult.COPYENGINE_E_ACCESS_DENIED_SRC => FileSystemStatusCode.Unauthorized,
CopyEngineResult.COPYENGINE_E_ACCESS_DENIED_DEST => FileSystemStatusCode.Unauthorized,
CopyEngineResult.COPYENGINE_E_REQUIRES_ELEVATION => FileSystemStatusCode.Unauthorized,
CopyEngineResult.COPYENGINE_E_RECYCLE_PATH_TOO_LONG => FileSystemStatusCode.NameTooLong,
CopyEngineResult.COPYENGINE_E_NEWFILE_NAME_TOO_LONG => FileSystemStatusCode.NameTooLong,
CopyEngineResult.COPYENGINE_E_NEWFOLDER_NAME_TOO_LONG => FileSystemStatusCode.NameTooLong,
CopyEngineResult.COPYENGINE_E_PATH_TOO_DEEP_SRC => FileSystemStatusCode.NameTooLong,
CopyEngineResult.COPYENGINE_E_PATH_TOO_DEEP_DEST => FileSystemStatusCode.NameTooLong,
CopyEngineResult.COPYENGINE_E_PATH_NOT_FOUND_SRC => FileSystemStatusCode.NotFound,
CopyEngineResult.COPYENGINE_E_PATH_NOT_FOUND_DEST => FileSystemStatusCode.NotFound,
CopyEngineResult.COPYENGINE_E_NET_DISCONNECT_DEST => FileSystemStatusCode.NotFound,
CopyEngineResult.COPYENGINE_E_NET_DISCONNECT_SRC => FileSystemStatusCode.NotFound,
CopyEngineResult.COPYENGINE_E_CANT_REACH_SOURCE => FileSystemStatusCode.NotFound,
CopyEngineResult.COPYENGINE_E_RECYCLE_BIN_NOT_FOUND => FileSystemStatusCode.NotFound,
CopyEngineResult.COPYENGINE_E_ALREADY_EXISTS_NORMAL => FileSystemStatusCode.AlreadyExists,
CopyEngineResult.COPYENGINE_E_ALREADY_EXISTS_READONLY => FileSystemStatusCode.AlreadyExists,
CopyEngineResult.COPYENGINE_E_ALREADY_EXISTS_SYSTEM => FileSystemStatusCode.AlreadyExists,
CopyEngineResult.COPYENGINE_E_ALREADY_EXISTS_FOLDER => FileSystemStatusCode.AlreadyExists,
CopyEngineResult.COPYENGINE_E_FILE_IS_FLD_DEST => FileSystemStatusCode.NotAFile,
CopyEngineResult.COPYENGINE_E_FLD_IS_FILE_DEST => FileSystemStatusCode.NotAFolder,
CopyEngineResult.COPYENGINE_E_SHARING_VIOLATION_SRC => FileSystemStatusCode.InUse,
CopyEngineResult.COPYENGINE_E_SHARING_VIOLATION_DEST => FileSystemStatusCode.InUse,
null => FileSystemStatusCode.Generic,
_ => FileSystemStatusCode.Generic
};
}
}
}
23 changes: 23 additions & 0 deletions src/Files.Shared/Extensions/DateExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Runtime.InteropServices.ComTypes;

namespace Files.Shared.Extensions
{
public static class DateExtensions
{
public static DateTime ToDateTime(this FILETIME time)
{
uint low = (uint)time.dwLowDateTime;
ulong high = (ulong)time.dwHighDateTime;
long fileTime = (long)((high << 32) + low);
try
{
return DateTime.FromFileTimeUtc(fileTime);
}
catch
{
return DateTime.FromFileTimeUtc(0xFFFFFFFF);
}
}
}
}
Loading