1
0
mirror of synced 2024-11-27 21:10:48 +01:00

fixed TJA Shift-JIS issue

This commit is contained in:
NotImplementedLife 2023-07-21 20:02:02 +03:00
parent b030ac6c38
commit e793cc6c10
6 changed files with 51 additions and 28 deletions

42
MainForm.Designer.cs generated
View File

@ -86,6 +86,7 @@
this.TJASelector = new TaikoSoundEditor.PathSelector(); this.TJASelector = new TaikoSoundEditor.PathSelector();
this.AudioFileSelector = new TaikoSoundEditor.PathSelector(); this.AudioFileSelector = new TaikoSoundEditor.PathSelector();
this.label10 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label();
this.ShiftJisBox = new System.Windows.Forms.CheckBox();
this.TabControl.SuspendLayout(); this.TabControl.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
@ -646,15 +647,16 @@
// //
this.panel4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.panel4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.panel4.Controls.Add(this.groupBox10); this.panel4.Controls.Add(this.groupBox10);
this.panel4.Location = new System.Drawing.Point(151, 102); this.panel4.Location = new System.Drawing.Point(151, 76);
this.panel4.Name = "panel4"; this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(374, 292); this.panel4.Size = new System.Drawing.Size(374, 318);
this.panel4.TabIndex = 2; this.panel4.TabIndex = 2;
// //
// groupBox10 // groupBox10
// //
this.groupBox10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.groupBox10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox10.Controls.Add(this.ShiftJisBox);
this.groupBox10.Controls.Add(this.AddSilenceBox); this.groupBox10.Controls.Add(this.AddSilenceBox);
this.groupBox10.Controls.Add(this.FeedbackBox); this.groupBox10.Controls.Add(this.FeedbackBox);
this.groupBox10.Controls.Add(this.CreateBackButton); this.groupBox10.Controls.Add(this.CreateBackButton);
@ -667,7 +669,7 @@
this.groupBox10.Controls.Add(this.label10); this.groupBox10.Controls.Add(this.label10);
this.groupBox10.Location = new System.Drawing.Point(3, 3); this.groupBox10.Location = new System.Drawing.Point(3, 3);
this.groupBox10.Name = "groupBox10"; this.groupBox10.Name = "groupBox10";
this.groupBox10.Size = new System.Drawing.Size(368, 247); this.groupBox10.Size = new System.Drawing.Size(368, 271);
this.groupBox10.TabIndex = 8; this.groupBox10.TabIndex = 8;
this.groupBox10.TabStop = false; this.groupBox10.TabStop = false;
this.groupBox10.Text = "Create new sound"; this.groupBox10.Text = "Create new sound";
@ -678,7 +680,7 @@
this.AddSilenceBox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.AddSilenceBox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.AddSilenceBox.Checked = true; this.AddSilenceBox.Checked = true;
this.AddSilenceBox.CheckState = System.Windows.Forms.CheckState.Checked; this.AddSilenceBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.AddSilenceBox.Location = new System.Drawing.Point(6, 102); this.AddSilenceBox.Location = new System.Drawing.Point(6, 128);
this.AddSilenceBox.Name = "AddSilenceBox"; this.AddSilenceBox.Name = "AddSilenceBox";
this.AddSilenceBox.Size = new System.Drawing.Size(143, 19); this.AddSilenceBox.Size = new System.Drawing.Size(143, 19);
this.AddSilenceBox.TabIndex = 19; this.AddSilenceBox.TabIndex = 19;
@ -689,7 +691,7 @@
// //
this.FeedbackBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) this.FeedbackBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.FeedbackBox.Location = new System.Drawing.Point(6, 162); this.FeedbackBox.Location = new System.Drawing.Point(6, 186);
this.FeedbackBox.Multiline = true; this.FeedbackBox.Multiline = true;
this.FeedbackBox.Name = "FeedbackBox"; this.FeedbackBox.Name = "FeedbackBox";
this.FeedbackBox.Size = new System.Drawing.Size(356, 78); this.FeedbackBox.Size = new System.Drawing.Size(356, 78);
@ -698,7 +700,7 @@
// CreateBackButton // CreateBackButton
// //
this.CreateBackButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.CreateBackButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.CreateBackButton.Location = new System.Drawing.Point(205, 122); this.CreateBackButton.Location = new System.Drawing.Point(205, 148);
this.CreateBackButton.Name = "CreateBackButton"; this.CreateBackButton.Name = "CreateBackButton";
this.CreateBackButton.Size = new System.Drawing.Size(75, 23); this.CreateBackButton.Size = new System.Drawing.Size(75, 23);
this.CreateBackButton.TabIndex = 17; this.CreateBackButton.TabIndex = 17;
@ -709,7 +711,7 @@
// CreateOkButton // CreateOkButton
// //
this.CreateOkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.CreateOkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.CreateOkButton.Location = new System.Drawing.Point(286, 122); this.CreateOkButton.Location = new System.Drawing.Point(286, 148);
this.CreateOkButton.Name = "CreateOkButton"; this.CreateOkButton.Name = "CreateOkButton";
this.CreateOkButton.Size = new System.Drawing.Size(75, 23); this.CreateOkButton.Size = new System.Drawing.Size(75, 23);
this.CreateOkButton.TabIndex = 16; this.CreateOkButton.TabIndex = 16;
@ -720,7 +722,7 @@
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 76); this.label2.Location = new System.Drawing.Point(6, 102);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(67, 15); this.label2.Size = new System.Drawing.Size(67, 15);
this.label2.TabIndex = 15; this.label2.TabIndex = 15;
@ -730,7 +732,7 @@
// //
this.SongNameBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.SongNameBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.SongNameBox.Location = new System.Drawing.Point(79, 73); this.SongNameBox.Location = new System.Drawing.Point(79, 99);
this.SongNameBox.Name = "SongNameBox"; this.SongNameBox.Name = "SongNameBox";
this.SongNameBox.Size = new System.Drawing.Size(283, 23); this.SongNameBox.Size = new System.Drawing.Size(283, 23);
this.SongNameBox.TabIndex = 14; this.SongNameBox.TabIndex = 14;
@ -739,7 +741,7 @@
// label9 // label9
// //
this.label9.AutoSize = true; this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(6, 48); this.label9.Location = new System.Drawing.Point(6, 74);
this.label9.Name = "label9"; this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(43, 15); this.label9.Size = new System.Drawing.Size(43, 15);
this.label9.TabIndex = 13; this.label9.TabIndex = 13;
@ -750,7 +752,7 @@
this.TJASelector.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.TJASelector.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.TJASelector.Filter = ".tja files(*.tja)|*.tja|All files(*.*)|*.*"; this.TJASelector.Filter = ".tja files(*.tja)|*.tja|All files(*.*)|*.*";
this.TJASelector.Location = new System.Drawing.Point(79, 44); this.TJASelector.Location = new System.Drawing.Point(79, 70);
this.TJASelector.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.TJASelector.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.TJASelector.Name = "TJASelector"; this.TJASelector.Name = "TJASelector";
this.TJASelector.Path = ""; this.TJASelector.Path = "";
@ -765,7 +767,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.AudioFileSelector.Filter = "OGG files(*.ogg)|*.ogg|mp3 files(*.mp3)|*.mp3|WAV files(*.wav)|*.wav|All files(*." + this.AudioFileSelector.Filter = "OGG files(*.ogg)|*.ogg|mp3 files(*.mp3)|*.mp3|WAV files(*.wav)|*.wav|All files(*." +
"*)|*.*"; "*)|*.*";
this.AudioFileSelector.Location = new System.Drawing.Point(79, 15); this.AudioFileSelector.Location = new System.Drawing.Point(79, 41);
this.AudioFileSelector.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.AudioFileSelector.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.AudioFileSelector.Name = "AudioFileSelector"; this.AudioFileSelector.Name = "AudioFileSelector";
this.AudioFileSelector.Path = ""; this.AudioFileSelector.Path = "";
@ -776,12 +778,25 @@
// label10 // label10
// //
this.label10.AutoSize = true; this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(6, 19); this.label10.Location = new System.Drawing.Point(6, 45);
this.label10.Name = "label10"; this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(58, 15); this.label10.Size = new System.Drawing.Size(58, 15);
this.label10.TabIndex = 8; this.label10.TabIndex = 8;
this.label10.Text = "Audio file"; this.label10.Text = "Audio file";
// //
// ShiftJisBox
//
this.ShiftJisBox.AutoSize = true;
this.ShiftJisBox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.ShiftJisBox.Checked = true;
this.ShiftJisBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.ShiftJisBox.Location = new System.Drawing.Point(6, 16);
this.ShiftJisBox.Name = "ShiftJisBox";
this.ShiftJisBox.Size = new System.Drawing.Size(194, 19);
this.ShiftJisBox.TabIndex = 20;
this.ShiftJisBox.Text = "Read TJA with Shift JIS Encoding";
this.ShiftJisBox.UseVisualStyleBackColor = true;
//
// MainForm // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@ -881,5 +896,6 @@
private CheckBox AddSilenceBox; private CheckBox AddSilenceBox;
private CheckBox DatatableSpaces; private CheckBox DatatableSpaces;
private Button RemoveSongButton; private Button RemoveSongButton;
private CheckBox ShiftJisBox;
} }
} }

