Update files

Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
2025-09-28 18:04:10 +07:00
parent ab3eef14f3
commit 020412e3a8
2 changed files with 5 additions and 17 deletions

View File

@@ -4,7 +4,6 @@ using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace EpisodeRenamer
@@ -43,7 +42,7 @@ namespace EpisodeRenamer
}
}
static async Task Main(string[] args)
static async Task Main()
{
// Создаем экземпляр слушателя
using (var hotkeyListener = new HotkeyListener())
@@ -57,8 +56,6 @@ namespace EpisodeRenamer
LoadConfiguration(true);
break;
case "ControlC":
Console.WriteLine("\nВыход из программы.");
Thread.Sleep(1500);
Environment.Exit(0);
break;
default:
@@ -97,12 +94,6 @@ namespace EpisodeRenamer
return;
}
//Console.CancelKeyPress += (sender, e) =>
//{
// Console.WriteLine("\nВыход из программы.");
// Environment.Exit(0);
//};
Console.WriteLine("Чтобы оставить текущую директорию нажмите 'Enter'");
Console.WriteLine("Чтобы перезагрузить конфигурацию нажмите 'Ctrl + Alt + R'");
Console.WriteLine("Чтобы выйти нажмите 'Ctrl + C'");
@@ -141,15 +132,14 @@ namespace EpisodeRenamer
{
extensions.Clear();
patterns.Clear();
GC.Collect();
Console.WriteLine("\nЗапрошена перезагрузка конфигурации.");
}
string configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.json");
if (!File.Exists(configPath))
{
throw new FileNotFoundException("Конфигурационный файл config.json не найден");
}
string json = File.ReadAllText(configPath);
Config config = JsonConvert.DeserializeObject<Config>(json);
@@ -180,9 +170,7 @@ namespace EpisodeRenamer
string extension = Path.GetExtension(fileName);
if (extensions.Contains(extension))
{
RenameFile(filePath, fileName, folder);
}
}
}