Updated the Main form to include subtitles in the details pane. Minor tweaks to the serializer engine. Focus my shift from this to FNRenamer from here.
This commit is contained in:
+54
-17
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
@@ -21,7 +22,7 @@ namespace MKVTest
|
||||
InitializeComponent();
|
||||
inputFilesListView.ItemSelectionChanged += UpdateFilePropPrediction;
|
||||
inputFilesListView.MouseClick += ShowMenu;
|
||||
this.Resize += Form1_Resize;
|
||||
Resize += Form1_Resize;
|
||||
|
||||
var item = new ToolStripMenuItem
|
||||
{
|
||||
@@ -30,7 +31,7 @@ namespace MKVTest
|
||||
};
|
||||
menu.Items.Add(item);
|
||||
|
||||
var inputColumn = new ColumnHeader()
|
||||
var inputColumn = new ColumnHeader
|
||||
{
|
||||
Text = @"Files",
|
||||
Name = @"HeaderColumn",
|
||||
@@ -43,7 +44,7 @@ namespace MKVTest
|
||||
{
|
||||
if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
if (inputFilesListView.FocusedItem.Bounds.Contains(e.Location) == true)
|
||||
if (inputFilesListView.FocusedItem.Bounds.Contains(e.Location))
|
||||
{
|
||||
menu.Show(Cursor.Position);
|
||||
}
|
||||
@@ -57,7 +58,7 @@ namespace MKVTest
|
||||
flowLayoutPanel1.Controls.Clear();
|
||||
flowLayoutPanel1.Invalidate();
|
||||
|
||||
var titleLabel = new Label()
|
||||
var titleLabel = new Label
|
||||
{
|
||||
Parent = flowLayoutPanel1,
|
||||
Text = @"Current Title: " + file.SegementInformation?.Title,
|
||||
@@ -68,6 +69,7 @@ namespace MKVTest
|
||||
|
||||
var videoTrackNumber = 1;
|
||||
var audioTrackNumber = 1;
|
||||
var subtitleTrackNumber = 1;
|
||||
|
||||
foreach (var fileTrack in file.Tracks)
|
||||
{
|
||||
@@ -115,6 +117,28 @@ namespace MKVTest
|
||||
flowLayoutPanel1.Container.Add(languageLabel);
|
||||
}
|
||||
}
|
||||
|
||||
if (fileTrack.Type == MkvTrack.TrackType.Subtitle)
|
||||
{
|
||||
var nameLabel = new Label
|
||||
{
|
||||
AutoSize = true,
|
||||
Text = @"Track:s" + subtitleTrackNumber + @" Name: " + fileTrack.Name,
|
||||
Parent = flowLayoutPanel1
|
||||
};
|
||||
var languageLabel = new Label
|
||||
{
|
||||
AutoSize = true,
|
||||
Text = @"Track:s" + subtitleTrackNumber + @" Language: " + fileTrack.Language,
|
||||
Parent = flowLayoutPanel1
|
||||
};
|
||||
audioTrackNumber++;
|
||||
if (flowLayoutPanel1.Container != null)
|
||||
{
|
||||
flowLayoutPanel1.Container.Add(nameLabel);
|
||||
flowLayoutPanel1.Container.Add(languageLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +183,7 @@ namespace MKVTest
|
||||
var files = dir.GetFiles("*.mkv", SearchOption.TopDirectoryOnly);
|
||||
foreach (var file in files)
|
||||
{
|
||||
var node = new ListViewItem()
|
||||
var node = new ListViewItem
|
||||
{
|
||||
Tag = true, //Assume the file needs to be updated.
|
||||
Name = file.FullName,
|
||||
@@ -177,11 +201,9 @@ namespace MKVTest
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
var d = new FolderBrowserDialog();
|
||||
if (d.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
ClearForm();
|
||||
ListFiles(d.SelectedPath);
|
||||
}
|
||||
if (d.ShowDialog() != DialogResult.OK) return;
|
||||
ClearForm();
|
||||
ListFiles(d.SelectedPath);
|
||||
}
|
||||
|
||||
private void Form1_Resize(object sender, EventArgs e)
|
||||
@@ -200,13 +222,17 @@ namespace MKVTest
|
||||
var command = "/C mkvpropedit.exe --edit info --set \"title=" + GetEpisodeName(node.Text) +
|
||||
"\" --edit track:v1 --set \"name=" + GetEpisodeName(node.Text) +
|
||||
"\" --edit track:v1 --set \"language=eng\" --edit track:a1 --set \"name=English\" --edit track:a1 --set \"language=eng\" \"" + node.Name + "\" > temp.txt";
|
||||
var process = new System.Diagnostics.Process();
|
||||
var startInfo = new System.Diagnostics.ProcessStartInfo
|
||||
var process = new Process();
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal,
|
||||
WindowStyle = ProcessWindowStyle.Normal,
|
||||
FileName = "cmd.exe",
|
||||
Arguments = command
|
||||
};
|
||||
if (!CheckFiles())
|
||||
{
|
||||
MessageBox.Show(@"The two required files, mkvpropedit.exe and mkvinfo.exe are missing from this program's startup folder. These files are required to edit MKV files.", @"Missing Required Files");
|
||||
}
|
||||
process.StartInfo = startInfo;
|
||||
process.Start();
|
||||
while (!process.HasExited)
|
||||
@@ -229,11 +255,22 @@ namespace MKVTest
|
||||
flowLayoutPanel1.Invalidate();
|
||||
}
|
||||
|
||||
private void debugToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void openFolderFileMainMenu_Click(object sender, EventArgs e)
|
||||
{
|
||||
var s = new SerializeMkvInfo();
|
||||
var xml = s.SerializeFile("C:\\Users\\Crypto\\Documents\\Source Control\\mkvbatcheditor\\MKVTest\\info.txt");
|
||||
File.WriteAllLines("C:\\Users\\Crypto\\Desktop\\1234Testing.txt", xml.ToArray());
|
||||
var d = new FolderBrowserDialog();
|
||||
if (d.ShowDialog() != DialogResult.OK) return;
|
||||
ClearForm();
|
||||
ListFiles(d.SelectedPath);
|
||||
}
|
||||
|
||||
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
public static bool CheckFiles()
|
||||
{
|
||||
return File.Exists("mkvpropedit.exe") && File.Exists("mkvinfo.exe");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user