[Deps]Upgrade System.IO.Abstractions (#35656)

* Upgrade System.IO.Abstractions to the latest stable release
This commit is contained in:
Davide Giacometti
2024-11-11 10:42:40 +01:00
committed by GitHub
parent 3d306f6177
commit 2ea9d56129
22 changed files with 70 additions and 53 deletions

View File

@@ -4,7 +4,6 @@
using System;
using System.IO;
using System.IO.Abstractions;
using System.Text.Json;
using System.Text.Json.Serialization;
@@ -23,15 +22,14 @@ namespace ManagedCommon
public static string LoadLanguage()
{
FileSystem fileSystem = new FileSystem();
var localAppDataDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
var file = localAppDataDir + SettingsFilePath + SettingsFile;
if (fileSystem.File.Exists(file))
if (File.Exists(file))
{
try
{
Stream inputStream = fileSystem.File.Open(file, FileMode.Open);
var inputStream = File.Open(file, FileMode.Open);
StreamReader reader = new StreamReader(inputStream);
string data = reader.ReadToEnd();
inputStream.Close();

View File

@@ -5,7 +5,7 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO.Abstractions;
using System.IO;
using System.Reflection;
using PowerToys.Interop;
@@ -14,7 +14,6 @@ namespace ManagedCommon
{
public static class Logger
{
private static readonly IFileSystem _fileSystem = new FileSystem();
private static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
private static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location).ProductVersion;
@@ -41,12 +40,12 @@ namespace ManagedCommon
applicationLogPath = Constants.AppDataPath() + applicationLogPath + "\\" + Version;
}
if (!_fileSystem.Directory.Exists(applicationLogPath))
if (!Directory.Exists(applicationLogPath))
{
_fileSystem.Directory.CreateDirectory(applicationLogPath);
Directory.CreateDirectory(applicationLogPath);
}
var logFilePath = _fileSystem.Path.Combine(applicationLogPath, "Log_" + DateTime.Now.ToString(@"yyyy-MM-dd", CultureInfo.InvariantCulture) + ".txt");
var logFilePath = Path.Combine(applicationLogPath, "Log_" + DateTime.Now.ToString(@"yyyy-MM-dd", CultureInfo.InvariantCulture) + ".txt");
Trace.Listeners.Add(new TextWriterTraceListener(logFilePath));

View File

@@ -15,7 +15,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.IO.Abstractions" />
<PackageReference Include="System.Management" />
</ItemGroup>