diff --git a/ConvertSRTto3DASS.Cli/Cli.cs b/ConvertSRTto3DASS.Cli/Cli.cs
index 6008c13..ebbf5c6 100644
--- a/ConvertSRTto3DASS.Cli/Cli.cs
+++ b/ConvertSRTto3DASS.Cli/Cli.cs
@@ -4,19 +4,19 @@ namespace ConvertSRTto3DASS;
internal static class Cli
{
- public static void Run(string[] args)
+ public static bool Run(string[] args)
{
if (args.Length == 0 || args[0] is "--help" or "-h" or "/?")
{
PrintUsage();
- return;
+ return false;
}
var inputPath = args[0];
if (!File.Exists(inputPath))
{
Console.Error.WriteLine($"Input file not found: {inputPath}");
- return;
+ return true;
}
// Parse options
@@ -80,7 +80,7 @@ internal static class Cli
break;
default:
Console.Error.WriteLine($"Unknown argument: {args[i]}");
- return;
+ return true;
}
i++;
}
@@ -106,11 +106,13 @@ internal static class Cli
var result = SrtConverter.Convert(options);
Console.WriteLine($"Parsed: {result.SubtitleCount} subtitle blocks");
Console.WriteLine("Conversion complete.");
+ return false;
}
catch (Exception ex)
{
Console.Error.WriteLine($"ERROR: {ex.Message}");
Console.Error.WriteLine(ex.ToString());
+ return true;
}
string GetNextArg(int index) => index + 1 < args.Length ? args[index + 1] : throw new ArgumentException($"Missing value for {args[index]}");
diff --git a/ConvertSRTto3DASS.Cli/ConvertSRTto3DASS.Cli.csproj b/ConvertSRTto3DASS.Cli/ConvertSRTto3DASS.Cli.csproj
index 4d85371..608d9a8 100644
--- a/ConvertSRTto3DASS.Cli/ConvertSRTto3DASS.Cli.csproj
+++ b/ConvertSRTto3DASS.Cli/ConvertSRTto3DASS.Cli.csproj
@@ -13,6 +13,9 @@
true
+ true
+ false
+ true
diff --git a/ConvertSRTto3DASS.Cli/Program.cs b/ConvertSRTto3DASS.Cli/Program.cs
index 0cd8ad3..adc7834 100644
--- a/ConvertSRTto3DASS.Cli/Program.cs
+++ b/ConvertSRTto3DASS.Cli/Program.cs
@@ -2,5 +2,10 @@ namespace ConvertSRTto3DASS;
internal static class Program
{
- static void Main(string[] args) => Cli.Run(args);
+ static void Main(string[] args)
+ {
+ var hadError = Cli.Run(args);
+ if (hadError)
+ Console.ReadLine();
+ }
}
diff --git a/ConvertSRTto3DASS.Core/ConvertSRTto3DASS.Core.csproj b/ConvertSRTto3DASS.Core/ConvertSRTto3DASS.Core.csproj
index 2aed899..0cfbf6f 100644
--- a/ConvertSRTto3DASS.Core/ConvertSRTto3DASS.Core.csproj
+++ b/ConvertSRTto3DASS.Core/ConvertSRTto3DASS.Core.csproj
@@ -9,6 +9,10 @@
ConvertSRTto3DASS
+
+
+
+
true
diff --git a/ConvertSRTto3DASS.Core/SrtConverter.cs b/ConvertSRTto3DASS.Core/SrtConverter.cs
index 21898de..efb8227 100644
--- a/ConvertSRTto3DASS.Core/SrtConverter.cs
+++ b/ConvertSRTto3DASS.Core/SrtConverter.cs
@@ -16,6 +16,9 @@ public static class SrtConverter
public static ConversionResult Convert(ConversionOptions options)
{
+ // Register legacy codepage support (needed for CP1252, etc.)
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+
var srtText = ReadSrt(options.InputPath);
var subtitles = ParseSrt(srtText);
var header = CreateHeader(options);
diff --git a/ConvertSRTto3DASS.Gui/Form1.Designer.cs b/ConvertSRTto3DASS.Gui/Form1.Designer.cs
index 4b36059..3cc2de9 100644
--- a/ConvertSRTto3DASS.Gui/Form1.Designer.cs
+++ b/ConvertSRTto3DASS.Gui/Form1.Designer.cs
@@ -71,11 +71,13 @@ partial class Form1
Size = new Size(1040, 80)
};
label_InputFile = new Label { Text = "Input SRT:", Font = segoe, Location = new Point(15, 25), AutoSize = true };
- textBox_InputFile = new TextBox { Location = new Point(100, 22), Size = new Size(780, 23), ReadOnly = true };
+ textBox_InputFile = new TextBox { Location = new Point(100, 22), Size = new Size(780, 23) };
button_BrowseInput = new Button { Text = "Browse...", Location = new Point(890, 20), Size = new Size(90, 25), Font = segoe, FlatStyle = FlatStyle.Flat };
+ button_BrowseInput.Click += button_BrowseInput_Click;
label_OutputFile = new Label { Text = "Output ASS:", Font = segoe, Location = new Point(15, 55), AutoSize = true };
- textBox_OutputFile = new TextBox { Location = new Point(100, 52), Size = new Size(780, 23), ReadOnly = true };
+ textBox_OutputFile = new TextBox { Location = new Point(100, 52), Size = new Size(780, 23) };
button_BrowseOutput = new Button { Text = "Browse...", Location = new Point(890, 50), Size = new Size(90, 25), Font = segoe, FlatStyle = FlatStyle.Flat };
+ button_BrowseOutput.Click += button_BrowseOutput_Click;
groupBox_File.Controls.AddRange([label_InputFile, textBox_InputFile, button_BrowseInput, label_OutputFile, textBox_OutputFile, button_BrowseOutput]);
// ---- Mode section ----