2 using System.Collections.Generic;
\r
4 using System.Drawing;
\r
13 public List<CBlock> blocks;
\r
17 /// このブロックが有効である(何かのプロパティがセットされた)場合、true を示す。
\r
19 public bool b使用中 { get; private set; }
\r
22 /// スコアファイル名(#LxFILE)を保持する。配列は [0~4] で、存在しないレベルは null となる。
\r
24 public string[] File
\r
38 /// スコアのフォント色(#FONTCOLOR)を保持する。
\r
40 public Color FontColor
\r
44 return this._fontcolor;
\r
48 this._fontcolor = value;
\r
54 /// スコアのジャンル名を保持する。(現在は使われていない。)
\r
64 this._genre = value;
\r
70 /// スコアのラベル(#LxLABEL)を保持する。配列は[0~4] で、存在しないレベルは null となる。
\r
72 public string[] Label
\r
80 this._label = value;
\r
86 /// スコアのタイトル(#TITLE)を保持する。
\r
96 this._title = value;
\r
101 #region [ private ]
\r
102 //-----------------
\r
103 private string[] _file = new string[ 5 ];
\r
104 private Color _fontcolor = Color.White;
\r
105 private string _genre = "";
\r
106 private string[] _label = new string[ 5 ];
\r
107 private string _title = "";
\r
108 //-----------------
\r
117 this.blocks = new List<CBlock>();
\r
119 public CSetDef( string setdefファイル名 )
\r
122 this.t読み込み( setdefファイル名 );
\r
128 public void t読み込み( string setdefファイル名 )
\r
130 var reader = new StreamReader( setdefファイル名, Encoding.GetEncoding( "shift-jis" ) );
\r
131 CBlock block = new CBlock();
\r
133 while( ( str = reader.ReadLine() ) != null )
\r
135 if( str.Length != 0 )
\r
139 str = str.TrimStart( new char[] { ' ', '\t' } );
\r
140 if( ( str[ 0 ] == '#' ) && ( str[ 0 ] != ';' ) )
\r
142 if( str.IndexOf( ';' ) != -1 )
\r
144 str = str.Substring( 0, str.IndexOf( ';' ) );
\r
146 if( str.StartsWith( "#TITLE", StringComparison.OrdinalIgnoreCase ) )
\r
150 this.tFILEの指定があるのにLxLABELが省略されているときはデフォルトの名前をセットする( block );
\r
151 this.tLxLABELの指定があるのにFILEが省略されているときはなかったものとする( block );
\r
152 this.blocks.Add( block );
\r
153 block = new CBlock();
\r
155 block.Title = str.Substring( 6 ).TrimStart( new char[] { ':', ' ', '\t' } );
\r
157 else if( str.StartsWith( "#FONTCOLOR", StringComparison.OrdinalIgnoreCase ) )
\r
159 block.FontColor = ColorTranslator.FromHtml( "#" + str.Substring( 10 ).Trim( new char[] { ':', '#', ' ', '\t' } ) );
\r
161 else if( str.StartsWith( "#L1FILE", StringComparison.OrdinalIgnoreCase ) )
\r
163 block.File[ 0 ] = str.Substring( 7 ).Trim( new char[] { ':', ' ', '\t' } );
\r
165 else if( str.StartsWith( "#L2FILE", StringComparison.OrdinalIgnoreCase ) )
\r
167 block.File[ 1 ] = str.Substring( 7 ).Trim( new char[] { ':', ' ', '\t' } );
\r
169 else if( str.StartsWith( "#L3FILE", StringComparison.OrdinalIgnoreCase ) )
\r
171 block.File[ 2 ] = str.Substring( 7 ).Trim( new char[] { ':', ' ', '\t' } );
\r
173 else if( str.StartsWith( "#L4FILE", StringComparison.OrdinalIgnoreCase ) )
\r
175 block.File[ 3 ] = str.Substring( 7 ).Trim( new char[] { ':', ' ', '\t' } );
\r
177 else if( str.StartsWith( "#L5FILE", StringComparison.OrdinalIgnoreCase ) )
\r
179 block.File[ 4 ] = str.Substring( 7 ).Trim( new char[] { ':', ' ', '\t' } );
\r
181 else if( str.StartsWith( "#L1LABEL", StringComparison.OrdinalIgnoreCase ) )
\r
183 block.Label[ 0 ] = str.Substring( 8 ).Trim( new char[] { ':', ' ', '\t' } );
\r
185 else if( str.StartsWith( "#L2LABEL", StringComparison.OrdinalIgnoreCase ) )
\r
187 block.Label[ 1 ] = str.Substring( 8 ).Trim( new char[] { ':', ' ', '\t' } );
\r
189 else if( str.StartsWith( "#L3LABEL", StringComparison.OrdinalIgnoreCase ) )
\r
191 block.Label[ 2 ] = str.Substring( 8 ).Trim( new char[] { ':', ' ', '\t' } );
\r
193 else if( str.StartsWith( "#L4LABEL", StringComparison.OrdinalIgnoreCase ) )
\r
195 block.Label[ 3 ] = str.Substring( 8 ).Trim( new char[] { ':', ' ', '\t' } );
\r
197 else if( str.StartsWith( "#L5LABEL", StringComparison.OrdinalIgnoreCase ) )
\r
199 block.Label[ 4 ] = str.Substring( 8 ).Trim( new char[] { ':', ' ', '\t' } );
\r
213 this.tFILEの指定があるのにLxLABELが省略されているときはデフォルトの名前をセットする( block );
\r
214 this.tLxLABELの指定があるのにFILEが省略されているときはなかったものとする( block );
\r
215 this.blocks.Add( block );
\r
222 #region [ private ]
\r
223 //-----------------
\r
224 private void tFILEの指定があるのにLxLABELが省略されているときはデフォルトの名前をセットする( CBlock block )
\r
226 string[] strArray = new string[] { "BASIC", "ADVANCED", "EXTREME", "HYPER", "ULTIMATE" };
\r
227 for( int i = 0; i < 5; i++ )
\r
229 if( ( ( block.File[ i ] != null ) && ( block.File[ i ].Length > 0 ) ) && string.IsNullOrEmpty( block.Label[ i ] ) )
\r
231 block.Label[ i ] = strArray[ i ];
\r
235 private void tLxLABELの指定があるのにFILEが省略されているときはなかったものとする( CBlock block )
\r
237 for( int i = 0; i < 5; i++ )
\r
239 if( ( ( block.Label[ i ] != null ) && ( block.Label[ i ].Length > 0 ) ) && string.IsNullOrEmpty( block.File[ i ] ) )
\r
241 block.Label[ i ] = "";
\r
245 //-----------------
\r