summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mkvtool-gui/MainWindow.axaml3
-rw-r--r--mkvtool-gui/MainWindow.axaml.cs32
-rw-r--r--mkvtool-gui/sdk.cs6
3 files changed, 34 insertions, 7 deletions
diff --git a/mkvtool-gui/MainWindow.axaml b/mkvtool-gui/MainWindow.axaml
index eaa8b6a..37ef779 100644
--- a/mkvtool-gui/MainWindow.axaml
+++ b/mkvtool-gui/MainWindow.axaml
@@ -178,6 +178,7 @@
<TextBox Name="ma5" />
</StackPanel>
</StackPanel>
+ <Controls:ToggleSwitch Content="Subset" IsChecked="True" Name="ma6" />
<Button Margin="10" Content="Go" Click="DoMakeBtn_OnClick" HorizontalAlignment="Center" />
</StackPanel>
</Controlz:GroupBox>
@@ -307,7 +308,7 @@
<Controls:BusyIndicator Name="busyBox" />
</Grid>
<Controlz:GroupBox Header="Log" Margin="10" DockPanel.Dock="Right">
- <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
+ <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<TextBox IsReadOnly="True" Name="logBox" Margin="10" />
</ScrollViewer>
</Controlz:GroupBox>
diff --git a/mkvtool-gui/MainWindow.axaml.cs b/mkvtool-gui/MainWindow.axaml.cs
index 4512bab..441cb26 100644
--- a/mkvtool-gui/MainWindow.axaml.cs
+++ b/mkvtool-gui/MainWindow.axaml.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
@@ -10,6 +11,7 @@ using Avalonia.ExtendedToolkit.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.Threading;
+using Microsoft.VisualBasic;
using ToggleSwitch = Avalonia.ExtendedToolkit.Controls.ToggleSwitch;
namespace mkvtool
@@ -304,6 +306,7 @@ namespace mkvtool
public static string Output { get; set; }
public static string slang { get; set; }
public static string stitle { get; set; }
+ public static bool subset { get; set; }
}
private async void MakeSelectBtns_OnClick(object? sender, RoutedEventArgs e)
@@ -355,10 +358,11 @@ namespace mkvtool
{
MakeArg.slang = this.FindControl<TextBox>("ma4").Text;
MakeArg.stitle = this.FindControl<TextBox>("ma5").Text;
+ MakeArg.subset = this.FindControl<ToggleSwitch>("ma6").IsChecked == true;
SetBusy(true);
new Thread(() =>
{
- if (mkvlib.MakeMKVs(MakeArg.Dir, MakeArg.Data, MakeArg.Output, MakeArg.slang, MakeArg.stitle, lcb))
+ if (mkvlib.MakeMKVs(MakeArg.Dir, MakeArg.Data, MakeArg.Output, MakeArg.slang, MakeArg.stitle, MakeArg.subset, lcb))
{
PrintResult("Make", "Make successfully.");
MakeArg.Dir = string.Empty;
@@ -373,6 +377,7 @@ namespace mkvtool
this.FindControl<TextBlock>("ma3").Text = string.Empty;
this.FindControl<TextBox>("ma4").Text = "chi";
this.FindControl<TextBox>("ma5").Text = string.Empty;
+ this.FindControl<ToggleSwitch>("ma6").IsChecked = true;
});
}
else
@@ -542,8 +547,29 @@ namespace mkvtool
SetBusy(true);
new Thread(() =>
{
- if (mkvlib.DumpMKVs(WorkflowArg.Dir, WorkflowArg.Data, true, lcb) &&
- mkvlib.MakeMKVs(WorkflowArg.Dir, WorkflowArg.Data, WorkflowArg.Dist, "", "", lcb))
+ string[] _files = Directory.GetFiles(WorkflowArg.Dir, "*.mkv");
+ List<string> files = new List<string>();
+ foreach (string item in _files)
+ {
+ if (item.StartsWith(WorkflowArg.Dist))
+ continue;
+ files.Add(item);
+ }
+ int ec = 0;
+ foreach (string item in files)
+ {
+ string p = item.Substring(WorkflowArg.Dir.Length);
+ string? d = Path.GetDirectoryName(p);
+ string? f = Path.GetFileNameWithoutExtension(p);
+ p = Path.Join(WorkflowArg.Data, d, f);
+ if (!mkvlib.DumpMKV(item, p, true, lcb))
+ {
+ ec++;
+ break;
+ }
+ }
+ if (ec == 0 &&
+ mkvlib.MakeMKVs(WorkflowArg.Dir, WorkflowArg.Data, WorkflowArg.Dist, "", "", true, lcb))
{
PrintResult("Workflow", "Workflow successfully.");
WorkflowArg.Dir = string.Empty;
diff --git a/mkvtool-gui/sdk.cs b/mkvtool-gui/sdk.cs
index 87ce7f7..7cc4d90 100644
--- a/mkvtool-gui/sdk.cs
+++ b/mkvtool-gui/sdk.cs
@@ -40,7 +40,7 @@ public static class mkvlib
static extern bool CreateMKVs(IntPtr vDir, IntPtr sDir, IntPtr fDir, IntPtr tDir, IntPtr oDir, IntPtr slang, IntPtr stitle, bool clean, logCallback lcb);
[DllImport(so)]
- static extern bool MakeMKVs(IntPtr dir, IntPtr data, IntPtr output, IntPtr slang, IntPtr stitle, logCallback lcb);
+ static extern bool MakeMKVs(IntPtr dir, IntPtr data, IntPtr output, IntPtr slang, IntPtr stitle, bool subset, logCallback lcb);
[DllImport(so)]
static extern bool CreateBlankOrBurnVideo(long t, IntPtr s, IntPtr enc, IntPtr ass, IntPtr fontdir, IntPtr output);
@@ -135,9 +135,9 @@ public static class mkvlib
return CreateMKVs(cs(vDir), cs(sDir), cs(fDir), cs(tDir), cs(oDir), cs(slang), cs(stitle), clean, _lcb(lcb));
}
- public static bool MakeMKVs(string dir, string data, string output, string slang, string stitle, Action<LogLevel, string> lcb)
+ public static bool MakeMKVs(string dir, string data, string output, string slang, string stitle, bool subset, Action<LogLevel, string> lcb)
{
- return MakeMKVs(cs(dir), cs(data), cs(output), cs(slang), cs(stitle), _lcb(lcb));
+ return MakeMKVs(cs(dir), cs(data), cs(output), cs(slang), cs(stitle), subset, _lcb(lcb));
}
public static bool CreateBlankOrBurnVideo(long t, string s, string enc, string ass, string fontdir, string output)