diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index ef1ea55..b0b5483 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -75,11 +75,11 @@ this.LoadedMusicBox = new System.Windows.Forms.ListBox(); this.tabPage3 = new System.Windows.Forms.TabPage(); this.panel4 = new System.Windows.Forms.Panel(); + this.groupBox10 = new System.Windows.Forms.GroupBox(); this.groupBox9 = new System.Windows.Forms.GroupBox(); this.TjaEncShiftJIS = new System.Windows.Forms.RadioButton(); this.TjaEncUTF8 = new System.Windows.Forms.RadioButton(); this.TjaEncAuto = new System.Windows.Forms.RadioButton(); - this.groupBox10 = new System.Windows.Forms.GroupBox(); this.AddSilenceBox = new System.Windows.Forms.CheckBox(); this.FeedbackBox = new System.Windows.Forms.TextBox(); this.CreateBackButton = new System.Windows.Forms.Button(); @@ -90,6 +90,8 @@ this.TJASelector = new TaikoSoundEditor.PathSelector(); this.AudioFileSelector = new TaikoSoundEditor.PathSelector(); this.label10 = new System.Windows.Forms.Label(); + this.SilenceBox = new System.Windows.Forms.NumericUpDown(); + this.label3 = new System.Windows.Forms.Label(); this.TabControl.SuspendLayout(); this.tabPage1.SuspendLayout(); this.panel1.SuspendLayout(); @@ -110,8 +112,9 @@ this.groupBox3.SuspendLayout(); this.tabPage3.SuspendLayout(); this.panel4.SuspendLayout(); - this.groupBox9.SuspendLayout(); this.groupBox10.SuspendLayout(); + this.groupBox9.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.SilenceBox)).BeginInit(); this.SuspendLayout(); // // TabControl @@ -656,6 +659,30 @@ this.panel4.Size = new System.Drawing.Size(374, 318); this.panel4.TabIndex = 2; // + // groupBox10 + // + this.groupBox10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox10.Controls.Add(this.label3); + this.groupBox10.Controls.Add(this.SilenceBox); + this.groupBox10.Controls.Add(this.groupBox9); + this.groupBox10.Controls.Add(this.AddSilenceBox); + this.groupBox10.Controls.Add(this.FeedbackBox); + this.groupBox10.Controls.Add(this.CreateBackButton); + this.groupBox10.Controls.Add(this.CreateOkButton); + this.groupBox10.Controls.Add(this.label2); + this.groupBox10.Controls.Add(this.SongNameBox); + this.groupBox10.Controls.Add(this.label9); + this.groupBox10.Controls.Add(this.TJASelector); + this.groupBox10.Controls.Add(this.AudioFileSelector); + this.groupBox10.Controls.Add(this.label10); + this.groupBox10.Location = new System.Drawing.Point(3, 3); + this.groupBox10.Name = "groupBox10"; + this.groupBox10.Size = new System.Drawing.Size(368, 312); + this.groupBox10.TabIndex = 8; + this.groupBox10.TabStop = false; + this.groupBox10.Text = "Create new sound"; + // // groupBox9 // this.groupBox9.Controls.Add(this.TjaEncShiftJIS); @@ -702,46 +729,24 @@ this.TjaEncAuto.Text = "Auto"; this.TjaEncAuto.UseVisualStyleBackColor = true; // - // groupBox10 - // - this.groupBox10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox10.Controls.Add(this.groupBox9); - this.groupBox10.Controls.Add(this.AddSilenceBox); - this.groupBox10.Controls.Add(this.FeedbackBox); - this.groupBox10.Controls.Add(this.CreateBackButton); - this.groupBox10.Controls.Add(this.CreateOkButton); - this.groupBox10.Controls.Add(this.label2); - this.groupBox10.Controls.Add(this.SongNameBox); - this.groupBox10.Controls.Add(this.label9); - this.groupBox10.Controls.Add(this.TJASelector); - this.groupBox10.Controls.Add(this.AudioFileSelector); - this.groupBox10.Controls.Add(this.label10); - this.groupBox10.Location = new System.Drawing.Point(3, 3); - this.groupBox10.Name = "groupBox10"; - this.groupBox10.Size = new System.Drawing.Size(368, 293); - this.groupBox10.TabIndex = 8; - this.groupBox10.TabStop = false; - this.groupBox10.Text = "Create new sound"; - // // AddSilenceBox // this.AddSilenceBox.AutoSize = true; - this.AddSilenceBox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.AddSilenceBox.Checked = true; this.AddSilenceBox.CheckState = System.Windows.Forms.CheckState.Checked; this.AddSilenceBox.Location = new System.Drawing.Point(7, 153); this.AddSilenceBox.Name = "AddSilenceBox"; - this.AddSilenceBox.Size = new System.Drawing.Size(143, 19); + this.AddSilenceBox.Size = new System.Drawing.Size(121, 19); this.AddSilenceBox.TabIndex = 19; - this.AddSilenceBox.Text = "Delay before song (3s)"; + this.AddSilenceBox.Text = "Delay before song"; this.AddSilenceBox.UseVisualStyleBackColor = true; + this.AddSilenceBox.CheckedChanged += new System.EventHandler(this.AddSilenceBox_CheckedChanged); // // FeedbackBox // this.FeedbackBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.FeedbackBox.Location = new System.Drawing.Point(7, 209); + this.FeedbackBox.Location = new System.Drawing.Point(7, 228); this.FeedbackBox.Multiline = true; this.FeedbackBox.Name = "FeedbackBox"; this.FeedbackBox.Size = new System.Drawing.Size(356, 78); @@ -750,7 +755,7 @@ // CreateBackButton // this.CreateBackButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.CreateBackButton.Location = new System.Drawing.Point(206, 173); + this.CreateBackButton.Location = new System.Drawing.Point(206, 199); this.CreateBackButton.Name = "CreateBackButton"; this.CreateBackButton.Size = new System.Drawing.Size(75, 23); this.CreateBackButton.TabIndex = 17; @@ -761,7 +766,7 @@ // CreateOkButton // this.CreateOkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.CreateOkButton.Location = new System.Drawing.Point(287, 173); + this.CreateOkButton.Location = new System.Drawing.Point(287, 199); this.CreateOkButton.Name = "CreateOkButton"; this.CreateOkButton.Size = new System.Drawing.Size(75, 23); this.CreateOkButton.TabIndex = 16; @@ -834,6 +839,32 @@ this.label10.TabIndex = 8; this.label10.Text = "Audio file"; // + // SilenceBox + // + this.SilenceBox.Location = new System.Drawing.Point(133, 152); + this.SilenceBox.Maximum = new decimal(new int[] { + 10, + 0, + 0, + 0}); + this.SilenceBox.Name = "SilenceBox"; + this.SilenceBox.Size = new System.Drawing.Size(42, 23); + this.SilenceBox.TabIndex = 20; + this.SilenceBox.Value = new decimal(new int[] { + 3, + 0, + 0, + 0}); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(181, 154); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(50, 15); + this.label3.TabIndex = 21; + this.label3.Text = "seconds"; + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); @@ -867,10 +898,11 @@ this.groupBox3.ResumeLayout(false); this.tabPage3.ResumeLayout(false); this.panel4.ResumeLayout(false); - this.groupBox9.ResumeLayout(false); - this.groupBox9.PerformLayout(); this.groupBox10.ResumeLayout(false); this.groupBox10.PerformLayout(); + this.groupBox9.ResumeLayout(false); + this.groupBox9.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.SilenceBox)).EndInit(); this.ResumeLayout(false); } @@ -939,5 +971,7 @@ private RadioButton TjaEncShiftJIS; private RadioButton TjaEncUTF8; private RadioButton TjaEncAuto; + private NumericUpDown SilenceBox; + private Label label3; } } \ No newline at end of file diff --git a/MainForm.cs b/MainForm.cs index e14f4b4..9469bcd 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -92,9 +92,9 @@ namespace TaikoSoundEditor Logger.Warning("The following files could not be found:\n\n" + String.Join("\n", NotFoundFiles)); MessageBox.Show("The following files could not be found:\n\n" + String.Join("\n", NotFoundFiles)); } - }); + }); - private void OkButton_Click(object sender, EventArgs e) => RunGuard(() => + private void OkButton_Click(object sender, EventArgs e) => RunGuard(() => { Logger.Info($"Clicked 'Looks good' "); @@ -102,7 +102,7 @@ namespace TaikoSoundEditor { MusicAttributes = Json.Deserialize(GZ.DecompressString(MusicAttributePath)); } - catch(Exception ex) + catch (Exception ex) { throw new Exception($"Failed to parse\n{MusicAttributePath}\nReason:\n{ex.InnerException}"); } @@ -135,9 +135,8 @@ namespace TaikoSoundEditor LoadedMusicBinding = new BindingSource(); LoadedMusicBinding.DataSource = MusicInfos.Items.Where(mi => mi.UniqueId != 0).ToList(); - LoadedMusicBox.DataSource = LoadedMusicBinding; + LoadedMusicBox.DataSource = LoadedMusicBinding; TabControl.SelectedIndex = 1; - }); BindingSource LoadedMusicBinding; @@ -288,7 +287,7 @@ namespace TaikoSoundEditor File.WriteAllText("tja.txt", tja.ToString()); - var seconds = AddSilenceBox.Checked ? (int)Math.Ceiling(tja.Headers.Offset + 3) : 0; + var seconds = AddSilenceBox.Checked ? (int)Math.Ceiling(tja.Headers.Offset + (int)SilenceBox.Value) : 0; if (seconds < 0) seconds = 0; @@ -759,5 +758,10 @@ namespace TaikoSoundEditor return; } }); + + private void AddSilenceBox_CheckedChanged(object sender, EventArgs e) + { + SilenceBox.Enabled = AddSilenceBox.Checked; + } } } \ No newline at end of file diff --git a/Properties/PublishProfiles/FolderProfile.pubxml.user b/Properties/PublishProfiles/FolderProfile.pubxml.user index 498734d..b1a73b2 100644 --- a/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - True|2023-07-22T09:07:26.2620601Z;True|2023-07-22T12:06:39.9230498+03:00;True|2023-07-22T11:29:18.0153916+03:00;True|2023-07-22T08:23:07.5000923+03:00;True|2023-07-21T20:03:15.6598520+03:00;True|2023-07-21T19:41:13.2800435+03:00;True|2023-07-19T13:08:33.4726289+03:00;True|2023-07-19T12:08:17.2430335+03:00;True|2023-07-18T09:38:50.7615921+03:00;True|2023-07-18T09:25:23.0403589+03:00;True|2023-07-17T17:57:08.1469738+03:00;True|2023-07-17T11:28:41.9554245+03:00;True|2023-07-17T11:15:26.2194507+03:00; + True|2023-07-22T16:07:39.3718711Z;True|2023-07-22T19:06:41.2393088+03:00;True|2023-07-22T12:07:26.2620601+03:00;True|2023-07-22T12:06:39.9230498+03:00;True|2023-07-22T11:29:18.0153916+03:00;True|2023-07-22T08:23:07.5000923+03:00;True|2023-07-21T20:03:15.6598520+03:00;True|2023-07-21T19:41:13.2800435+03:00;True|2023-07-19T13:08:33.4726289+03:00;True|2023-07-19T12:08:17.2430335+03:00;True|2023-07-18T09:38:50.7615921+03:00;True|2023-07-18T09:25:23.0403589+03:00;True|2023-07-17T17:57:08.1469738+03:00;True|2023-07-17T11:28:41.9554245+03:00;True|2023-07-17T11:15:26.2194507+03:00; \ No newline at end of file diff --git a/TaikoSoundEditor.csproj b/TaikoSoundEditor.csproj index a2fa521..add3f0a 100644 --- a/TaikoSoundEditor.csproj +++ b/TaikoSoundEditor.csproj @@ -31,6 +31,60 @@ + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest diff --git a/Utils/Number.cs b/Utils/Number.cs index 01efb7e..97f33b9 100644 --- a/Utils/Number.cs +++ b/Utils/Number.cs @@ -16,7 +16,7 @@ namespace TaikoSoundEditor.Utils } catch(FormatException ex) { - throw new FormatException($"{ex.Message} : {value} to int", ex); + throw new FormatException($"{ex.Message} : '{value ?? ""}' to int", ex); } }