mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
@@ -225,6 +225,9 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.IO.Abstractions">
|
||||
<Version>12.2.5</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Windows.Interactivity.WPF">
|
||||
<Version>2.0.20525</Version>
|
||||
</PackageReference>
|
||||
|
||||
@@ -5,23 +5,24 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
|
||||
namespace ColorPicker.Helpers
|
||||
{
|
||||
public static class Logger
|
||||
{
|
||||
private static readonly string ApplicationLogPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ColorPicker");
|
||||
private static readonly IFileSystem _fileSystem = new FileSystem();
|
||||
private static readonly string ApplicationLogPath = _fileSystem.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ColorPicker");
|
||||
|
||||
static Logger()
|
||||
{
|
||||
if (!Directory.Exists(ApplicationLogPath))
|
||||
if (!_fileSystem.Directory.Exists(ApplicationLogPath))
|
||||
{
|
||||
Directory.CreateDirectory(ApplicationLogPath);
|
||||
_fileSystem.Directory.CreateDirectory(ApplicationLogPath);
|
||||
}
|
||||
|
||||
// Using InvariantCulture since this is used for a log file name
|
||||
var logFilePath = Path.Combine(ApplicationLogPath, "Log_" + DateTime.Now.ToString(@"yyyy-MM-dd", CultureInfo.InvariantCulture) + ".txt");
|
||||
var logFilePath = _fileSystem.Path.Combine(ApplicationLogPath, "Log_" + DateTime.Now.ToString(@"yyyy-MM-dd", CultureInfo.InvariantCulture) + ".txt");
|
||||
|
||||
Trace.Listeners.Add(new TextWriterTraceListener(logFilePath));
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using ColorPicker.Helpers;
|
||||
using Microsoft.Win32;
|
||||
|
||||
@@ -28,11 +28,13 @@ namespace ColorPicker.Mouse
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop object")]
|
||||
private const int SPIF_SENDCHANGE = 0x02;
|
||||
|
||||
private static readonly IFileSystem _fileSystem = new FileSystem();
|
||||
|
||||
public static void SetColorPickerCursor()
|
||||
{
|
||||
BackupOriginalCursors();
|
||||
|
||||
var colorPickerCursorPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ColorPickerCursorName);
|
||||
var colorPickerCursorPath = _fileSystem.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ColorPickerCursorName);
|
||||
ChangeCursor(colorPickerCursorPath, ArrowRegistryName);
|
||||
ChangeCursor(colorPickerCursorPath, IBeamRegistryName);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Threading;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
@@ -20,14 +21,14 @@ namespace ColorPicker.Settings
|
||||
private const int MaxNumberOfRetry = 5;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("CodeQuality", "IDE0052:Remove unread private members", Justification = "Actually, call back is LoadSettingsFromJson")]
|
||||
private readonly FileSystemWatcher _watcher;
|
||||
private readonly IFileSystemWatcher _watcher;
|
||||
|
||||
private readonly object _loadingSettingsLock = new object();
|
||||
|
||||
[ImportingConstructor]
|
||||
public UserSettings()
|
||||
{
|
||||
_settingsUtils = new SettingsUtils(new SystemIOProvider());
|
||||
_settingsUtils = new SettingsUtils();
|
||||
ChangeCursor = new SettingItem<bool>(true);
|
||||
ActivationShortcut = new SettingItem<string>(DefaultActivationShortcut);
|
||||
CopiedColorRepresentation = new SettingItem<ColorRepresentationType>(ColorRepresentationType.HEX);
|
||||
|
||||
Reference in New Issue
Block a user