diff --git a/src/Files.App.BackgroundTasks/Files.App.BackgroundTasks.csproj b/src/Files.App.BackgroundTasks/Files.App.BackgroundTasks.csproj index 1991f87f1b68..8c40139a6e69 100644 --- a/src/Files.App.BackgroundTasks/Files.App.BackgroundTasks.csproj +++ b/src/Files.App.BackgroundTasks/Files.App.BackgroundTasks.csproj @@ -10,6 +10,7 @@ x86;x64;ARM64 win-x86;win-x64;win-arm64 true + true diff --git a/src/Files.App.CsWin32/Files.App.CsWin32.csproj b/src/Files.App.CsWin32/Files.App.CsWin32.csproj index e4ce900e550d..284886162fbf 100644 --- a/src/Files.App.CsWin32/Files.App.CsWin32.csproj +++ b/src/Files.App.CsWin32/Files.App.CsWin32.csproj @@ -9,6 +9,7 @@ Debug;Release x86;x64;arm64 win-x86;win-x64;win-arm64 + true diff --git a/src/Files.App.CsWin32/NativeMethods.txt b/src/Files.App.CsWin32/NativeMethods.txt index 2e6ce3dd09cb..ce5524f6885e 100644 --- a/src/Files.App.CsWin32/NativeMethods.txt +++ b/src/Files.App.CsWin32/NativeMethods.txt @@ -45,7 +45,6 @@ RemoveDirectoryFromApp GetKeyState CreateDirectoryFromApp WNetCancelConnection2 -NET_USE_CONNECT_FLAGS NETRESOURCEW WNetAddConnection3 CREDENTIALW @@ -78,7 +77,6 @@ GetAce SetEntriesInAcl ACL_SIZE_INFORMATION DeleteAce -EXPLICIT_ACCESS ACCESS_ALLOWED_ACE LookupAccountSid GetComputerName @@ -133,7 +131,6 @@ ShellExecuteEx CoTaskMemFree QueryDosDevice DeviceIoControl -GetLastError CreateFile GetVolumeInformation COMPRESSION_FORMAT diff --git a/src/Files.App.Storage/Files.App.Storage.csproj b/src/Files.App.Storage/Files.App.Storage.csproj index 8a03ac2ef60f..df82961c6cd5 100644 --- a/src/Files.App.Storage/Files.App.Storage.csproj +++ b/src/Files.App.Storage/Files.App.Storage.csproj @@ -10,6 +10,7 @@ x86;x64;arm64 win-x86;win-x64;win-arm64 true + true diff --git a/src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.Icon.cs b/src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.Icon.cs index 8735598a7fd6..9b1fd95a31a5 100644 --- a/src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.Icon.cs +++ b/src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.Icon.cs @@ -44,7 +44,8 @@ public unsafe static HRESULT TryGetThumbnail(this IWindowsStorable storable, int { thumbnailData = null; - using ComPtr pShellItemImageFactory = storable.ThisPtr.As(); + using ComPtr pShellItemImageFactory = default; + storable.ThisPtr.As(pShellItemImageFactory.GetAddressOf()); if (pShellItemImageFactory.IsNull) return HRESULT.E_NOINTERFACE; diff --git a/src/Files.App.Storage/Watchers/RecycleBinWatcher.cs b/src/Files.App.Storage/Watchers/RecycleBinWatcher.cs index 240fd7de7366..7b1782fac4ac 100644 --- a/src/Files.App.Storage/Watchers/RecycleBinWatcher.cs +++ b/src/Files.App.Storage/Watchers/RecycleBinWatcher.cs @@ -6,6 +6,7 @@ namespace Files.App.Storage.Watchers { + [Obsolete] public class RecycleBinWatcher : ITrashWatcher { private readonly List _watchers = []; diff --git a/src/Files.Core.Storage/Files.Core.Storage.csproj b/src/Files.Core.Storage/Files.Core.Storage.csproj index 624a22e6e56c..f0d6bbbd36e2 100644 --- a/src/Files.Core.Storage/Files.Core.Storage.csproj +++ b/src/Files.Core.Storage/Files.Core.Storage.csproj @@ -8,6 +8,7 @@ Debug;Release x86;x64;arm64 win-x86;win-x64;win-arm64 + true diff --git a/src/Files.Shared/Files.Shared.csproj b/src/Files.Shared/Files.Shared.csproj index 8953f3678daa..a8b3b0fe4013 100644 --- a/src/Files.Shared/Files.Shared.csproj +++ b/src/Files.Shared/Files.Shared.csproj @@ -8,6 +8,7 @@ Debug;Release x86;x64;arm64 win-x86;win-x64;win-arm64 + true diff --git a/src/Files.Shared/Helpers/PathHelpers.cs b/src/Files.Shared/Helpers/PathHelpers.cs index aac51a157b20..c3127c00587e 100644 --- a/src/Files.Shared/Helpers/PathHelpers.cs +++ b/src/Files.Shared/Helpers/PathHelpers.cs @@ -17,77 +17,28 @@ public static string Combine(string folder, string name) return folder.Contains('/') ? Path.Combine(folder, name).Replace('\\', '/') : Path.Combine(folder, name); } - public static string FormatName(string path) - { - string fileName; - string rootPath = Path.GetPathRoot(path) ?? string.Empty; - - if (rootPath == path && - ( path.StartsWith(@"\\") || - (new DriveInfo(path).DriveType == System.IO.DriveType.Network) - ) - ) - { - // Network Share path - fileName = path.Substring(path.LastIndexOf(@"\", StringComparison.Ordinal) + 1); - } - else if (rootPath == path) - { - // Drive path - fileName = path; - } - else - { - // Standard file name - fileName = Path.GetFileName(path); - } - - // Check for link file name - if (FileExtensionHelpers.IsShortcutOrUrlFile(fileName)) - fileName = fileName.Remove(fileName.Length - 4); - - return fileName; - } - - /// - /// Determines whether the points to any special system folders. - /// - /// - /// The term "Special folder" refers to any folders that may be natively supported by a certain platform (e.g. Libraries). - /// - /// The path to a folder to check. - /// If the path points to a special folder, returns true; otherwise false. - public static bool IsSpecialFolder(string path) - { - foreach (Environment.SpecialFolder specialFolder in Enum.GetValues(typeof(Environment.SpecialFolder))) - { - var specialFolderPath = Environment.GetFolderPath(specialFolder); - if (string.Equals(specialFolderPath, path, StringComparison.OrdinalIgnoreCase)) - return true; - } - - return false; - } - public static bool TryGetFullPath(string commandName, out string fullPath) { fullPath = string.Empty; try { - var p = new Process(); - p.StartInfo = new ProcessStartInfo + var p = new Process { - UseShellExecute = false, - CreateNoWindow = true, - FileName = "where.exe", - Arguments = commandName, - RedirectStandardOutput = true + StartInfo = new ProcessStartInfo + { + UseShellExecute = false, + CreateNoWindow = true, + FileName = "where.exe", + Arguments = commandName, + RedirectStandardOutput = true + } }; + p.Start(); + var output = p.StandardOutput.ReadToEnd(); p.WaitForExit(1000); - if (p.ExitCode != 0) return false; @@ -97,16 +48,17 @@ public static bool TryGetFullPath(string commandName, out string fullPath) if (FileExtensionHelpers.IsExecutableFile(line)) { fullPath = line; + return true; } } + return false; } catch (Exception) { return false; } - } } } diff --git a/src/Files.Shared/Utils/IAsyncInitialize.cs b/src/Files.Shared/Utils/IAsyncInitialize.cs index 8591c225a96f..47f776fd8f4a 100644 --- a/src/Files.Shared/Utils/IAsyncInitialize.cs +++ b/src/Files.Shared/Utils/IAsyncInitialize.cs @@ -6,16 +6,16 @@ namespace Files.Shared.Utils { - /// - /// Allows an object to be initialized asynchronously. - /// - public interface IAsyncInitialize - { - /// - /// Initializes resources and prepares them for use. - /// - /// A that cancels this action. - /// A that represents the asynchronous operation. - Task InitAsync(CancellationToken cancellationToken = default); - } + /// + /// Allows an object to be initialized asynchronously. + /// + public interface IAsyncInitialize + { + /// + /// Initializes resources and prepares them for use. + /// + /// A that cancels this action. + /// A that represents the asynchronous operation. + Task InitAsync(CancellationToken cancellationToken = default); + } }