2021-09-21 00:16:38 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
|
|
|
|
namespace TJAPlayer3
|
|
|
|
|
{
|
|
|
|
|
internal class CBoxDef
|
|
|
|
|
{
|
|
|
|
|
// プロパティ
|
|
|
|
|
|
|
|
|
|
public Color Color;
|
2023-02-28 22:44:30 +01:00
|
|
|
|
public string SelectBG;
|
2021-09-21 00:16:38 +02:00
|
|
|
|
public string Genre;
|
|
|
|
|
public string Title;
|
|
|
|
|
public string[] strBoxText = new string[3];
|
|
|
|
|
public Color ForeColor;
|
|
|
|
|
public Color BackColor;
|
|
|
|
|
public bool IsChangedForeColor;
|
|
|
|
|
public bool IsChangedBackColor;
|
2021-10-18 02:32:30 +02:00
|
|
|
|
public Color BoxColor;
|
|
|
|
|
public bool IsChangedBoxColor;
|
2021-10-19 03:54:45 +02:00
|
|
|
|
public Color BgColor;
|
|
|
|
|
public bool IsChangedBgColor;
|
|
|
|
|
public int BoxType;
|
|
|
|
|
public int BgType;
|
|
|
|
|
public bool IsChangedBoxType;
|
|
|
|
|
public bool IsChangedBgType;
|
2021-10-23 11:53:04 +02:00
|
|
|
|
public int BoxChara;
|
|
|
|
|
public bool IsChangedBoxChara;
|
2021-09-21 00:16:38 +02:00
|
|
|
|
|
|
|
|
|
// コンストラクタ
|
|
|
|
|
|
|
|
|
|
public CBoxDef()
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
|
this.strBoxText[i] = "";
|
|
|
|
|
this.Title = "";
|
|
|
|
|
this.Genre = "";
|
|
|
|
|
ForeColor = Color.White;
|
|
|
|
|
BackColor = Color.Black;
|
2021-10-18 02:32:30 +02:00
|
|
|
|
BoxColor = Color.White;
|
2021-10-19 03:54:45 +02:00
|
|
|
|
BoxType = 0;
|
|
|
|
|
BgType = 0;
|
2021-10-23 11:53:04 +02:00
|
|
|
|
BoxChara = 0;
|
2021-10-19 03:54:45 +02:00
|
|
|
|
BgColor = Color.White;
|
2021-09-21 00:16:38 +02:00
|
|
|
|
}
|
|
|
|
|
public CBoxDef( string boxdefファイル名 )
|
|
|
|
|
: this()
|
|
|
|
|
{
|
|
|
|
|
this.t読み込み( boxdefファイル名 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// メソッド
|
|
|
|
|
|
|
|
|
|
public void t読み込み( string boxdefファイル名 )
|
|
|
|
|
{
|
2021-11-23 01:29:44 +01:00
|
|
|
|
StreamReader reader = new StreamReader( boxdefファイル名, Encoding.GetEncoding(TJAPlayer3.sEncType) );
|
2021-09-21 00:16:38 +02:00
|
|
|
|
string str = null;
|
|
|
|
|
while( ( str = reader.ReadLine() ) != null )
|
|
|
|
|
{
|
|
|
|
|
if( str.Length != 0 )
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
char[] ignoreCharsWoColon = new char[] { ' ', '\t' };
|
|
|
|
|
|
|
|
|
|
str = str.TrimStart( ignoreCharsWoColon );
|
|
|
|
|
if( ( str[ 0 ] == '#' ) && ( str[ 0 ] != ';' ) )
|
|
|
|
|
{
|
|
|
|
|
if( str.IndexOf( ';' ) != -1 )
|
|
|
|
|
{
|
|
|
|
|
str = str.Substring( 0, str.IndexOf( ';' ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char[] ignoreChars = new char[] { ':', ' ', '\t' };
|
|
|
|
|
|
|
|
|
|
if ( str.StartsWith( "#TITLE", StringComparison.OrdinalIgnoreCase ) )
|
|
|
|
|
{
|
|
|
|
|
this.Title = str.Substring( 6 ).Trim( ignoreChars );
|
|
|
|
|
}
|
|
|
|
|
else if( str.StartsWith( "#GENRE", StringComparison.OrdinalIgnoreCase ) )
|
|
|
|
|
{
|
|
|
|
|
this.Genre = str.Substring( 6 ).Trim( ignoreChars );
|
|
|
|
|
}
|
2023-02-28 22:44:30 +01:00
|
|
|
|
else if (str.StartsWith("#SELECTBG", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
this.SelectBG = str.Substring(9).Trim(ignoreChars);
|
|
|
|
|
}
|
2021-09-21 00:16:38 +02:00
|
|
|
|
else if ( str.StartsWith( "#FONTCOLOR", StringComparison.OrdinalIgnoreCase ) )
|
|
|
|
|
{
|
|
|
|
|
this.Color = ColorTranslator.FromHtml( str.Substring( 10 ).Trim( ignoreChars ) );
|
|
|
|
|
}
|
|
|
|
|
else if (str.StartsWith("#FORECOLOR", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
this.ForeColor = ColorTranslator.FromHtml(str.Substring(10).Trim(ignoreChars));
|
|
|
|
|
IsChangedForeColor = true;
|
|
|
|
|
}
|
|
|
|
|
else if (str.StartsWith("#BACKCOLOR", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
this.BackColor = ColorTranslator.FromHtml(str.Substring(10).Trim(ignoreChars));
|
|
|
|
|
IsChangedBackColor = true;
|
|
|
|
|
}
|
2021-10-18 02:32:30 +02:00
|
|
|
|
else if (str.StartsWith("#BOXCOLOR", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
2021-10-19 03:54:45 +02:00
|
|
|
|
this.BoxColor = ColorTranslator.FromHtml(str.Substring(9).Trim(ignoreChars));
|
2021-10-18 02:32:30 +02:00
|
|
|
|
IsChangedBoxColor = true;
|
|
|
|
|
}
|
2021-10-19 03:54:45 +02:00
|
|
|
|
else if (str.StartsWith("#BGCOLOR", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
this.BgColor = ColorTranslator.FromHtml(str.Substring(8).Trim(ignoreChars));
|
|
|
|
|
IsChangedBgColor = true;
|
|
|
|
|
}
|
|
|
|
|
else if (str.StartsWith("#BGTYPE", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
this.BgType = int.Parse(str.Substring(7).Trim(ignoreChars));
|
|
|
|
|
IsChangedBgType = true;
|
|
|
|
|
}
|
|
|
|
|
else if (str.StartsWith("#BOXTYPE", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
this.BoxType = int.Parse(str.Substring(8).Trim(ignoreChars));
|
|
|
|
|
IsChangedBoxType = true;
|
|
|
|
|
}
|
2021-10-23 11:53:04 +02:00
|
|
|
|
else if (str.StartsWith("#BOXCHARA", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
this.BoxChara = int.Parse(str.Substring(9).Trim(ignoreChars));
|
|
|
|
|
IsChangedBoxChara = true;
|
|
|
|
|
}
|
2021-09-21 00:16:38 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < 3; i++)
|
|
|
|
|
{
|
|
|
|
|
if (str.StartsWith("#BOXEXPLANATION" + (i + 1).ToString(), StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
this.strBoxText[i] = str.Substring(16).Trim(ignoreChars);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Trace.TraceError( e.ToString() );
|
|
|
|
|
Trace.TraceError( "例外が発生しましたが処理を継続します。 (178a9a36-a59e-4264-8e4c-b3c3459db43c)" );
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
2021-10-19 03:54:45 +02:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
if (!IsChangedBoxType)
|
|
|
|
|
{
|
|
|
|
|
this.BoxType = this.nStrジャンルtoNum(this.Genre);
|
|
|
|
|
}
|
|
|
|
|
if (!IsChangedBgType)
|
|
|
|
|
{
|
|
|
|
|
this.BgType = this.nStrジャンルtoNum(this.Genre);
|
|
|
|
|
}
|
|
|
|
|
*/
|
2021-09-21 00:16:38 +02:00
|
|
|
|
}
|
2021-10-19 03:54:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-21 00:16:38 +02:00
|
|
|
|
}
|
|
|
|
|
}
|