mirror of
https://github.com/Stone-Red-Code/HyperbolicDownloader.git
synced 2026-09-08 15:56:23 +02:00
Upgrade project to .NET 8
This commit is contained in:
@@ -3,15 +3,8 @@ using HyperbolicDownloaderApi.Managment;
|
||||
|
||||
namespace HyperbolicDownloaderApi.Commands;
|
||||
|
||||
public class DirectoryCommands
|
||||
public class DirectoryCommands(DirectoryWatcher directoryWatcher)
|
||||
{
|
||||
private readonly DirectoryWatcher directoryWatcher;
|
||||
|
||||
public DirectoryCommands(DirectoryWatcher directoryWatcher)
|
||||
{
|
||||
this.directoryWatcher = directoryWatcher;
|
||||
}
|
||||
|
||||
public void AddDirectory(string directoryPath)
|
||||
{
|
||||
if (directoryWatcher.TryAdd(directoryPath, out string? message))
|
||||
|
||||
@@ -13,17 +13,8 @@ using System.Text.Json;
|
||||
|
||||
namespace HyperbolicDownloaderApi.Commands;
|
||||
|
||||
public class DownloadCommands
|
||||
public class DownloadCommands(HostsManager hostsManager, FilesManager filesManager)
|
||||
{
|
||||
private readonly HostsManager hostsManager;
|
||||
private readonly FilesManager filesManager;
|
||||
|
||||
public DownloadCommands(HostsManager hostsManager, FilesManager filesManager)
|
||||
{
|
||||
this.hostsManager = hostsManager;
|
||||
this.filesManager = filesManager;
|
||||
}
|
||||
|
||||
public void GetFileFrom(string path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
|
||||
@@ -9,17 +9,9 @@ using System.Text.Json;
|
||||
|
||||
namespace HyperbolicDownloaderApi.Commands;
|
||||
|
||||
public class FileCommands
|
||||
public class FileCommands(HostsManager hostsManager, FilesManager filesManager)
|
||||
{
|
||||
private readonly HostsManager hostsManager;
|
||||
|
||||
private readonly FilesManager filesManager;
|
||||
|
||||
public FileCommands(HostsManager hostsManager, FilesManager filesManager)
|
||||
{
|
||||
this.hostsManager = hostsManager;
|
||||
this.filesManager = filesManager;
|
||||
}
|
||||
private readonly JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true };
|
||||
|
||||
public void AddFile(string path)
|
||||
{
|
||||
@@ -242,8 +234,7 @@ public class FileCommands
|
||||
|
||||
publicHyperFileInfo.Hosts.Add(localHost);
|
||||
|
||||
JsonSerializerOptions options = new JsonSerializerOptions { WriteIndented = true };
|
||||
string json = JsonSerializer.Serialize(publicHyperFileInfo, options);
|
||||
string json = JsonSerializer.Serialize(publicHyperFileInfo, jsonSerializerOptions);
|
||||
|
||||
File.WriteAllText(filePath, json);
|
||||
|
||||
@@ -334,8 +325,7 @@ public class FileCommands
|
||||
|
||||
publicHyperFileInfo.Hosts.Add(localHost);
|
||||
|
||||
JsonSerializerOptions options = new JsonSerializerOptions { WriteIndented = true };
|
||||
string json = JsonSerializer.Serialize(publicHyperFileInfo, options);
|
||||
string json = JsonSerializer.Serialize(publicHyperFileInfo, jsonSerializerOptions);
|
||||
|
||||
File.WriteAllText(filePath, json);
|
||||
|
||||
|
||||
@@ -8,15 +8,8 @@ using System.Net.Sockets;
|
||||
|
||||
namespace HyperbolicDownloaderApi.Commands;
|
||||
|
||||
public class HostCommands
|
||||
public class HostCommands(HostsManager hostsManager)
|
||||
{
|
||||
private readonly HostsManager hostsManager;
|
||||
|
||||
public HostCommands(HostsManager hostsManager)
|
||||
{
|
||||
this.hostsManager = hostsManager;
|
||||
}
|
||||
|
||||
public void Discover(string _)
|
||||
{
|
||||
ApiManager.SendNotificationMessageNewLine("Running local discovery routine...", NotificationMessageType.Info);
|
||||
|
||||
Reference in New Issue
Block a user