mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-04 11:59:07 +08:00
Update minor details
This commit is contained in:
parent
c0757b74e8
commit
5e897a546a
@ -17,7 +17,7 @@ namespace Espresso.Shell
|
|||||||
{
|
{
|
||||||
private static Mutex mutex = null;
|
private static Mutex mutex = null;
|
||||||
private const string appName = "Espresso";
|
private const string appName = "Espresso";
|
||||||
|
private static FileSystemWatcher watcher = null;
|
||||||
public static Mutex Mutex { get => mutex; set => mutex = value; }
|
public static Mutex Mutex { get => mutex; set => mutex = value; }
|
||||||
|
|
||||||
static int Main(string[] args)
|
static int Main(string[] args)
|
||||||
@ -104,11 +104,11 @@ namespace Espresso.Shell
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var watcher = new FileSystemWatcher
|
watcher = new FileSystemWatcher
|
||||||
{
|
{
|
||||||
Path = Path.GetDirectoryName(config),
|
Path = Path.GetDirectoryName(config),
|
||||||
EnableRaisingEvents = true,
|
EnableRaisingEvents = true,
|
||||||
NotifyFilter = NotifyFilters.LastWrite,
|
NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size,
|
||||||
Filter = Path.GetFileName(config)
|
Filter = Path.GetFileName(config)
|
||||||
};
|
};
|
||||||
watcher.Changed += new FileSystemEventHandler(HandleEspressoConfigChange);
|
watcher.Changed += new FileSystemEventHandler(HandleEspressoConfigChange);
|
||||||
@ -119,7 +119,8 @@ namespace Espresso.Shell
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
ForceExit($"There was a problem with the configuration file. Make sure it exists.\n{ex.Message}", 1);
|
Console.WriteLine($"There was a problem with the configuration file. Make sure it exists.\n{ex.Message}");
|
||||||
|
//ForceExit($"There was a problem with the configuration file. Make sure it exists.\n{ex.Message}", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -162,17 +163,17 @@ namespace Espresso.Shell
|
|||||||
|
|
||||||
private static void HandleEspressoConfigChange(object sender, FileSystemEventArgs e)
|
private static void HandleEspressoConfigChange(object sender, FileSystemEventArgs e)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Detected a file change. Reacting...");
|
||||||
ProcessSettings(e.FullPath);
|
ProcessSettings(e.FullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessSettings(string fullPath)
|
private static void ProcessSettings(string fullPath)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Detected a file change. Reacting...");
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
EspressoSettingsModel settings = null;
|
EspressoSettingsModel settings = null;
|
||||||
|
|
||||||
var fileStream = SettingsHelper.GetSettingsFile(fullPath, 10);
|
var fileStream = SettingsHelper.GetSettingsFile(fullPath, 3);
|
||||||
if (fileStream != null)
|
if (fileStream != null)
|
||||||
{
|
{
|
||||||
using (fileStream)
|
using (fileStream)
|
||||||
|
Loading…
Reference in New Issue
Block a user