View File

@ -280,7 +280,7 @@ namespace TaikoSoundEditor
FeedbackBox.AppendText("Parsing TJA\r\n"); FeedbackBox.AppendText("Parsing TJA\r\n");
Logger.Info("Parsing TJA"); Logger.Info("Parsing TJA");
var tja = new TJA(File.ReadAllLines(tjaPath)); var tja = ShiftJisBox.Checked ? TJA.ReadAsShiftJIS(tjaPath) : TJA.ReadAsDefault(tjaPath);
File.WriteAllText("tja.txt", tja.ToString()); File.WriteAllText("tja.txt", tja.ToString());

View File

@ -1,5 +1,6 @@
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Text;
namespace TaikoSoundEditor namespace TaikoSoundEditor
{ {
@ -11,17 +12,7 @@ namespace TaikoSoundEditor
[STAThread] [STAThread]
static void Main() static void Main()
{ {
try Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
{
int x = 0;
int y = 2 / x;
}
catch(Exception e)
{
Debug.WriteLine(e);
}
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture; CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
ApplicationConfiguration.Initialize(); ApplicationConfiguration.Initialize();
Application.Run(new MainForm()); Application.Run(new MainForm());

View File

@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
--> -->
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<History>True|2023-07-19T10:08:33.4726289Z;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;</History> <History>True|2023-07-21T16:41:13.2800435Z;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;</History>
<LastFailureDetails /> <LastFailureDetails />
</PropertyGroup> </PropertyGroup>
</Project> </Project>

12
TJA.cs
View File

@ -660,5 +660,17 @@ namespace TaikoSoundEditor
Beat = beat; Beat = beat;
} }
} }
public static TJA ReadAsDefault(string path)
{
var lines = File.ReadAllLines(path);
return new TJA(lines);
}
public static TJA ReadAsShiftJIS(string path)
{
var lines = File.ReadAllLines(path, Encoding.GetEncoding("shift_jis"));
return new TJA(lines);
}
} }
} }

View File

@ -11,6 +11,10 @@
<Version>0.3</Version> <Version>0.3</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Properties\Resources.Designer.cs"> <Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>