mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
Update project configuration
This commit is contained in:
@@ -844,8 +844,8 @@ Global
|
||||
{5E7360A8-D048-4ED3-8F09-0BFD64C5529A}.Release|x64.Build.0 = Release|x64
|
||||
{3B77A64A-8005-4D43-B31A-F692E213BAE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3B77A64A-8005-4D43-B31A-F692E213BAE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3B77A64A-8005-4D43-B31A-F692E213BAE4}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{3B77A64A-8005-4D43-B31A-F692E213BAE4}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{3B77A64A-8005-4D43-B31A-F692E213BAE4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3B77A64A-8005-4D43-B31A-F692E213BAE4}.Debug|x64.Build.0 = Debug|x64
|
||||
{3B77A64A-8005-4D43-B31A-F692E213BAE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3B77A64A-8005-4D43-B31A-F692E213BAE4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3B77A64A-8005-4D43-B31A-F692E213BAE4}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
|
||||
@@ -162,10 +162,20 @@ namespace Espresso.Shell.Core
|
||||
{
|
||||
try
|
||||
{
|
||||
#pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type.
|
||||
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(BUILD_REGISTRY_LOCATION);
|
||||
#pragma warning restore CS8600 // Converting null literal or possible null value to non-nullable type.
|
||||
|
||||
var versionString = $"{registryKey.GetValue("ProductName")} {registryKey.GetValue("DisplayVersion")} {registryKey.GetValue("BuildLabEx")}";
|
||||
return versionString;
|
||||
if (registryKey != null)
|
||||
{
|
||||
var versionString = $"{registryKey.GetValue("ProductName")} {registryKey.GetValue("DisplayVersion")} {registryKey.GetValue("BuildLabEx")}";
|
||||
return versionString;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.Debug("Registry key acquisition for OS failed.");
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Espresso.Shell.Core
|
||||
const int ERROR_SHARING_VIOLATION = 32;
|
||||
const int ERROR_LOCK_VIOLATION = 33;
|
||||
|
||||
public static FileStream GetSettingsFile(string path, int retries)
|
||||
public static FileStream? GetSettingsFile(string path, int retries)
|
||||
{
|
||||
for (int i = 0; i < retries; i++)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,35 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\modules\Espresso</OutputPath>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutputPath>..\..\..\..\$(Platform)\$(Configuration)\modules\Espresso\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>false</Optimize>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutputPath>..\..\..\..\$(Platform)\$(Configuration)\modules\Espresso\</OutputPath>
|
||||
<DefineConstants>TRACE;RELEASE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -9,23 +9,23 @@ namespace Espresso.Shell.Models
|
||||
public class EspressoSettingsModel
|
||||
{
|
||||
[JsonProperty("properties")]
|
||||
public Properties Properties { get; set; }
|
||||
public Properties? Properties { get; set; }
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
[JsonProperty("version")]
|
||||
public string Version { get; set; }
|
||||
public string? Version { get; set; }
|
||||
}
|
||||
|
||||
public class Properties
|
||||
{
|
||||
[JsonProperty("espresso_keep_display_on")]
|
||||
public KeepDisplayOn KeepDisplayOn { get; set; }
|
||||
public KeepDisplayOn? KeepDisplayOn { get; set; }
|
||||
[JsonProperty("espresso_mode")]
|
||||
public int Mode { get; set; }
|
||||
public int? Mode { get; set; }
|
||||
[JsonProperty("espresso_hours")]
|
||||
public Hours Hours { get; set; }
|
||||
public Hours? Hours { get; set; }
|
||||
[JsonProperty("espresso_minutes")]
|
||||
public Minutes Minutes { get; set; }
|
||||
public Minutes? Minutes { get; set; }
|
||||
}
|
||||
|
||||
public class KeepDisplayOn
|
||||
|
||||
@@ -17,16 +17,21 @@ using System.Reactive.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
|
||||
#pragma warning disable CS8602 // Dereference of a possibly null reference.
|
||||
#pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type.
|
||||
#pragma warning disable CS8603 // Possible null reference return.
|
||||
|
||||
namespace Espresso.Shell
|
||||
{
|
||||
class Program
|
||||
{
|
||||
private static Mutex mutex = null;
|
||||
private static Mutex? mutex = null;
|
||||
private const string appName = "Espresso";
|
||||
private static FileSystemWatcher watcher = null;
|
||||
private static FileSystemWatcher? watcher = null;
|
||||
|
||||
public static Mutex Mutex { get => mutex; set => mutex = value; }
|
||||
|
||||
private static Logger log;
|
||||
private static Logger? log;
|
||||
|
||||
static int Main(string[] args)
|
||||
{
|
||||
@@ -193,6 +198,7 @@ namespace Espresso.Shell
|
||||
using (fileStream)
|
||||
{
|
||||
using StreamReader reader = new StreamReader(fileStream);
|
||||
|
||||
settings = JsonConvert.DeserializeObject<EspressoSettingsModel>(reader.ReadToEnd());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user