diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 000000000..775f691 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,28 @@ +name: .NET + +defaults: + run: + working-directory: src +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + dotnet-version: ['7.0.x' ] + steps: + - uses: actions/checkout@v3 + - name: Setup .NET Core SDK ${{ matrix.dotnet-version }} + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ matrix.dotnet-version }} + - name: Install dependencies + run: dotnet restore + - name: Build + run: dotnet build --configuration Release --no-restore + - name: Test + run: dotnet test --no-restore --verbosity normal \ No newline at end of file diff --git a/.gitignore b/.gitignore index 8bfdde5..b361e50 100644 --- a/.gitignore +++ b/.gitignore @@ -1,255 +1,7 @@ -# Created by https://www.toptal.com/developers/gitignore/api/c,c++,csharp,visualstudio,visualstudiocode,intellij,clion,clion+all -# Edit at https://www.toptal.com/developers/gitignore?templates=c,c++,csharp,visualstudio,visualstudiocode,intellij,clion,clion+all - -### C ### -# Prerequisites -*.d - -# Object files -*.o -*.ko -*.obj -*.elf - -# Linker output -*.ilk -*.map -*.exp - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex - -# Debug files -*.dSYM/ -*.su -*.idb -*.pdb - -# Kernel Module Compile Results -*.mod* -*.cmd -.tmp_versions/ -modules.order -Module.symvers -Mkfile.old -dkms.conf - -### C++ ### -# Prerequisites - -# Compiled Object files -*.slo - -# Precompiled Headers - -# Compiled Dynamic libraries - -# Fortran module files -*.mod -*.smod - -# Compiled Static libraries -*.lai - -# Executables - -### CLion ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# AWS User-specific -.idea/**/aws.xml - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake -cmake-build-*/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# SonarLint plugin -.idea/sonarlint/ - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser - -### CLion Patch ### -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 - -# *.iml -# modules.xml -# .idea/misc.xml -# *.ipr - -# Sonarlint plugin -# https://plugins.jetbrains.com/plugin/7973-sonarlint -.idea/**/sonarlint/ - -# SonarQube Plugin -# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin -.idea/**/sonarIssues.xml - -# Markdown Navigator plugin -# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced -.idea/**/markdown-navigator.xml -.idea/**/markdown-navigator-enh.xml -.idea/**/markdown-navigator/ - -# Cache file creation bug -# See https://youtrack.jetbrains.com/issue/JBR-2257 -.idea/$CACHE_FILE$ - -# CodeStream plugin -# https://plugins.jetbrains.com/plugin/12206-codestream -.idea/codestream.xml - -# Azure Toolkit for IntelliJ plugin -# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij -.idea/**/azureSettings.xml - -### CLion+all ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff - -# AWS User-specific - -# Generated files - -# Sensitive or high-churn files - -# Gradle - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake - -# Mongo Explorer plugin - -# File-based project format - -# IntelliJ - -# mpeltonen/sbt-idea plugin - -# JIRA plugin - -# Cursive Clojure plugin - -# SonarLint plugin - -# Crashlytics plugin (for Android Studio and IntelliJ) - -# Editor-based Rest Client - -# Android studio 3.1+ serialized cache file - -### CLion+all Patch ### -# Ignore everything but code style settings and run configurations -# that are supposed to be shared within teams. - -.idea/* - -!.idea/codeStyles -!.idea/runConfigurations - -### Csharp ### ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## -## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore # User-specific files *.rsuser @@ -320,8 +72,12 @@ StyleCopReport.xml *_i.c *_p.c *_h.h +*.ilk *.meta +*.obj *.iobj +*.pch +*.pdb *.ipdb *.pgc *.pgd @@ -334,7 +90,6 @@ StyleCopReport.xml *.tmp_proj *_wpftmp.csproj *.log -*.tlog *.vspscc *.vssscc .builds @@ -428,7 +183,7 @@ publish/ *.azurePubxml # Note: Comment the next line if you want to checkin your web deploy settings, # but database connection strings (with potential passwords) will be unencrypted -*.pubxml +#*.pubxml *.publishproj # Microsoft Azure Web App publish settings. Comment the next line if you want to @@ -538,15 +293,6 @@ node_modules/ # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) *.vbw -# Visual Studio 6 auto-generated project file (contains which files were open etc.) -*.vbp - -# Visual Studio 6 workspace and project file (working project files containing files to include in project) -*.dsw -*.dsp - -# Visual Studio 6 technical files - # Visual Studio LightSwitch build output **/*.HTMLClient/GeneratedArtifacts **/*.DesktopClient/GeneratedArtifacts @@ -603,9 +349,6 @@ ASALocalRun/ # Local History for Visual Studio .localhistory/ -# Visual Studio History (VSHistory) files -.vshistory/ - # BeatPulse healthcheck temp database healthchecksdb @@ -616,296 +359,4 @@ MigrationBackup/ .ionide/ # Fody - auto-generated XML schema -FodyWeavers.xsd - -# VS Code files for those working on multiple tools -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace - -# Local History for Visual Studio Code -.history/ - -# Windows Installer files from build outputs -*.cab -*.msi -*.msix -*.msm -*.msp - -# JetBrains Rider -*.sln.iml - -### Intellij ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff - -# AWS User-specific - -# Generated files - -# Sensitive or high-churn files - -# Gradle - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake - -# Mongo Explorer plugin - -# File-based project format - -# IntelliJ - -# mpeltonen/sbt-idea plugin - -# JIRA plugin - -# Cursive Clojure plugin - -# SonarLint plugin - -# Crashlytics plugin (for Android Studio and IntelliJ) - -# Editor-based Rest Client - -# Android studio 3.1+ serialized cache file - -### Intellij Patch ### -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 - -# *.iml -# modules.xml -# .idea/misc.xml -# *.ipr - -# Sonarlint plugin -# https://plugins.jetbrains.com/plugin/7973-sonarlint - -# SonarQube Plugin -# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin - -# Markdown Navigator plugin -# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced - -# Cache file creation bug -# See https://youtrack.jetbrains.com/issue/JBR-2257 - -# CodeStream plugin -# https://plugins.jetbrains.com/plugin/12206-codestream - -# Azure Toolkit for IntelliJ plugin -# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij - -### VisualStudioCode ### -!.vscode/*.code-snippets - -# Local History for Visual Studio Code - -# Built Visual Studio Code Extensions -*.vsix - -### VisualStudioCode Patch ### -# Ignore all local history of files -.history -.ionide - -### VisualStudio ### - -# User-specific files - -# User-specific files (MonoDevelop/Xamarin Studio) - -# Mono auto generated files - -# Build results - -# Visual Studio 2015/2017 cache/options directory -# Uncomment if you have tasks that create the project's static files in wwwroot - -# Visual Studio 2017 auto generated files - -# MSTest test Results - -# NUnit - -# Build Results of an ATL Project - -# Benchmark Results - -# .NET Core - -# ASP.NET Scaffolding - -# StyleCop - -# Files built by Visual Studio - -# Chutzpah Test files - -# Visual C++ cache files - -# Visual Studio profiler - -# Visual Studio Trace Files - -# TFS 2012 Local Workspace - -# Guidance Automation Toolkit - -# ReSharper is a .NET coding add-in - -# TeamCity is a build add-in - -# DotCover is a Code Coverage Tool - -# AxoCover is a Code Coverage Tool - -# Coverlet is a free, cross platform Code Coverage Tool - -# Visual Studio code coverage results - -# NCrunch - -# MightyMoose - -# Web workbench (sass) - -# Installshield output folder - -# DocProject is a documentation generator add-in - -# Click-Once directory - -# Publish Web Output -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted - -# NuGet Packages -# NuGet Symbol Packages -# The packages folder can be ignored because of Package Restore -# except build/, which is used as an MSBuild target. -# Uncomment if necessary however generally it will be regenerated when needed -# NuGet v3's project.json files produces more ignorable files - -# Microsoft Azure Build Output - -# Microsoft Azure Emulator - -# Windows Store app package directories and files - -# Visual Studio cache files -# files ending in .cache can be ignored -# but keep track of directories ending in .cache - -# Others - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) - -# RIA/Silverlight projects - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) - -# SQL Server files - -# Business Intelligence projects - -# Microsoft Fakes - -# GhostDoc plugin setting file - -# Node.js Tools for Visual Studio - -# Visual Studio 6 build log - -# Visual Studio 6 workspace options file - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) - -# Visual Studio 6 auto-generated project file (contains which files were open etc.) - -# Visual Studio 6 workspace and project file (working project files containing files to include in project) - -# Visual Studio 6 technical files - -# Visual Studio LightSwitch build output - -# Paket dependency manager - -# FAKE - F# Make - -# CodeRush personal settings - -# Python Tools for Visual Studio (PTVS) - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio - -# Telerik's JustMock configuration file - -# BizTalk build output - -# OpenCover UI analysis results - -# Azure Stream Analytics local run output - -# MSBuild Binary and Structured Log - -# NVidia Nsight GPU debugger configuration file - -# MFractors (Xamarin productivity tool) working folder - -# Local History for Visual Studio - -# Visual Studio History (VSHistory) files - -# BeatPulse healthcheck temp database - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 - -# Ionide (cross platform F# VS Code tools) working folder - -# Fody - auto-generated XML schema - -# VS Code files for those working on multiple tools - -# Local History for Visual Studio Code - -# Windows Installer files from build outputs - -# JetBrains Rider - -### VisualStudio Patch ### -# Additional files built by Visual Studio - -# End of https://www.toptal.com/developers/gitignore/api/c,c++,csharp,visualstudio,visualstudiocode,intellij,clion,clion+all +FodyWeavers.xsd \ No newline at end of file diff --git a/src/kru.gui/.vs/ProjectEvaluation/kru.gui.metadata.v6.1 b/src/kru.gui/.vs/ProjectEvaluation/kru.gui.metadata.v6.1 deleted file mode 100644 index 05937e8..000000000 Binary files a/src/kru.gui/.vs/ProjectEvaluation/kru.gui.metadata.v6.1 and /dev/null differ diff --git a/src/kru.gui/.vs/ProjectEvaluation/kru.gui.projects.v6.1 b/src/kru.gui/.vs/ProjectEvaluation/kru.gui.projects.v6.1 deleted file mode 100644 index 2b37d53..000000000 Binary files a/src/kru.gui/.vs/ProjectEvaluation/kru.gui.projects.v6.1 and /dev/null differ diff --git a/src/kru.gui/.vs/kru.gui/DesignTimeBuild/.dtbcache.v2 b/src/kru.gui/.vs/kru.gui/DesignTimeBuild/.dtbcache.v2 deleted file mode 100644 index 8712588..000000000 Binary files a/src/kru.gui/.vs/kru.gui/DesignTimeBuild/.dtbcache.v2 and /dev/null differ diff --git a/src/kru.gui/.vs/kru.gui/FileContentIndex/70e3f94a-27da-4670-ab5a-98cc09085bd1.vsidx b/src/kru.gui/.vs/kru.gui/FileContentIndex/70e3f94a-27da-4670-ab5a-98cc09085bd1.vsidx deleted file mode 100644 index e60dac9..000000000 Binary files a/src/kru.gui/.vs/kru.gui/FileContentIndex/70e3f94a-27da-4670-ab5a-98cc09085bd1.vsidx and /dev/null differ diff --git a/src/kru.gui/.vs/kru.gui/FileContentIndex/8f7ea11c-8429-447a-8a8b-9901c7e51e3e.vsidx b/src/kru.gui/.vs/kru.gui/FileContentIndex/8f7ea11c-8429-447a-8a8b-9901c7e51e3e.vsidx deleted file mode 100644 index 523d971..000000000 Binary files a/src/kru.gui/.vs/kru.gui/FileContentIndex/8f7ea11c-8429-447a-8a8b-9901c7e51e3e.vsidx and /dev/null differ diff --git a/src/kru.gui/.vs/kru.gui/FileContentIndex/read.lock b/src/kru.gui/.vs/kru.gui/FileContentIndex/read.lock deleted file mode 100644 index e69de29..000000000 diff --git a/src/kru.gui/.vs/kru.gui/v17/.futdcache.v2 b/src/kru.gui/.vs/kru.gui/v17/.futdcache.v2 deleted file mode 100644 index 9cd2606..000000000 Binary files a/src/kru.gui/.vs/kru.gui/v17/.futdcache.v2 and /dev/null differ diff --git a/src/kru.gui/.vs/kru.gui/v17/.suo b/src/kru.gui/.vs/kru.gui/v17/.suo deleted file mode 100644 index 38fb74e..000000000 Binary files a/src/kru.gui/.vs/kru.gui/v17/.suo and /dev/null differ diff --git a/src/kru.gui/Command.cs b/src/kru.gui/Command.cs new file mode 100644 index 000000000..37afab2 --- /dev/null +++ b/src/kru.gui/Command.cs @@ -0,0 +1,48 @@ +namespace ConverterGui; + +using System.Diagnostics; +using System.Reflection; + +internal record Command(string InputFile, string OutputFile, bool Clean, bool SaveLog) +{ + private string ExecutablePath => + Path.Combine( + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location!)!, + @"Tools\x64\retime_phoneme.exe" + ); + + public string GetBatchLine() => string.Join(" ", new[] { $"\"{ExecutablePath}\"" }.Concat(GetArguments().Select(arg => $"\"{arg}\""))); + + public Process GetProcess() + { + var proc = new Process() + { + StartInfo = new ProcessStartInfo + { + FileName = ExecutablePath + }, + EnableRaisingEvents = true, + }; + foreach (var item in this.GetArguments()) + { + proc.StartInfo.ArgumentList.Add(item); + } + return proc; + } + + private IEnumerable GetArguments() + { + yield return "-s"; + yield return InputFile; + yield return "-d"; + yield return OutputFile; + if (Clean) + { + yield return "-oc"; + } + if (SaveLog) + { + yield return "-o"; + } + } +} diff --git a/src/kru.gui/Program.cs b/src/kru.gui/Program.cs index 9b3749b..4f0c583 100644 --- a/src/kru.gui/Program.cs +++ b/src/kru.gui/Program.cs @@ -1,19 +1,16 @@ -using kru.gui.UI; +namespace ConverterGui; -namespace kru.gui +internal static class Program { - internal static class Program + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() { - /// - /// The main entry point for the application. - /// - [STAThread] - 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()); - } + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new frmMain()); } } \ No newline at end of file diff --git a/src/kru.gui/UI/FrmMain.Designer.cs b/src/kru.gui/UI/FrmMain.Designer.cs deleted file mode 100644 index da0b7e6..000000000 --- a/src/kru.gui/UI/FrmMain.Designer.cs +++ /dev/null @@ -1,224 +0,0 @@ -namespace kru.gui.UI -{ - partial class FrmMain - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.groupBoxInput = new System.Windows.Forms.GroupBox(); - this.buttonBrowseInput = new System.Windows.Forms.Button(); - this.textBoxInput = new System.Windows.Forms.TextBox(); - this.groupBoxOutput = new System.Windows.Forms.GroupBox(); - this.groupBoxMode = new System.Windows.Forms.GroupBox(); - this.radioButtonC = new System.Windows.Forms.RadioButton(); - this.radioButtonD = new System.Windows.Forms.RadioButton(); - this.buttonBrowseOutput = new System.Windows.Forms.Button(); - this.checkBoxSaveLogs = new System.Windows.Forms.CheckBox(); - this.textBoxOutput = new System.Windows.Forms.TextBox(); - this.buttonStart = new System.Windows.Forms.Button(); - this.buttonSaveBatch = new System.Windows.Forms.Button(); - this.folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); - this.groupBoxInput.SuspendLayout(); - this.groupBoxOutput.SuspendLayout(); - this.groupBoxMode.SuspendLayout(); - this.SuspendLayout(); - // - // groupBoxInput - // - this.groupBoxInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBoxInput.Controls.Add(this.buttonBrowseInput); - this.groupBoxInput.Controls.Add(this.textBoxInput); - this.groupBoxInput.Location = new System.Drawing.Point(12, 12); - this.groupBoxInput.Name = "groupBoxInput"; - this.groupBoxInput.Size = new System.Drawing.Size(358, 64); - this.groupBoxInput.TabIndex = 0; - this.groupBoxInput.TabStop = false; - this.groupBoxInput.Text = "Input:"; - // - // buttonBrowseInput - // - this.buttonBrowseInput.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonBrowseInput.Location = new System.Drawing.Point(277, 22); - this.buttonBrowseInput.Name = "buttonBrowseInput"; - this.buttonBrowseInput.Size = new System.Drawing.Size(75, 23); - this.buttonBrowseInput.TabIndex = 1; - this.buttonBrowseInput.Text = "Browse"; - this.buttonBrowseInput.UseVisualStyleBackColor = true; - this.buttonBrowseInput.Click += new System.EventHandler(this.buttonBrowseInput_Click); - // - // textBoxInput - // - this.textBoxInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBoxInput.Location = new System.Drawing.Point(6, 22); - this.textBoxInput.Name = "textBoxInput"; - this.textBoxInput.Size = new System.Drawing.Size(265, 23); - this.textBoxInput.TabIndex = 0; - // - // groupBoxOutput - // - this.groupBoxOutput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBoxOutput.Controls.Add(this.groupBoxMode); - this.groupBoxOutput.Controls.Add(this.buttonBrowseOutput); - this.groupBoxOutput.Controls.Add(this.checkBoxSaveLogs); - this.groupBoxOutput.Controls.Add(this.textBoxOutput); - this.groupBoxOutput.Location = new System.Drawing.Point(12, 82); - this.groupBoxOutput.Name = "groupBoxOutput"; - this.groupBoxOutput.Size = new System.Drawing.Size(358, 136); - this.groupBoxOutput.TabIndex = 0; - this.groupBoxOutput.TabStop = false; - this.groupBoxOutput.Text = "Output:"; - // - // groupBoxMode - // - this.groupBoxMode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.groupBoxMode.Controls.Add(this.radioButtonC); - this.groupBoxMode.Controls.Add(this.radioButtonD); - this.groupBoxMode.Location = new System.Drawing.Point(6, 51); - this.groupBoxMode.Name = "groupBoxMode"; - this.groupBoxMode.Size = new System.Drawing.Size(262, 79); - this.groupBoxMode.TabIndex = 2; - this.groupBoxMode.TabStop = false; - this.groupBoxMode.Text = "Mode:"; - // - // radioButtonC - // - this.radioButtonC.AutoSize = true; - this.radioButtonC.Location = new System.Drawing.Point(6, 47); - this.radioButtonC.Name = "radioButtonC"; - this.radioButtonC.Size = new System.Drawing.Size(55, 19); - this.radioButtonC.TabIndex = 0; - this.radioButtonC.Text = "Clean"; - this.radioButtonC.UseVisualStyleBackColor = true; - // - // radioButtonD - // - this.radioButtonD.AutoSize = true; - this.radioButtonD.Checked = true; - this.radioButtonD.Location = new System.Drawing.Point(6, 22); - this.radioButtonD.Name = "radioButtonD"; - this.radioButtonD.Size = new System.Drawing.Size(102, 19); - this.radioButtonD.TabIndex = 0; - this.radioButtonD.TabStop = true; - this.radioButtonD.Text = "Fixed (Default)"; - this.radioButtonD.UseVisualStyleBackColor = true; - // - // buttonBrowseOutput - // - this.buttonBrowseOutput.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonBrowseOutput.Location = new System.Drawing.Point(277, 21); - this.buttonBrowseOutput.Name = "buttonBrowseOutput"; - this.buttonBrowseOutput.Size = new System.Drawing.Size(75, 23); - this.buttonBrowseOutput.TabIndex = 1; - this.buttonBrowseOutput.Text = "Browse"; - this.buttonBrowseOutput.UseVisualStyleBackColor = true; - this.buttonBrowseOutput.Click += new System.EventHandler(this.buttonBrowseOutput_Click); - // - // checkBoxSaveLogs - // - this.checkBoxSaveLogs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.checkBoxSaveLogs.AutoCheck = false; - this.checkBoxSaveLogs.AutoSize = true; - this.checkBoxSaveLogs.Checked = true; - this.checkBoxSaveLogs.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBoxSaveLogs.Location = new System.Drawing.Point(274, 111); - this.checkBoxSaveLogs.Name = "checkBoxSaveLogs"; - this.checkBoxSaveLogs.Size = new System.Drawing.Size(78, 19); - this.checkBoxSaveLogs.TabIndex = 0; - this.checkBoxSaveLogs.Text = "Save Logs"; - this.checkBoxSaveLogs.UseVisualStyleBackColor = true; - // - // textBoxOutput - // - this.textBoxOutput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBoxOutput.Location = new System.Drawing.Point(6, 22); - this.textBoxOutput.Name = "textBoxOutput"; - this.textBoxOutput.Size = new System.Drawing.Size(265, 23); - this.textBoxOutput.TabIndex = 0; - // - // buttonStart - // - this.buttonStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonStart.Location = new System.Drawing.Point(295, 235); - this.buttonStart.Name = "buttonStart"; - this.buttonStart.Size = new System.Drawing.Size(75, 23); - this.buttonStart.TabIndex = 1; - this.buttonStart.Text = "Start"; - this.buttonStart.UseVisualStyleBackColor = true; - // - // buttonSaveBatch - // - this.buttonSaveBatch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.buttonSaveBatch.Location = new System.Drawing.Point(12, 235); - this.buttonSaveBatch.Name = "buttonSaveBatch"; - this.buttonSaveBatch.Size = new System.Drawing.Size(75, 23); - this.buttonSaveBatch.TabIndex = 1; - this.buttonSaveBatch.Text = "Save Batch"; - this.buttonSaveBatch.UseVisualStyleBackColor = true; - // - // FrmMain - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(382, 270); - this.Controls.Add(this.buttonSaveBatch); - this.Controls.Add(this.buttonStart); - this.Controls.Add(this.groupBoxOutput); - this.Controls.Add(this.groupBoxInput); - this.Name = "FrmMain"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Retime Phoneme Uti GUI"; - this.Load += new System.EventHandler(this.FrmMain_Load); - this.groupBoxInput.ResumeLayout(false); - this.groupBoxInput.PerformLayout(); - this.groupBoxOutput.ResumeLayout(false); - this.groupBoxOutput.PerformLayout(); - this.groupBoxMode.ResumeLayout(false); - this.groupBoxMode.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private GroupBox groupBoxInput; - private GroupBox groupBoxOutput; - private Button buttonStart; - private Button buttonSaveBatch; - private CheckBox checkBoxSaveLogs; - private Button buttonBrowseInput; - private TextBox textBoxInput; - private Button buttonBrowseOutput; - private TextBox textBoxOutput; - private GroupBox groupBoxMode; - private RadioButton radioButtonC; - private RadioButton radioButtonD; - private FolderBrowserDialog folderBrowserDialog; - } -} \ No newline at end of file diff --git a/src/kru.gui/UI/FrmMain.cs b/src/kru.gui/UI/FrmMain.cs deleted file mode 100644 index bff89a3..000000000 --- a/src/kru.gui/UI/FrmMain.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace kru.gui.UI -{ - public partial class FrmMain : Form - { - public FrmMain() - { - InitializeComponent(); - } - - private void FrmMain_Load(object sender, EventArgs e) - { - - } - - private void buttonBrowseInput_Click(object sender, EventArgs e) - { - if (folderBrowserDialog.ShowDialog() == DialogResult.OK) - { - textBoxInput.Text = folderBrowserDialog.SelectedPath; - } - } - - private void buttonBrowseOutput_Click(object sender, EventArgs e) - { - if (folderBrowserDialog.ShowDialog() == DialogResult.OK) - { - textBoxOutput.Text = folderBrowserDialog.SelectedPath; - } - } - } -} \ No newline at end of file diff --git a/src/kru.gui/frmMain.Designer.cs b/src/kru.gui/frmMain.Designer.cs new file mode 100644 index 000000000..ef1e81e --- /dev/null +++ b/src/kru.gui/frmMain.Designer.cs @@ -0,0 +1,211 @@ +namespace ConverterGui; + +partial class frmMain +{ + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lblInput = new System.Windows.Forms.Label(); + this.txtInput = new System.Windows.Forms.TextBox(); + this.txtOutput = new System.Windows.Forms.TextBox(); + this.lblOutput = new System.Windows.Forms.Label(); + this.btnBrowseInput = new System.Windows.Forms.Button(); + this.btnBrowseOutput = new System.Windows.Forms.Button(); + this.btnSave = new System.Windows.Forms.Button(); + this.btnStart = new System.Windows.Forms.Button(); + this.fbBrowseInput = new System.Windows.Forms.FolderBrowserDialog(); + this.fbBrowseOutput = new System.Windows.Forms.FolderBrowserDialog(); + this.sfdOutput = new System.Windows.Forms.SaveFileDialog(); + this.grpClean = new System.Windows.Forms.GroupBox(); + this.rdClean = new System.Windows.Forms.RadioButton(); + this.rdFixed = new System.Windows.Forms.RadioButton(); + this.chkSaveLogs = new System.Windows.Forms.CheckBox(); + this.grpClean.SuspendLayout(); + this.SuspendLayout(); + // + // lblInput + // + this.lblInput.AutoSize = true; + this.lblInput.Location = new System.Drawing.Point(12, 20); + this.lblInput.Name = "lblInput"; + this.lblInput.Size = new System.Drawing.Size(58, 25); + this.lblInput.TabIndex = 0; + this.lblInput.Text = "Input:"; + // + // txtInput + // + this.txtInput.Location = new System.Drawing.Point(12, 68); + this.txtInput.Name = "txtInput"; + this.txtInput.Size = new System.Drawing.Size(521, 31); + this.txtInput.TabIndex = 1; + this.txtInput.TextChanged += new System.EventHandler(this.TxtInputTextChanged); + // + // txtOutput + // + this.txtOutput.Location = new System.Drawing.Point(12, 173); + this.txtOutput.Name = "txtOutput"; + this.txtOutput.Size = new System.Drawing.Size(521, 31); + this.txtOutput.TabIndex = 3; + this.txtOutput.TextChanged += new System.EventHandler(this.TxtOutputTextChanged); + // + // lblOutput + // + this.lblOutput.AutoSize = true; + this.lblOutput.Location = new System.Drawing.Point(12, 125); + this.lblOutput.Name = "lblOutput"; + this.lblOutput.Size = new System.Drawing.Size(73, 25); + this.lblOutput.TabIndex = 2; + this.lblOutput.Text = "Output:"; + // + // btnBrowseInput + // + this.btnBrowseInput.Location = new System.Drawing.Point(555, 67); + this.btnBrowseInput.Name = "btnBrowseInput"; + this.btnBrowseInput.Size = new System.Drawing.Size(112, 34); + this.btnBrowseInput.TabIndex = 4; + this.btnBrowseInput.Text = "Browse"; + this.btnBrowseInput.UseVisualStyleBackColor = true; + this.btnBrowseInput.Click += new System.EventHandler(this.BtnBrowseInputClick); + // + // btnBrowseOutput + // + this.btnBrowseOutput.Location = new System.Drawing.Point(555, 171); + this.btnBrowseOutput.Name = "btnBrowseOutput"; + this.btnBrowseOutput.Size = new System.Drawing.Size(112, 34); + this.btnBrowseOutput.TabIndex = 5; + this.btnBrowseOutput.Text = "Browse"; + this.btnBrowseOutput.UseVisualStyleBackColor = true; + this.btnBrowseOutput.Click += new System.EventHandler(this.BtnBrowseOutputClick); + // + // btnSave + // + this.btnSave.Enabled = false; + this.btnSave.Location = new System.Drawing.Point(12, 373); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(112, 34); + this.btnSave.TabIndex = 6; + this.btnSave.Text = "Save batch"; + this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.BtnSaveClick); + // + // btnStart + // + this.btnStart.Enabled = false; + this.btnStart.Location = new System.Drawing.Point(552, 373); + this.btnStart.Name = "btnStart"; + this.btnStart.Size = new System.Drawing.Size(112, 34); + this.btnStart.TabIndex = 7; + this.btnStart.Text = "Start"; + this.btnStart.UseVisualStyleBackColor = true; + this.btnStart.Click += new System.EventHandler(this.btnStart_Click); + // + // grpClean + // + this.grpClean.Controls.Add(this.rdClean); + this.grpClean.Controls.Add(this.rdFixed); + this.grpClean.Location = new System.Drawing.Point(12, 226); + this.grpClean.Name = "grpClean"; + this.grpClean.Size = new System.Drawing.Size(320, 119); + this.grpClean.TabIndex = 8; + this.grpClean.TabStop = false; + this.grpClean.Text = "Mode"; + // + // rdClean + // + this.rdClean.AutoSize = true; + this.rdClean.Location = new System.Drawing.Point(18, 75); + this.rdClean.Name = "rdClean"; + this.rdClean.Size = new System.Drawing.Size(80, 29); + this.rdClean.TabIndex = 1; + this.rdClean.Text = "Clean"; + this.rdClean.UseVisualStyleBackColor = true; + // + // rdFixed + // + this.rdFixed.AutoSize = true; + this.rdFixed.Checked = true; + this.rdFixed.Location = new System.Drawing.Point(18, 30); + this.rdFixed.Name = "rdFixed"; + this.rdFixed.Size = new System.Drawing.Size(143, 29); + this.rdFixed.TabIndex = 0; + this.rdFixed.TabStop = true; + this.rdFixed.Text = "Fixed(default)"; + this.rdFixed.UseVisualStyleBackColor = true; + // + // chkSaveLogs + // + this.chkSaveLogs.AutoSize = true; + this.chkSaveLogs.Checked = true; + this.chkSaveLogs.CheckState = System.Windows.Forms.CheckState.Checked; + this.chkSaveLogs.Location = new System.Drawing.Point(375, 243); + this.chkSaveLogs.Name = "chkSaveLogs"; + this.chkSaveLogs.Size = new System.Drawing.Size(114, 29); + this.chkSaveLogs.TabIndex = 9; + this.chkSaveLogs.Text = "Save logs"; + this.chkSaveLogs.UseVisualStyleBackColor = true; + // + // frmMain + // + this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(690, 416); + this.Controls.Add(this.chkSaveLogs); + this.Controls.Add(this.grpClean); + this.Controls.Add(this.btnStart); + this.Controls.Add(this.btnSave); + this.Controls.Add(this.btnBrowseOutput); + this.Controls.Add(this.btnBrowseInput); + this.Controls.Add(this.txtOutput); + this.Controls.Add(this.lblOutput); + this.Controls.Add(this.txtInput); + this.Controls.Add(this.lblInput); + this.Name = "frmMain"; + this.Text = "Converter"; + this.grpClean.ResumeLayout(false); + this.grpClean.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private Label lblInput; + private TextBox txtInput; + private TextBox txtOutput; + private Label lblOutput; + private Button btnBrowseInput; + private Button btnBrowseOutput; + private Button btnSave; + private Button btnStart; + private FolderBrowserDialog fbBrowseInput; + private FolderBrowserDialog fbBrowseOutput; + private SaveFileDialog sfdOutput; + private GroupBox grpClean; + private RadioButton rdClean; + private RadioButton rdFixed; + private CheckBox chkSaveLogs; +} diff --git a/src/kru.gui/frmMain.cs b/src/kru.gui/frmMain.cs new file mode 100644 index 000000000..8a1bf5b --- /dev/null +++ b/src/kru.gui/frmMain.cs @@ -0,0 +1,73 @@ +namespace ConverterGui; +public partial class frmMain : Form +{ + public frmMain() => InitializeComponent(); + + private void BtnBrowseOutputClick(object sender, EventArgs e) => this.txtOutput.Text = this.fbBrowseOutput.ShowDialog() == DialogResult.OK ? this.fbBrowseOutput.SelectedPath : string.Empty; + + private void BtnBrowseInputClick(object sender, EventArgs e) => this.txtInput.Text = this.fbBrowseInput.ShowDialog() == DialogResult.OK ? this.fbBrowseInput.SelectedPath : string.Empty; + + private void TxtOutputTextChanged(object sender, EventArgs e) + { + this.fbBrowseOutput.SelectedPath = this.txtOutput.Text; + EnableButtons(); + } + + private void TxtInputTextChanged(object sender, EventArgs e) + { + this.fbBrowseInput.SelectedPath = this.txtInput.Text; + EnableButtons(); + } + + private void BtnSaveClick(object sender, EventArgs e) + { + var commands = GetCommands(); + + if (sfdOutput.ShowDialog() == DialogResult.OK) + { + File.WriteAllLines(sfdOutput.FileName, commands + .Select(a => a.GetBatchLine())); + } + + MessageBox.Show("Done!"); + } + + private void EnableButtons() + { + var enabled = !string.IsNullOrWhiteSpace(this.txtInput.Text) + && !string.IsNullOrWhiteSpace(this.txtOutput.Text) + && Directory.Exists(this.txtInput.Text); + this.btnSave.Enabled = this.btnStart.Enabled = enabled; + } + + private Command[] GetCommands() + { + var options = new + { + Input = this.txtInput.Text, + Output = this.txtOutput.Text, + Clean = this.rdClean.Checked, + SaveLog = chkSaveLogs.Checked, + }; + var commands = Directory + .GetFiles(options.Input) + .Select(inputFile => new Command(inputFile, Path.Combine(options.Output, Path.GetFileName(inputFile)), options.Clean, options.SaveLog)) + .ToArray(); + + return commands; + } + + private async void btnStart_Click(object sender, EventArgs e) + { + this.Enabled = false; + var commands = GetCommands(); + foreach (var command in commands) + { + var proc = command.GetProcess(); + proc.Start(); + await proc.WaitForExitAsync().ConfigureAwait(false); + } + this.Enabled = true; + MessageBox.Show("Done!"); + } +} diff --git a/src/kru.gui/UI/FrmMain.resx b/src/kru.gui/frmMain.resx similarity index 83% rename from src/kru.gui/UI/FrmMain.resx rename to src/kru.gui/frmMain.resx index f72ed9f..493d344 100644 --- a/src/kru.gui/UI/FrmMain.resx +++ b/src/kru.gui/frmMain.resx @@ -57,7 +57,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 + + 197, 17 + + + 393, 17 + \ No newline at end of file diff --git a/src/kru.gui/kru.gui.csproj b/src/kru.gui/kru.gui.csproj index 330f660..6e39934 100644 --- a/src/kru.gui/kru.gui.csproj +++ b/src/kru.gui/kru.gui.csproj @@ -34,5 +34,4 @@ Always - \ No newline at end of file diff --git a/src/kru.gui/kru.gui.csproj.user b/src/kru.gui/kru.gui.csproj.user deleted file mode 100644 index 03d5f0d..000000000 --- a/src/kru.gui/kru.gui.csproj.user +++ /dev/null @@ -1,8 +0,0 @@ - - - - - Form - - - \ No newline at end of file diff --git a/src/kru.sln b/src/kru.sln index 498a6c6..b54721d 100644 --- a/src/kru.sln +++ b/src/kru.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.5.33209.295 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}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU