From 4f6b728de2bba58fc70ad41e93bd3bd4541e0033 Mon Sep 17 00:00:00 2001
From: ac79b0c6 <105047743+ac79b0c6@users.noreply.github.com>
Date: Sat, 31 Dec 2022 13:45:46 +0800
Subject: update gui
---
mkvtool-gui/MainWindow.axaml | 3 ++-
mkvtool-gui/MainWindow.axaml.cs | 32 +++++++++++++++++++++++++++++---
mkvtool-gui/sdk.cs | 6 +++---
3 files changed, 34 insertions(+), 7 deletions(-)
(limited to 'mkvtool-gui')
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 @@
+
@@ -307,7 +308,7 @@
-
+
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("ma4").Text;
MakeArg.stitle = this.FindControl("ma5").Text;
+ MakeArg.subset = this.FindControl("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("ma3").Text = string.Empty;
this.FindControl("ma4").Text = "chi";
this.FindControl("ma5").Text = string.Empty;
+ this.FindControl("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 files = new List();
+ 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 lcb)
+ public static bool MakeMKVs(string dir, string data, string output, string slang, string stitle, bool subset, Action 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)
--
cgit v1.2.1