1
0
mirror of synced 2025-01-29 19:17:25 +01:00

boxdefを修正 (#485)

This commit is contained in:
Takkkom 2023-08-18 17:56:41 +09:00 committed by GitHub
parent a2b8f92046
commit cec94ccb58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,80 +83,88 @@ namespace TJAPlayer3
} }
char[] ignoreChars = new char[] { ':', ' ', '\t' }; char[] ignoreChars = new char[] { ':', ' ', '\t' };
if (str.StartsWith(langTITLE, StringComparison.OrdinalIgnoreCase))
var split = str.Split(':');
if (split.Length == 2)
{ {
this.Title = str.Substring(8).Trim(ignoreChars); string key = split[0];
string value = split[1];
if (key == langTITLE)
{
this.Title = value.Trim(ignoreChars);
} }
else if(str.StartsWith("#TITLE", StringComparison.OrdinalIgnoreCase)) else if (key == "#TITLE")
{ {
if (this.Title == "") this.Title = str.Substring(6).Trim(ignoreChars); if (this.Title == "") this.Title = value.Trim(ignoreChars);
} }
else if( str.StartsWith( "#GENRE", StringComparison.OrdinalIgnoreCase ) ) else if (key == "#GENRE")
{ {
this.Genre = str.Substring( 6 ).Trim( ignoreChars ); this.Genre = value.Trim(ignoreChars);
} }
else if (str.StartsWith("#SELECTBG", StringComparison.OrdinalIgnoreCase)) else if (key == "#SELECTBG")
{ {
this.SelectBG = str.Substring(9).Trim(ignoreChars); this.SelectBG = value.Trim(ignoreChars);
} }
else if ( str.StartsWith( "#FONTCOLOR", StringComparison.OrdinalIgnoreCase ) ) else if (key == "#FONTCOLOR")
{ {
this.Color = ColorTranslator.FromHtml( str.Substring( 10 ).Trim( ignoreChars ) ); this.Color = ColorTranslator.FromHtml(value.Trim(ignoreChars));
} }
else if (str.StartsWith("#FORECOLOR", StringComparison.OrdinalIgnoreCase)) else if (key == "#FORECOLOR")
{ {
this.ForeColor = ColorTranslator.FromHtml(str.Substring(10).Trim(ignoreChars)); this.ForeColor = ColorTranslator.FromHtml(value.Trim(ignoreChars));
IsChangedForeColor = true; IsChangedForeColor = true;
} }
else if (str.StartsWith("#BACKCOLOR", StringComparison.OrdinalIgnoreCase)) else if (key == "#BACKCOLOR")
{ {
this.BackColor = ColorTranslator.FromHtml(str.Substring(10).Trim(ignoreChars)); this.BackColor = ColorTranslator.FromHtml(value.Trim(ignoreChars));
IsChangedBackColor = true; IsChangedBackColor = true;
} }
else if (str.StartsWith("#BOXCOLOR", StringComparison.OrdinalIgnoreCase)) else if (key == "#BOXCOLOR")
{ {
this.BoxColor = ColorTranslator.FromHtml(str.Substring(9).Trim(ignoreChars)); this.BoxColor = ColorTranslator.FromHtml(value.Trim(ignoreChars));
IsChangedBoxColor = true; IsChangedBoxColor = true;
} }
else if (str.StartsWith("#BGCOLOR", StringComparison.OrdinalIgnoreCase)) else if (key == "#BGCOLOR")
{ {
this.BgColor = ColorTranslator.FromHtml(str.Substring(8).Trim(ignoreChars)); this.BgColor = ColorTranslator.FromHtml(value.Trim(ignoreChars));
IsChangedBgColor = true; IsChangedBgColor = true;
} }
else if (str.StartsWith("#BGTYPE", StringComparison.OrdinalIgnoreCase)) else if (key == "#BGTYPE")
{ {
this.BgType = int.Parse(str.Substring(7).Trim(ignoreChars)); this.BgType = int.Parse(value.Trim(ignoreChars));
IsChangedBgType = true; IsChangedBgType = true;
} }
else if (str.StartsWith("#BOXTYPE", StringComparison.OrdinalIgnoreCase)) else if (key == "#BOXTYPE")
{ {
this.BoxType = int.Parse(str.Substring(8).Trim(ignoreChars)); this.BoxType = int.Parse(value.Trim(ignoreChars));
IsChangedBoxType = true; IsChangedBoxType = true;
} }
else if (str.StartsWith("#BOXCHARA", StringComparison.OrdinalIgnoreCase)) else if (key == "#BOXCHARA")
{ {
this.BoxChara = int.Parse(str.Substring(9).Trim(ignoreChars)); this.BoxChara = int.Parse(value.Trim(ignoreChars));
IsChangedBoxChara = true; IsChangedBoxChara = true;
} }
else if (str.StartsWith("#SCENEPRESET", StringComparison.OrdinalIgnoreCase)) else if (key == "#SCENEPRESET")
{ {
this.ScenePreset = str.Substring(12).Trim(ignoreChars); this.ScenePreset = value.Trim(ignoreChars);
} }
else if (str.StartsWith("#DEFAULTPREIMAGE", StringComparison.OrdinalIgnoreCase)) else if (key == "#DEFAULTPREIMAGE")
{ {
this.DefaultPreimage = Path.Combine(Directory.GetParent(boxdefファイル名).FullName, str.Substring(16).Trim(ignoreChars)); this.DefaultPreimage = Path.Combine(Directory.GetParent(boxdefファイル名).FullName, value.Trim(ignoreChars));
} }
else else
{ {
for(int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
if (str.StartsWith(langBOXEXPLANATION + (i + 1).ToString(), StringComparison.OrdinalIgnoreCase)) if (key == langBOXEXPLANATION + (i + 1).ToString())
{ {
this.strBoxText[i] = str.Substring(18).Trim(ignoreChars); this.strBoxText[i] = value.Trim(ignoreChars);
} }
else if (str.StartsWith("#BOXEXPLANATION" + (i + 1).ToString(), StringComparison.OrdinalIgnoreCase)) else if (key == "#BOXEXPLANATION" + (i + 1).ToString())
{ {
if (this.strBoxText[i] == "") this.strBoxText[i] = str.Substring(16).Trim(ignoreChars); if (this.strBoxText[i] == "") this.strBoxText[i] = value.Trim(ignoreChars);
}
} }
} }
} }