This commit is contained in:
Konstantin Safonov 2023-01-15 11:45:44 +05:00
parent e49c0b9977
commit 000000001d
No known key found for this signature in database
GPG Key ID: 32B8B67B8ED6D629
13 changed files with 272 additions and 286 deletions

38
src/Directory.Build.props Normal file
View File

@ -0,0 +1,38 @@
<Project>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsPackable>true</IsPackable>
<LangVersion>latest</LangVersion>
<NoWarn>SA1633;SA1623;SA1600;SA1601;CS1591;SA1300</NoWarn>
<Nullable>enable</Nullable>
<PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PublishDocumentationFile>true</PublishDocumentationFile>
<PublishDocumentationFiles>true</PublishDocumentationFiles>
<PublishReferencesDocumentationFiles>true</PublishReferencesDocumentationFiles>
<StyleCopTreatErrorsAsWarnings>True</StyleCopTreatErrorsAsWarnings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.Analyzers" Version="4.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.CodeAnalysis.Analyzers" Version="4.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.Formatting.Analyzers" Version="4.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>

View File

@ -1,61 +0,0 @@
namespace ConverterGui;
using System;
using System.Diagnostics;
using System.Reflection;
internal record Command(string InputFile, string OutputFile, string OutputFileClean, bool Clean, bool SaveLog,string Bitness)
{
private string ExecutablePath =>
Path.Combine(
Path.GetDirectoryName(System.AppContext.BaseDirectory!)!,
@"Tools\"+ Bitness + @"\retime_phoneme.exe"
);
public string GetBatchLine() => string.Join(" ", new[] { $"\"{ExecutablePath}\"" }.Concat(GetArguments().Select(arg => $"\"{arg}\"")));
public Process GetProcess()
{
try
{
var proc = new Process()
{
StartInfo = new ProcessStartInfo
{
FileName = ExecutablePath
},
EnableRaisingEvents = true,
};
foreach (var item in this.GetArguments())
{
proc.StartInfo.ArgumentList.Add(item);
}
return proc;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), @"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Restart();
return null!;
}
}
private IEnumerable<string> GetArguments()
{
yield return "-s";
yield return InputFile;
yield return "-d";
yield return OutputFile;
if (Clean)
{
yield return "-oc";
yield return OutputFileClean;
}
if (SaveLog)
{
yield return "-l";
}
}
}

View File

@ -0,0 +1,3 @@
namespace kru.gui.Core;
internal record ApplicationInfo(string Version, string Name, string Copytrigh);

View File

@ -0,0 +1,16 @@
namespace kru.gui.Core;
using System.Reflection;
internal static class ApplicationInfoProvider
{
public static ApplicationInfo GetInfo()
{
var assembly = Assembly.GetEntryAssembly()!;
var version = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion;
var name = assembly.GetCustomAttribute<AssemblyProductAttribute>()!.Product;
var copyright = assembly.GetCustomAttribute<AssemblyCopyrightAttribute>()!.Copyright;
return new ApplicationInfo(version, name, copyright);
}
}

View File

@ -0,0 +1,7 @@
namespace kru.gui.Core;
using System;
internal static class BitnessProvider
{
public static string BitnessName => Environment.Is64BitProcess ? "x64" : "x86";
}

View File

