2 using System.Collections.Generic;
\r
4 using System.Drawing;
\r
6 using System.Diagnostics;
\r
10 public class CSetDef
\r
14 public List<CBlock> blocks;
\r
18 /// このブロックが有効である(何かのプロパティがセットされた)場合、true を示す。
\r
20 public bool b使用中 { get; set; }
\r
23 /// スコアファイル名(#LxFILE)を保持する。配列は [0~4] で、存在しないレベルは null となる。
\r
25 public string[] File
\r
31 set // ここには来ない( Label[xx] にsetすると、結局Labelのgetが呼ばれるだけで、Labelのsetは呼ばれない)
\r
39 /// スコアのフォント色(#FONTCOLOR)を保持する。
\r
41 public Color FontColor
\r
45 return this._fontcolor;
\r
49 this._fontcolor = value;
\r
55 /// スコアのジャンル名を保持する。(現在は使われていない。)
\r
65 this._genre = value;
\r
71 /// スコアのラベル(#LxLABEL)を保持する。配列は[0~4] で、存在しないレベルは null となる。
\r
73 public string[] Label
\r
79 set // ここには来ない( Label[xx] にsetすると、結局Labelのgetが呼ばれるだけで、Labelのsetは呼ばれない)
\r
81 this._label = value;
\r
87 /// スコアのタイトル(#TITLE)を保持する。
\r
97 this._title = value;
\r
102 #region [ private ]
\r
103 //-----------------
\r
104 private string[] _file = new string[5];
\r
105 private Color _fontcolor = Color.White;
\r
106 private string _genre = "";
\r
107 private string[] _label = new string[5];
\r
108 private string _title = "";
\r
109 //-----------------
\r
118 this.blocks = new List<CBlock>();
\r
120 public CSetDef(string setdefファイル名)
\r
123 this.t読み込み(setdefファイル名);
\r
129 public void t読み込み(string setdefファイル名)
\r
131 var reader = new StreamReader(setdefファイル名, Encoding.GetEncoding("Shift_JIS"));
\r
132 CBlock block = new CBlock();
\r
134 while ((str = reader.ReadLine()) != null)
\r
136 if (str.Length != 0)
\r
140 str = str.TrimStart(new char[] { ' ', '\t' });
\r
141 if ((str.Length > 0) && (str[0] == '#') && (str[0] != ';'))
\r
143 if (str.IndexOf(';') != -1)
\r
145 str = str.Substring(0, str.IndexOf(';'));
\r
147 if (str.StartsWith("#TITLE", StringComparison.OrdinalIgnoreCase))
\r
151 this.tFILEの指定があるのにLxLABELが省略されているときはデフォルトの名前をセットする(block);
\r
152 this.tLxLABELの指定があるのにFILEが省略されているときはなかったものとする(block);
\r
153 this.blocks.Add(block);
\r
154 block = new CBlock();
\r
156 block.Title = str.Substring(6).TrimStart(new char[] { ':', ' ', '\t' });
\r
158 else if (str.StartsWith("#FONTCOLOR", StringComparison.OrdinalIgnoreCase))
\r
160 block.FontColor = ColorTranslator.FromHtml("#" + str.Substring(10).Trim(new char[] { ':', '#', ' ', '\t' }));
\r
162 else if (str.StartsWith("#L1FILE", StringComparison.OrdinalIgnoreCase))
\r
164 block.File[0] = str.Substring(7).Trim(new char[] { ':', ' ', '\t' });
\r
165 block.b使用中 = true; // #28937 2012.7.7 yyagi; "get" accessor is called for T[] property. So b使用中 is not modified to set the property. I need to update it myself.
\r
167 else if (str.StartsWith("#L2FILE", StringComparison.OrdinalIgnoreCase))
\r
169 block.File[1] = str.Substring(7).Trim(new char[] { ':', ' ', '\t' });
\r
170 block.b使用中 = true; // #28937 2012.7.7 yyagi; "get" accessor is called for T[] property. So b使用中 is not modified to set the property. I need to update it myself.
\r
172 else if (str.StartsWith("#L3FILE", StringComparison.OrdinalIgnoreCase))
\r
174 block.File[2] = str.Substring(7).Trim(new char[] { ':', ' ', '\t' });
\r
175 block.b使用中 = true; // #28937 2012.7.7 yyagi; "get" accessor is called for T[] property. So b使用中 is not modified to set the property. I need to update it myself.
\r
177 else if (str.StartsWith("#L4FILE", StringComparison.OrdinalIgnoreCase))
\r
179 block.File[3] = str.Substring(7).Trim(new char[] { ':', ' ', '\t' });
\r
180 block.b使用中 = true; // #28937 2012.7.7 yyagi; "get" accessor is called for T[] property. So b使用中 is not modified to set the property. I need to update it myself.
\r
182 else if (str.StartsWith("#L5FILE", StringComparison.OrdinalIgnoreCase))
\r
184 block.File[4] = str.Substring(7).Trim(new char[] { ':', ' ', '\t' });
\r
185 block.b使用中 = true; // #28937 2012.7.7 yyagi; "get" accessor is called for T[] property. So b使用中 is not modified to set the property. I need to update it myself.
\r
187 else if (str.StartsWith("#L1LABEL", StringComparison.OrdinalIgnoreCase))
\r
189 block.Label[0] = str.Substring(8).Trim(new char[] { ':', ' ', '\t' });
\r
190 block.b使用中 = true; // #28937 2012.7.7 yyagi; "get" accessor is called for T[] property. So b使用中 is not modified to set the property. I need to update it myself.
\r
192 else if (str.StartsWith("#L2LABEL", StringComparison.OrdinalIgnoreCase))
\r
194 block.Label[1] = str.Substring(8).Trim(new char[] { ':', ' ', '\t' });
\r
195 block.b使用中 = true; // #28937 2012.7.7 yyagi; "get" accessor is called for T[] property. So b使用中 is not modified to set the property. I need to update it myself.
\r
197 else if (str.StartsWith("#L3LABEL", StringComparison.OrdinalIgnoreCase))
\r
199 block.Label[2] = str.Substring(8).Trim(new char[] { ':', ' ', '\t' });
\r
200 block.b使用中 = true; // #28937 2012.7.7 yyagi; "get" accessor is called for T[] property. So b使用中 is not modified to set the property. I need to update it myself.
\r
202 else if (str.StartsWith("#L4LABEL", StringComparison.OrdinalIgnoreCase))
\r
204 block.Label[3] = str.Substring(8).Trim(new char[] { ':', ' ', '\t' });
\r
205 block.b使用中 = true; // #28937 2012.7.7 yyagi; "get" accessor is called for T[] property. So b使用中 is not modified to set the property. I need to update it myself.
\r
207 else if (str.StartsWith("#L5LABEL", StringComparison.OrdinalIgnoreCase))
\r
209 block.Label[4] = str.Substring(8).Trim(new char[] { ':', ' ', '\t' });
\r
210 block.b使用中 = true; // #28937 2012.7.7 yyagi; "get" accessor is called for T[] property. So b使用中 is not modified to set the property. I need to update it myself.
\r
224 this.tFILEの指定があるのにLxLABELが省略されているときはデフォルトの名前をセットする(block);
\r
225 this.tLxLABELの指定があるのにFILEが省略されているときはなかったものとする(block);
\r
226 this.blocks.Add(block);
\r
233 #region [ private ]
\r
234 //-----------------
\r
235 private void tFILEの指定があるのにLxLABELが省略されているときはデフォルトの名前をセットする(CBlock block)
\r
237 string[] strArray = new string[] { "BASIC", "ADVANCED", "EXTREME", "HYPER", "ULTIMATE" };
\r
238 for (int i = 0; i < 5; i++)
\r
240 if (((block.File[i] != null) && (block.File[i].Length > 0)) && string.IsNullOrEmpty(block.Label[i]))
\r
242 block.Label[i] = strArray[i];
\r
246 private void tLxLABELの指定があるのにFILEが省略されているときはなかったものとする(CBlock block)
\r
248 for (int i = 0; i < 5; i++)
\r
250 if (((block.Label[i] != null) && (block.Label[i].Length > 0)) && string.IsNullOrEmpty(block.File[i]))
\r
252 block.Label[i] = "";
\r
256 //-----------------
\r