diff --git a/MoeGoe_GUI/AdvancedWin.cs b/MoeGoe_GUI/AdvancedWin.cs index 57af128..8febbaf 100644 --- a/MoeGoe_GUI/AdvancedWin.cs +++ b/MoeGoe_GUI/AdvancedWin.cs @@ -1,18 +1,11 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; namespace MoeGoe_GUI { public partial class AdvancedWin : Form { - public AdvancedWin(TextBox box,CommandLine cmd) + public AdvancedWin(TextBox box, CommandLine cmd) { InitializeComponent(); parentBox = box; @@ -31,7 +24,7 @@ private void Cmd_OutputHandler(CommandLine sender, string e) private void ConfirmButton_Click(object sender, EventArgs e) { - parentBox.Text = "[CLEANED]"+cleanedBox.Text; + parentBox.Text = "[CLEANED]" + cleanedBox.Text; Close(); } diff --git a/MoeGoe_GUI/LengthWin.Designer.cs b/MoeGoe_GUI/LengthWin.Designer.cs new file mode 100644 index 0000000..a843e69 --- /dev/null +++ b/MoeGoe_GUI/LengthWin.Designer.cs @@ -0,0 +1,114 @@ +namespace MoeGoe_GUI +{ + partial class LengthWin + { + /// + /// 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() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LengthWin)); + this.timesBox = new System.Windows.Forms.NumericUpDown(); + this.confirmButton = new System.Windows.Forms.Button(); + this.timesLabel = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.timesBox)).BeginInit(); + this.SuspendLayout(); + // + // timesBox + // + this.timesBox.DecimalPlaces = 1; + this.timesBox.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.timesBox.Location = new System.Drawing.Point(71, 25); + this.timesBox.Maximum = new decimal(new int[] { + 10, + 0, + 0, + 0}); + this.timesBox.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.timesBox.Name = "timesBox"; + this.timesBox.Size = new System.Drawing.Size(86, 31); + this.timesBox.TabIndex = 0; + this.timesBox.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // confirmButton + // + this.confirmButton.Location = new System.Drawing.Point(71, 76); + this.confirmButton.Name = "confirmButton"; + this.confirmButton.Size = new System.Drawing.Size(120, 35); + this.confirmButton.TabIndex = 4; + this.confirmButton.Text = "确定"; + this.confirmButton.UseVisualStyleBackColor = true; + this.confirmButton.Click += new System.EventHandler(this.ConfirmButton_Click); + // + // timesLabel + // + this.timesLabel.AutoSize = true; + this.timesLabel.Location = new System.Drawing.Point(163, 28); + this.timesLabel.Name = "timesLabel"; + this.timesLabel.Size = new System.Drawing.Size(28, 24); + this.timesLabel.TabIndex = 5; + this.timesLabel.Text = "倍"; + // + // LengthWin + // + this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.ClientSize = new System.Drawing.Size(261, 135); + this.Controls.Add(this.timesLabel); + this.Controls.Add(this.confirmButton); + this.Controls.Add(this.timesBox); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Margin = new System.Windows.Forms.Padding(4); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "LengthWin"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "调整时长"; + ((System.ComponentModel.ISupportInitialize)(this.timesBox)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.NumericUpDown timesBox; + private System.Windows.Forms.Button confirmButton; + private System.Windows.Forms.Label timesLabel; + } +} \ No newline at end of file diff --git a/MoeGoe_GUI/LengthWin.cs b/MoeGoe_GUI/LengthWin.cs new file mode 100644 index 0000000..67fd9d6 --- /dev/null +++ b/MoeGoe_GUI/LengthWin.cs @@ -0,0 +1,40 @@ +using System; +using System.Text.RegularExpressions; +using System.Windows.Forms; + +namespace MoeGoe_GUI +{ + public partial class LengthWin : Form + { + public LengthWin(TextBox box) + { + InitializeComponent(); + this.box = box; + Regex regex = new Regex(@"\[LENGTH=(.+?)\]"); + Match match = regex.Match(box.Text); + if (match.Success) + { + text = regex.Replace(box.Text, ""); + try + { + timesBox.Value = decimal.Parse(match.Groups[1].Value); + } + catch + { + timesBox.Value = 1; + } + } + else + text = box.Text; + } + + private readonly TextBox box; + private readonly string text; + + private void ConfirmButton_Click(object sender, EventArgs e) + { + box.Text = "[LENGTH=" + timesBox.Value.ToString() + "]" + text; + Close(); + } + } +} diff --git a/MoeGoe_GUI/LengthWin.resx b/MoeGoe_GUI/LengthWin.resx new file mode 100644 index 0000000..35ca3f3 --- /dev/null +++ b/MoeGoe_GUI/LengthWin.resx @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAIADxAAAAAAIADwAgAAJgAAABcYAAAAACAAoAQAABYDAACJUE5HDQoaCgAAAA1JSERSAAAADwAA + ABAIBgAAAMlWJQQAAAK3SURBVHicZZPNa5xVFMZ/5977vu98JDMxJmM6pukUQkfFpisXShdZuNBuXCiI + G8G17vwP3LgQdCEFKagr3QhWcKOgo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RI0p+oeHUiescOXCZ5ctWUejuxyd6y7T03P483C1nwdq5LnaZABu24EeuRXJ2z7i0ZPrp + 7OxBicHcaXfvsSwC1nmCALIu5eLiuHqo0FncXY2jKEePaLuKiAX0nmz/S0ZEc61tLkmmkzOXj1wExI2P + n3svn5cnViwsLos1zfeDSkiRkJQ5ef67I9/+9Onhjo7+sgDs3PzqYxtWbn+t1oiKiUZ3wbgfWTFc+evX + 658f/HA/cBIYFlUVEVEgBPLczwPyP0UU24q1G5UbY0DyD3v09pgP+K7BAAAAAElFTkSuQmCC + + + \ No newline at end of file diff --git a/MoeGoe_GUI/MainWin.Designer.cs b/MoeGoe_GUI/MainWin.Designer.cs index 77f9460..66500a1 100644 --- a/MoeGoe_GUI/MainWin.Designer.cs +++ b/MoeGoe_GUI/MainWin.Designer.cs @@ -28,6 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWin)); this.EXEPanel = new System.Windows.Forms.GroupBox(); this.EXEPath = new System.Windows.Forms.TextBox(); @@ -43,6 +44,9 @@ private void InitializeComponent() this.speakerLabel = new System.Windows.Forms.Label(); this.textLabel = new System.Windows.Forms.Label(); this.textBox = new System.Windows.Forms.TextBox(); + this.menuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.cleanButton = new System.Windows.Forms.ToolStripMenuItem(); + this.lengthButton = new System.Windows.Forms.ToolStripMenuItem(); this.VCPage = new System.Windows.Forms.TabPage(); this.openOrigin = new System.Windows.Forms.Button(); this.originPath = new System.Windows.Forms.TextBox(); @@ -58,6 +62,7 @@ private void InitializeComponent() this.modelPanel.SuspendLayout(); this.modeControl.SuspendLayout(); this.TTSPage.SuspendLayout(); + this.menuStrip.SuspendLayout(); this.VCPage.SuspendLayout(); this.savePanel.SuspendLayout(); this.SuspendLayout(); @@ -196,13 +201,36 @@ private void InitializeComponent() // // textBox // + this.textBox.ContextMenuStrip = this.menuStrip; this.textBox.Font = new System.Drawing.Font("Yu Gothic UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); this.textBox.Location = new System.Drawing.Point(129, 10); this.textBox.Multiline = true; this.textBox.Name = "textBox"; this.textBox.Size = new System.Drawing.Size(344, 93); this.textBox.TabIndex = 1; - this.textBox.DoubleClick += new System.EventHandler(this.TextBox_DoubleClick); + // + // menuStrip + // + this.menuStrip.ImageScalingSize = new System.Drawing.Size(24, 24); + this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cleanButton, + this.lengthButton}); + this.menuStrip.Name = "menuStrip"; + this.menuStrip.Size = new System.Drawing.Size(153, 64); + // + // cleanButton + // + this.cleanButton.Name = "cleanButton"; + this.cleanButton.Size = new System.Drawing.Size(152, 30); + this.cleanButton.Text = "清理文本"; + this.cleanButton.Click += new System.EventHandler(this.CleanButton_Click); + // + // lengthButton + // + this.lengthButton.Name = "lengthButton"; + this.lengthButton.Size = new System.Drawing.Size(152, 30); + this.lengthButton.Text = "调整时长"; + this.lengthButton.Click += new System.EventHandler(this.LengthButton_Click); // // VCPage // @@ -342,6 +370,7 @@ private void InitializeComponent() this.modeControl.ResumeLayout(false); this.TTSPage.ResumeLayout(false); this.TTSPage.PerformLayout(); + this.menuStrip.ResumeLayout(false); this.VCPage.ResumeLayout(false); this.VCPage.PerformLayout(); this.savePanel.ResumeLayout(false); @@ -378,6 +407,9 @@ private void InitializeComponent() private System.Windows.Forms.Button saveButton; private System.Windows.Forms.TextBox consoleBox; private System.Windows.Forms.Button openOrigin; + private System.Windows.Forms.ContextMenuStrip menuStrip; + private System.Windows.Forms.ToolStripMenuItem cleanButton; + private System.Windows.Forms.ToolStripMenuItem lengthButton; } } diff --git a/MoeGoe_GUI/MainWin.cs b/MoeGoe_GUI/MainWin.cs index 2f42672..9e18b29 100644 --- a/MoeGoe_GUI/MainWin.cs +++ b/MoeGoe_GUI/MainWin.cs @@ -162,7 +162,6 @@ private void GetStart() { cmd = new CommandLine(); cmd.OutputHandler += Cmd_OutputHandler; - cmd.Write("chcp 65001"); cmd.Write("\"" + EXEPATH + "\""); cmd.Write(MODELPATH); cmd.Write(CONFIGPATH); @@ -275,13 +274,20 @@ private void VC() cmd.Write(targetBox.SelectedIndex.ToString()); } - private void TextBox_DoubleClick(object sender, EventArgs e) + private void CleanButton_Click(object sender, EventArgs e) { - AdvancedWin win = new AdvancedWin(textBox,cmd); + AdvancedWin win = new AdvancedWin(textBox, cmd); cmd.OutputHandler -= Cmd_OutputHandler; win.ShowDialog(); cmd.OutputHandler += Cmd_OutputHandler; win.Dispose(); } + + private void LengthButton_Click(object sender, EventArgs e) + { + LengthWin win = new LengthWin(textBox); + win.ShowDialog(); + win.Dispose(); + } } } diff --git a/MoeGoe_GUI/MainWin.resx b/MoeGoe_GUI/MainWin.resx index 35ca3f3..be4707e 100644 --- a/MoeGoe_GUI/MainWin.resx +++ b/MoeGoe_GUI/MainWin.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + diff --git a/MoeGoe_GUI/MoeGoe_GUI.csproj b/MoeGoe_GUI/MoeGoe_GUI.csproj index e08ef28..4b1233c 100644 --- a/MoeGoe_GUI/MoeGoe_GUI.csproj +++ b/MoeGoe_GUI/MoeGoe_GUI.csproj @@ -73,6 +73,12 @@ AdvancedWin.cs + + Form + + + LengthWin.cs + Form @@ -84,6 +90,9 @@ AdvancedWin.cs + + LengthWin.cs + MainWin.cs