@ -0,0 +1,51 @@
namespace kru.gui.Core;
using System;
using System.Diagnostics;
internal record Command(string InputFile, string OutputDirectory, string? CleanDirectory, bool SaveLog)
{
private string ExecutablePath =>
Path.Combine(
Path.GetDirectoryName(AppContext.BaseDirectory)!,
$@"Tools\{BitnessProvider.BitnessName}\retime_phoneme.exe");
public string GetBatchLine() => string.Join(" ", new[] { $"\"{this.ExecutablePath}\"" }.Concat(this.GetArguments().Select(arg => $"\"{arg}\"")));
public Process GetProcess()
{
var proc = new Process()
{
StartInfo = new ProcessStartInfo
{
FileName = this.ExecutablePath,
},
EnableRaisingEvents = true,
};
foreach (var item in this.GetArguments())
{
proc.StartInfo.ArgumentList.Add(item);
}
return proc;
}
private IEnumerable<string> GetArguments()
{
var filename = Path.GetFileName(this.InputFile);
yield return "-s";
yield return this.InputFile;
yield return "-d";
yield return Path.Combine(this.OutputDirectory, filename);
if (this.CleanDirectory is not null)
{
yield return "-oc";
yield return Path.Combine(this.CleanDirectory, filename);
}
if (this.SaveLog)
{
yield return "-l";
}
}
}

View File

@ -6,11 +6,11 @@ internal static class Program
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
private static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new frmMain());
Application.Run(new FrmMain());
}
}

View File

@ -1,6 +1,6 @@
namespace kru.gui
{
partial class frmAbout
partial class FrmAbout
{
/// <summary>
/// Required designer variable.
@ -28,7 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmAbout));
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmAbout));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();

View File

@ -1,118 +1,56 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
namespace kru.gui;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace kru.gui
using kru.gui.Core;
public partial class FrmAbout : Form
{
public partial class frmAbout : Form
public FrmAbout()
{
public frmAbout()
this.InitializeComponent();
}
private static void OpenUrl(string url)
{
var uri = new Uri(url);
if (uri.Scheme is not "http" and not "https")
{
InitializeComponent();
}
public string archbitness = "x86";
public void bitness()
{
if (Environment.Is64BitProcess == true && Environment.Is64BitOperatingSystem == true)
{
archbitness = "x64";
}
else
{
archbitness = "x86";
}
}
private void frmAbout_Load(object sender, EventArgs e)
{
bitness();
var appVer = Assembly.GetEntryAssembly()!.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion;
var appName = Assembly.GetEntryAssembly()!.GetCustomAttribute<AssemblyProductAttribute>()!.Product;
var appCopy = Assembly.GetEntryAssembly()!.GetCustomAttribute<AssemblyCopyrightAttribute>()!.Copyright;
this.Text = $@"{appName} {appVer} ({archbitness})";
labelappName.Text = $@"{appName} ({archbitness})";
labelappVer.Text = appVer;
labelCopy.Text = $@"Copyright © {appCopy}";
throw new ArgumentException("Invalid URL", nameof(url));
}
private void linkLabelSource_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
try
{
Process myProcess = new Process();
try
{
// true is the default, but it is important not to set it to false
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.FileName = "https://forum.csmania.ru/viewtopic.php?t=43274";
myProcess.Start();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
using var myProcess = new Process();
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.FileName = uri.ToString();
myProcess.Start();
}
private void linkLabelwowks_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
catch (Exception ex)
{
Process myProcess = new Process();
try
{
// true is the default, but it is important not to set it to false
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.FileName = "https://forum.csmania.ru/memberlist.php?mode=viewprofile&u=59383";
myProcess.Start();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
private void buttonOK_Click(object sender, EventArgs e)
{
this.Close();
}
private void linkLabelGitHub_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process myProcess = new Process();
try
{
// true is the default, but it is important not to set it to false
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.FileName = "https://github.com/AntinomyCollective/Retime-Phoneme-Util-GUI";
myProcess.Start();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
private void linkLabelFreepik_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process myProcess = new Process();
try
{
// true is the default, but it is important not to set it to false
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.FileName = "https://www.freepik.com/";
myProcess.Start();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.WriteLine(ex.Message);
}
}
private void frmAbout_Load(object sender, EventArgs e)
{
var (version, name, copyright) = ApplicationInfoProvider.GetInfo();
this.Text = $"{name} {version} ({BitnessProvider.BitnessName})";
this.labelappName.Text = $"{name} ({BitnessProvider.BitnessName})";
this.labelappVer.Text = version;
this.labelCopy.Text = $"Copyright © {copyright}";
}
private void linkLabelSource_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) => OpenUrl("https://forum.csmania.ru/viewtopic.php?t=43274");
private void linkLabelwowks_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) => OpenUrl("https://forum.csmania.ru/memberlist.php?mode=viewprofile&u=59383");
private void buttonOK_Click(object sender, EventArgs e) => this.Close();
private void linkLabelGitHub_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) => OpenUrl("https://github.com/AntinomyCollective/Retime-Phoneme-Util-GUI");
private void linkLabelFreepik_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) => OpenUrl("https://www.freepik.com/");
}

View File

@ -1,6 +1,6 @@
namespace ConverterGui;
partial class frmMain
partial class FrmMain
{
/// <summary>
/// Required designer variable.
@ -28,7 +28,7 @@ partial class frmMain
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
this.txtInput = new System.Windows.Forms.TextBox();
this.txtOutput = new System.Windows.Forms.TextBox();
this.btnBrowseInput = new System.Windows.Forms.Button();
@ -55,10 +55,9 @@ partial class frmMain
//
this.txtInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtInput.Location = new System.Drawing.Point(5, 21);
this.txtInput.Margin = new System.Windows.Forms.Padding(2);
this.txtInput.Location = new System.Drawing.Point(7, 35);
this.txtInput.Name = "txtInput";
this.txtInput.Size = new System.Drawing.Size(292, 23);
this.txtInput.Size = new System.Drawing.Size(415, 31);
this.txtInput.TabIndex = 1;
this.txtInput.TextChanged += new System.EventHandler(this.TxtInputTextChanged);
//
@ -66,20 +65,18 @@ partial class frmMain
//
this.txtOutput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtOutput.Location = new System.Drawing.Point(5, 21);
this.txtOutput.Margin = new System.Windows.Forms.Padding(2);
this.txtOutput.Location = new System.Drawing.Point(7, 35);
this.txtOutput.Name = "txtOutput";
this.txtOutput.Size = new System.Drawing.Size(292, 23);
this.txtOutput.Size = new System.Drawing.Size(415, 31);
this.txtOutput.TabIndex = 3;
this.txtOutput.TextChanged += new System.EventHandler(this.TxtOutputTextChanged);
//
// btnBrowseInput
//
this.btnBrowseInput.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBrowseInput.Location = new System.Drawing.Point(301, 21);
this.btnBrowseInput.Margin = new System.Windows.Forms.Padding(2);
this.btnBrowseInput.Location = new System.Drawing.Point(430, 35);
this.btnBrowseInput.Name = "btnBrowseInput";
this.btnBrowseInput.Size = new System.Drawing.Size(75, 23);
this.btnBrowseInput.Size = new System.Drawing.Size(107, 31);
this.btnBrowseInput.TabIndex = 4;
this.btnBrowseInput.Text = "Browse";
this.btnBrowseInput.UseVisualStyleBackColor = true;
@ -88,10 +85,9 @@ partial class frmMain
// btnBrowseOutput
//
this.btnBrowseOutput.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBrowseOutput.Location = new System.Drawing.Point(301, 21);
this.btnBrowseOutput.Margin = new System.Windows.Forms.Padding(2);
this.btnBrowseOutput.Location = new System.Drawing.Point(430, 35);
this.btnBrowseOutput.Name = "btnBrowseOutput";
this.btnBrowseOutput.Size = new System.Drawing.Size(75, 23);
this.btnBrowseOutput.Size = new System.Drawing.Size(107, 31);
this.btnBrowseOutput.TabIndex = 5;
this.btnBrowseOutput.Text = "Browse";
this.btnBrowseOutput.UseVisualStyleBackColor = true;
@ -101,10 +97,9 @@ partial class frmMain
//
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSave.Enabled = false;
this.btnSave.Location = new System.Drawing.Point(239, 233);
this.btnSave.Margin = new System.Windows.Forms.Padding(2);
this.btnSave.Location = new System.Drawing.Point(341, 388);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 23);
this.btnSave.Size = new System.Drawing.Size(107, 38);
this.btnSave.TabIndex = 6;
this.btnSave.Text = "Save batch";
this.btnSave.UseVisualStyleBackColor = true;
@ -114,10 +109,9 @@ partial class frmMain
//
this.btnStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnStart.Enabled = false;
this.btnStart.Location = new System.Drawing.Point(318, 233);
this.btnStart.Margin = new System.Windows.Forms.Padding(2);
this.btnStart.Location = new System.Drawing.Point(454, 388);
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(75, 23);
this.btnStart.Size = new System.Drawing.Size(107, 38);
this.btnStart.TabIndex = 7;
this.btnStart.Text = "Start";
this.btnStart.UseVisualStyleBackColor = true;
@ -126,7 +120,6 @@ partial class frmMain
// sfdOutput
//
this.sfdOutput.Filter = "\"Batch File|*.bat|All files|*.*\"";
this.sfdOutput.FileOk += new System.ComponentModel.CancelEventHandler(this.sfdOutput_FileOk);
//
// chkSaveLogs
//
@ -134,10 +127,9 @@ partial class frmMain
this.chkSaveLogs.AutoSize = true;
this.chkSaveLogs.Checked = true;
this.chkSaveLogs.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkSaveLogs.Location = new System.Drawing.Point(92, 236);
this.chkSaveLogs.Margin = new System.Windows.Forms.Padding(2);
this.chkSaveLogs.Location = new System.Drawing.Point(131, 396);
this.chkSaveLogs.Name = "chkSaveLogs";
this.chkSaveLogs.Size = new System.Drawing.Size(75, 19);
this.chkSaveLogs.Size = new System.Drawing.Size(114, 29);
this.chkSaveLogs.TabIndex = 9;
this.chkSaveLogs.Text = "Save logs";
this.chkSaveLogs.UseVisualStyleBackColor = true;
@ -148,9 +140,11 @@ partial class frmMain
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxInput.Controls.Add(this.txtInput);
this.groupBoxInput.Controls.Add(this.btnBrowseInput);
this.groupBoxInput.Location = new System.Drawing.Point(12, 12);
this.groupBoxInput.Location = new System.Drawing.Point(17, 20);
this.groupBoxInput.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBoxInput.Name = "groupBoxInput";
this.groupBoxInput.Size = new System.Drawing.Size(381, 63);
this.groupBoxInput.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBoxInput.Size = new System.Drawing.Size(544, 105);
this.groupBoxInput.TabIndex = 10;
this.groupBoxInput.TabStop = false;
this.groupBoxInput.Text = "Input folder:";
@ -161,9 +155,11 @@ partial class frmMain
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxOutput.Controls.Add(this.txtOutput);
this.groupBoxOutput.Controls.Add(this.btnBrowseOutput);
this.groupBoxOutput.Location = new System.Drawing.Point(12, 81);
this.groupBoxOutput.Location = new System.Drawing.Point(17, 135);
this.groupBoxOutput.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBoxOutput.Name = "groupBoxOutput";
this.groupBoxOutput.Size = new System.Drawing.Size(381, 63);
this.groupBoxOutput.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBoxOutput.Size = new System.Drawing.Size(544, 105);
this.groupBoxOutput.TabIndex = 11;
this.groupBoxOutput.TabStop = false;
this.groupBoxOutput.Text = "Output folder:";
@ -172,10 +168,9 @@ partial class frmMain
//
this.chkClean.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.chkClean.AutoSize = true;
this.chkClean.Location = new System.Drawing.Point(5, 50);
this.chkClean.Margin = new System.Windows.Forms.Padding(2);
this.chkClean.Location = new System.Drawing.Point(7, 86);
this.chkClean.Name = "chkClean";
this.chkClean.Size = new System.Drawing.Size(112, 19);
this.chkClean.Size = new System.Drawing.Size(167, 29);
this.chkClean.TabIndex = 9;
this.chkClean.Text = "Save Clean copy";
this.chkClean.UseVisualStyleBackColor = true;
@ -188,9 +183,11 @@ partial class frmMain
this.groupBox1.Controls.Add(this.txtOutputClean);
this.groupBox1.Controls.Add(this.btnBrowseOutputClean);
this.groupBox1.Controls.Add(this.chkClean);
this.groupBox1.Location = new System.Drawing.Point(12, 150);
this.groupBox1.Location = new System.Drawing.Point(17, 250);
this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(381, 74);
this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox1.Size = new System.Drawing.Size(544, 123);
this.groupBox1.TabIndex = 11;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Output folder for clean files (Optional):";
@ -200,10 +197,9 @@ partial class frmMain
this.txtOutputClean.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtOutputClean.Enabled = false;
this.txtOutputClean.Location = new System.Drawing.Point(5, 21);
this.txtOutputClean.Margin = new System.Windows.Forms.Padding(2);
this.txtOutputClean.Location = new System.Drawing.Point(7, 35);
this.txtOutputClean.Name = "txtOutputClean";
this.txtOutputClean.Size = new System.Drawing.Size(292, 23);
this.txtOutputClean.Size = new System.Drawing.Size(415, 31);
this.txtOutputClean.TabIndex = 3;
this.txtOutputClean.TextChanged += new System.EventHandler(this.TxtOutputTextChanged);
//
@ -211,10 +207,9 @@ partial class frmMain
//
this.btnBrowseOutputClean.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBrowseOutputClean.Enabled = false;
this.btnBrowseOutputClean.Location = new System.Drawing.Point(301, 21);
this.btnBrowseOutputClean.Margin = new System.Windows.Forms.Padding(2);
this.btnBrowseOutputClean.Location = new System.Drawing.Point(430, 35);
this.btnBrowseOutputClean.Name = "btnBrowseOutputClean";
this.btnBrowseOutputClean.Size = new System.Drawing.Size(75, 23);
this.btnBrowseOutputClean.Size = new System.Drawing.Size(107, 31);
this.btnBrowseOutputClean.TabIndex = 5;
this.btnBrowseOutputClean.Text = "Browse";
this.btnBrowseOutputClean.UseVisualStyleBackColor = true;
@ -223,9 +218,10 @@ partial class frmMain
// buttonAbout
//
this.buttonAbout.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonAbout.Location = new System.Drawing.Point(12, 233);
this.buttonAbout.Location = new System.Drawing.Point(17, 388);
this.buttonAbout.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.buttonAbout.Name = "buttonAbout";
this.buttonAbout.Size = new System.Drawing.Size(75, 23);
this.buttonAbout.Size = new System.Drawing.Size(107, 38);
this.buttonAbout.TabIndex = 12;
this.buttonAbout.Text = "About";
this.buttonAbout.UseVisualStyleBackColor = true;
@ -233,9 +229,9 @@ partial class frmMain
//
// frmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(404, 267);
this.ClientSize = new System.Drawing.Size(577, 445);
this.Controls.Add(this.buttonAbout);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.chkSaveLogs);
@ -245,8 +241,7 @@ partial class frmMain
this.Controls.Add(this.btnSave);
this.HelpButton = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(2);
this.MinimumSize = new System.Drawing.Size(420, 306);
this.MinimumSize = new System.Drawing.Size(591, 473);
this.Name = "frmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "appName";

