Common is now error free

This commit is contained in:
Clint Rutkas
2024-08-29 21:28:10 -07:00
parent 255dc68f4f
commit ea4bbda107
5 changed files with 12 additions and 16 deletions

View File

@@ -15,16 +15,16 @@ public static class RuntimeHelper
{
get
{
// TODO! for whatever reason, when I ported this into the PT
// TODO: for whatever reason, when I ported this into the PT
// codebase, this no longer compiled. We're only ever using it for
// the hacked up settings and ignoring it anyways, so I'm leaving
// it commented out for now.
//
// it commented out for now.
//
// See also:
// * https://github.com/microsoft/win32metadata/commit/6fee67ba73bfe1b126ce524f7de8d367f0317715
// * https://github.com/microsoft/win32metadata/issues/1311
//uint length = 0;
//return PInvoke.GetCurrentPackageFullName(ref length, null) != WIN32_ERROR.APPMODEL_ERROR_NO_PACKAGE;
// uint length = 0;
// return PInvoke.GetCurrentPackageFullName(ref length, null) != WIN32_ERROR.APPMODEL_ERROR_NO_PACKAGE;
#pragma warning disable IDE0025 // Use expression body for property
return true;
#pragma warning restore IDE0025 // Use expression body for property

View File

@@ -4,7 +4,6 @@
<RootNamespace>Microsoft.CmdPal.Common</RootNamespace>
<Nullable>enable</Nullable>
<UseWinUI>true</UseWinUI>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

View File

@@ -11,8 +11,7 @@ namespace Microsoft.CmdPal.Common.Services;
public class FileService : IFileService
{
static readonly Encoding encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false);
private static readonly Encoding _encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false);
#pragma warning disable CS8603 // Possible null reference return.
public T Read<T>(string folderPath, string fileName)
@@ -36,7 +35,7 @@ public class FileService : IFileService
}
var fileContent = JsonSerializer.Serialize(content);
File.WriteAllText(Path.Combine(folderPath, fileName), fileContent, encoding);
File.WriteAllText(Path.Combine(folderPath, fileName), fileContent, _encoding);
}
public void Delete(string folderPath, string fileName)

View File

@@ -13,7 +13,6 @@ public interface IExtensionService
Task<IEnumerable<IExtensionWrapper>> GetInstalledExtensionsAsync(bool includeDisabledExtensions = false);
// Task<IEnumerable<string>> GetInstalledHomeWidgetPackageFamilyNamesAsync(bool includeDisabledExtensions = false);
Task<IEnumerable<IExtensionWrapper>> GetInstalledExtensionsAsync(Microsoft.Windows.CommandPalette.Extensions.ProviderType providerType, bool includeDisabledExtensions = false);
IExtensionWrapper? GetInstalledExtension(string extensionUniqueId);
@@ -32,5 +31,5 @@ public interface IExtensionService
///// </summary>
///// <param name="extension">The out of proc extension object</param>
///// <returns>True only if the extension was disabled. False otherwise.</returns>
//public Task<bool> DisableExtensionIfWindowsFeatureNotAvailable(IExtensionWrapper extension);
// public Task<bool> DisableExtensionIfWindowsFeatureNotAvailable(IExtensionWrapper extension);
}

View File

@@ -28,15 +28,14 @@ public class LocalSettingsService : ILocalSettingsService
private readonly string _applicationDataFolder;
private readonly string _localSettingsFile;
private Dictionary<string, object> _settings;
private bool _isInitialized;
private readonly bool _isMsix;
private Dictionary<string, object> _settings;
private bool _isInitialized;
public LocalSettingsService(IFileService fileService, IOptions<LocalSettingsOptions> options)
{
_isMsix = false; // RuntimeHelper.IsMSIX;
_isMsix = false; // RuntimeHelper.IsMSIX;
_fileService = fileService;
_options = options.Value;