View File

@ -1,22 +1,11 @@
using System.Reflection;
using kru.gui;
namespace ConverterGui;
public partial class frmMain : Form
using kru.gui;
using kru.gui.Core;
public partial class FrmMain : Form
{
public frmMain() => InitializeComponent();
public string archbitness = "x86";
public void bitness()
{
if (Environment.Is64BitProcess == true && Environment.Is64BitOperatingSystem == true)
{
archbitness = "x64";
}
else
{
archbitness = "x86";
}
}
public FrmMain() => this.InitializeComponent();
private void BtnBrowseOutputClick(object sender, EventArgs e) => this.txtOutput.Text = this.fbBrowseOutput.ShowDialog() == DialogResult.OK ? this.fbBrowseOutput.SelectedPath : string.Empty;
@ -27,35 +16,33 @@ public partial class frmMain : Form
private void TxtOutputTextChanged(object sender, EventArgs e)
{
this.fbBrowseOutput.SelectedPath = this.txtOutput.Text;
EnableButtons();
this.EnableButtons();
}
private void TxtInputTextChanged(object sender, EventArgs e)
{
this.fbBrowseInput.SelectedPath = this.txtInput.Text;
EnableButtons();
this.EnableButtons();
}
private void BtnSaveClick(object sender, EventArgs e)
{
var commands = GetCommands();
var commands = this.GetCommands();
if (sfdOutput.ShowDialog() == DialogResult.OK)
if (this.sfdOutput.ShowDialog() == DialogResult.OK)
{
File.WriteAllLines(sfdOutput.FileName, commands
File.WriteAllLines(this.sfdOutput.FileName, commands
.Select(a => a.GetBatchLine()));
}
MessageBox.Show(@"Done!",@"Success!",MessageBoxButtons.OK,MessageBoxIcon.Information);
MessageBox.Show("Done!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void EnableButtons()
{
var enabled = !string.IsNullOrWhiteSpace(this.txtInput.Text)
&& !string.IsNullOrWhiteSpace(this.txtOutput.Text)
//&& !string.IsNullOrWhiteSpace(this.txtOutputClean.Text)
&& Directory.Exists(this.txtInput.Text)
//&& Directory.Exists(this.txtOutputClean.Text)
&& Directory.Exists(this.txtOutput.Text);
this.btnSave.Enabled = this.btnStart.Enabled = enabled;
}
@ -68,12 +55,16 @@ public partial class frmMain : Form
Output = this.txtOutput.Text,
OutputClean = this.txtOutputClean.Text,
Clean = this.chkClean.Checked,
SaveLog = chkSaveLogs.Checked,
Bitness = archbitness
SaveLog = this.chkSaveLogs.Checked,
};
var commands = Directory
.GetFiles(options.Input, "*.wav")
.Select(inputFile => new Command(inputFile, Path.Combine(options.Output, Path.GetFileName(inputFile)), Path.Combine(options.OutputClean, Path.GetFileName(inputFile)), options.Clean, options.SaveLog,options.Bitness))
.Select(inputFile => new Command(
InputFile: inputFile,
OutputDirectory: options.Output,
CleanDirectory: options.Clean ? options.OutputClean : default,
SaveLog: options.SaveLog))
.ToArray();
return commands;
@ -82,38 +73,43 @@ public partial class frmMain : Form
private async void btnStart_Click(object sender, EventArgs e)
{
this.Enabled = false;
var commands = GetCommands();
foreach (var command in commands)
try
{
var proc = command.GetProcess();
proc.Start();
await proc.WaitForExitAsync().ConfigureAwait(false);
var commands = this.GetCommands();
foreach (var command in commands)
{
var proc = command.GetProcess();
try
{
proc.Start();
await proc.WaitForExitAsync().ConfigureAwait(false);
}
catch (Exception ex)
{
MessageBox.Show("Error", $"An error has occured while trying to launch command: {ex.Message}", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
MessageBox.Show("Done!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
finally
{
this.Enabled = true;
}
this.Enabled = true;
MessageBox.Show(@"Done!", @"Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void frmMain_Load(object sender, EventArgs e)
{
bitness();
var appVer = Assembly.GetEntryAssembly()!.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion;
var appName = Assembly.GetEntryAssembly()!.GetCustomAttribute<AssemblyProductAttribute>()!.Product;
this.Text = $@"{appName} {appVer} ({archbitness})";
var (version, name, _) = ApplicationInfoProvider.GetInfo();
this.Text = $"{name} {version} ({BitnessProvider.BitnessName})";
}
private void sfdOutput_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
{
}
private void chkClean_CheckedChanged(object sender, EventArgs e)
{
txtOutputClean.Enabled = btnBrowseOutputClean.Enabled = chkClean.Checked;
}
private void chkClean_CheckedChanged(object sender, EventArgs e) => this.txtOutputClean.Enabled = this.btnBrowseOutputClean.Enabled = this.chkClean.Checked;
private void buttonAbout_Click(object sender, EventArgs e)
{
var frmabout = new frmAbout();
frmabout.ShowDialog();
using var about = new FrmAbout();
about.ShowDialog();
}
}

View File

@ -1,33 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<Nullable>enable</Nullable>
<PublishTrimmed>false</PublishTrimmed>
<PublishReadyToRun>true</PublishReadyToRun>
<TargetFramework>net7.0-windows</TargetFramework>
<ApplicationIcon>favicon.ico</ApplicationIcon>
<PackageId>AntinomyCollective.kru.gui</PackageId>
<Authors>Antinomy Collective, EpicMorg, kasthack, stam</Authors>
<Description>Retime Phoneme Util GUI by EpicMorg</Description>
<PackageProjectUrl>https://github.com/AntinomyCollective/Retime-Phoneme-Uti-GUI</PackageProjectUrl>
<PackageIcon>favicon.png</PackageIcon>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/AntinomyCollective/Retime-Phoneme-Uti-GUI</RepositoryUrl>
<PackageTags>epicmorg, retime, Phoneme, Util, GUI, Antinomy, Collective</PackageTags>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
<PackageVersion>1.1.0.0</PackageVersion>
<Version>1.1.0.0</Version>
<Copyright>EpicMorg 2023</Copyright>
<Product>Retime Phoneme Util GUI</Product>
<IsPackable>true</IsPackable>
<ApplicationIcon>favicon.ico</ApplicationIcon>
<Authors>Antinomy Collective, EpicMorg, kasthack, stam</Authors>
<Company>EpicMorg</Company>
<PackageReadmeFile>README.md</PackageReadmeFile>
<UseWindowsForms>True</UseWindowsForms>
<Copyright>EpicMorg 2023</Copyright>
<Description>Retime Phoneme Util GUI by EpicMorg</Description>
<ImplicitUsings>enable</ImplicitUsings>
<PackageIcon>favicon.png</PackageIcon>
<PackageId>AntinomyCollective.kru.gui</PackageId>
<PackageProjectUrl>https://github.com/AntinomyCollective/Retime-Phoneme-Uti-GUI</PackageProjectUrl>
<PackageTags>epicmorg, retime, Phoneme, Util, GUI, Antinomy, Collective</PackageTags>
<Product>Retime Phoneme Util GUI</Product>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>false</PublishTrimmed>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/AntinomyCollective/Retime-Phoneme-Uti-GUI</RepositoryUrl>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<TargetFramework>net7.0-windows</TargetFramework>
<UseWindowsForms>True</UseWindowsForms>
<OutputType>WinExe</OutputType>
</PropertyGroup>
<ItemGroup>
@ -46,6 +45,7 @@
</ItemGroup>
<ItemGroup>
<None Update="favicon.png" Pack="true" PackagePath=""/>
<None Update="Tools\x64\libgcc_s_seh-1.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

View File

@ -6,6 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "kru.gui", "kru.gui\kru.gui.csproj", "{2D372BD7-104E-480F-82F5-60EA08A20227}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{494D64A2-ECC6-4B4B-8359-F5AB20E128F7}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution