+++ /dev/null
-using System;\r
-using System.Collections.Generic;\r
-using System.Text;\r
-using System.Drawing;\r
-using System.IO;\r
-using System.Diagnostics;\r
-\r
-namespace DTXMania\r
-{\r
- public class CSetDef\r
- {\r
- // プロパティ\r
-\r
- public List<CBlock> blocks;\r
- public class CBlock\r
- {\r
- /// <summary>\r
- /// このブロックが有効である(何かのプロパティがセットされた)場合、true を示す。\r
- /// </summary>\r
- public bool b使用中 { get; set; }\r
-\r
- /// <summary>\r
- /// スコアファイル名(#LxFILE)を保持する。配列は [0~4] で、存在しないレベルは null となる。\r
- /// </summary>\r
- public string[] File\r
- {\r
- get\r
- {\r
- return this._file;\r
- }\r
- set // ここには来ない( Label[xx] にsetすると、結局Labelのgetが呼ばれるだけで、Labelのsetは呼ばれない)\r
- {\r
- this._file = value;\r
- this.b使用中 = true;\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// スコアのフォント色(#FONTCOLOR)を保持する。\r
- /// </summary>\r
- public Color FontColor\r
- {\r
- get\r
- {\r
- return this._fontcolor;\r
- }\r
- set\r
- {\r
- this._fontcolor = value;\r
- this.b使用中 = true;\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// スコアのジャンル名を保持する。(現在は使われていない。)\r
- /// </summary>\r
- public string Genre\r
- {\r
- get\r
- {\r
- return this._genre;\r
- }\r
- set\r
- {\r
- this._genre = value;\r
- this.b使用中 = true;\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// スコアのラベル(#LxLABEL)を保持する。配列は[0~4] で、存在しないレベルは null となる。\r
- /// </summary>\r
- public string[] Label\r
- {\r
- get\r
- {\r
- return this._label;\r
- }\r
- set // ここには来ない( Label[xx] にsetすると、結局Labelのgetが呼ばれるだけで、Labelのsetは呼ばれない)\r
- {\r
- this._label = value;\r
- this.b使用中 = true;\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// スコアのタイトル(#TITLE)を保持する。\r
- /// </summary>\r
- public string Title\r
- {\r
- get\r
- {\r
- return this._title;\r
- }\r
- set\r
- {\r
- this._title = value;\r
- this.b使用中 = true;\r
- }\r
- }\r
-\r
- #region [ private ]\r
- //-----------------\r
- private string[] _file = new string[5];\r
- private Color _fontcolor = Color.White;\r
- private string _genre = "";\r
- private string[] _label = new string[5];\r
- private string _title = "";\r
- //-----------------\r
- #endregion\r
- }\r
-\r
-\r
- // コンストラクタ\r
-\r
- public CSetDef()\r
- {\r
- this.blocks = new List<CBlock>();\r
- }\r
- public CSetDef(string setdefファイル名)\r
- : this()\r
- {\r
- this.t読み込み(setdefファイル名);\r
- }\r
-\r
-\r
- // メソッド\r
-\r
- public void t読み込み(string setdefファイル名)\r
- {\r
- var reader = new StreamReader(setdefファイル名, Encoding.GetEncoding("Shift_JIS"));\r
- CBlock block = new CBlock();\r
- string str = null;\r
- while ((str = reader.ReadLine()) != null)\r
- {\r
- if (str.Length != 0)\r
- {\r
- try\r
- {\r
- str = str.TrimStart(new char[] { ' ', '\t' });\r
- if ((str.Length > 0) && (str[0] == '#') && (str[0] != ';'))\r
- {\r
- if (str.IndexOf(';') != -1)\r
- {\r
- str = str.Substring(0, str.IndexOf(';'));\r
- }\r
- if (str.StartsWith("#TITLE", StringComparison.OrdinalIgnoreCase))\r
- {\r
- if (block.b使用中)\r
- {\r
- this.tFILEの指定があるのにLxLABELが省略されているときはデフォルトの名前をセットする(block);\r
- this.tLxLABELの指定があるのにFILEが省略されているときはなかったものとする(block);\r
- this.blocks.Add(block);\r
- block = new CBlock();\r
- }\r
- block.Title = str.Substring(6).TrimStart(new char[] { ':', ' ', '\t' });\r
- }\r
- else if (str.StartsWith("#FONTCOLOR", StringComparison.OrdinalIgnoreCase))\r
- {\r
- block.FontColor = ColorTranslator.FromHtml("#" + str.Substring(10).Trim(new char[] { ':', '#', ' ', '\t' }));\r
- }\r
- else if (str.StartsWith("#L1FILE", StringComparison.OrdinalIgnoreCase))\r
- {\r
- block.File[0] = str.Substring(7).Trim(new char[] { ':', ' ', '\t' });\r
- 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
- }\r
- else if (str.StartsWith("#L2FILE", StringComparison.OrdinalIgnoreCase))\r
- {\r
- block.File[1] = str.Substring(7).Trim(new char[] { ':', ' ', '\t' });\r
- 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
- }\r
- else if (str.StartsWith("#L3FILE", StringComparison.OrdinalIgnoreCase))\r
- {\r
- block.File[2] = str.Substring(7).Trim(new char[] { ':', ' ', '\t' });\r
- 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
- }\r
- else if (str.StartsWith("#L4FILE", StringComparison.OrdinalIgnoreCase))\r
- {\r
- block.File[3] = str.Substring(7).Trim(new char[] { ':', ' ', '\t' });\r
- 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
- }\r
- else if (str.StartsWith("#L5FILE", StringComparison.OrdinalIgnoreCase))\r
- {\r
- block.File[4] = str.Substring(7).Trim(new char[] { ':', ' ', '\t' });\r
- 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
- }\r
- else if (str.StartsWith("#L1LABEL", StringComparison.OrdinalIgnoreCase))\r
- {\r
- block.Label[0] = str.Substring(8).Trim(new char[] { ':', ' ', '\t' });\r
- 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
- }\r
- else if (str.StartsWith("#L2LABEL", StringComparison.OrdinalIgnoreCase))\r
- {\r
- block.Label[1] = str.Substring(8).Trim(new char[] { ':', ' ', '\t' });\r
- 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
- }\r
- else if (str.StartsWith("#L3LABEL", StringComparison.OrdinalIgnoreCase))\r
- {\r
- block.Label[2] = str.Substring(8).Trim(new char[] { ':', ' ', '\t' });\r
- 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
- }\r
- else if (str.StartsWith("#L4LABEL", StringComparison.OrdinalIgnoreCase))\r
- {\r
- block.Label[3] = str.Substring(8).Trim(new char[] { ':', ' ', '\t' });\r
- 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
- }\r
- else if (str.StartsWith("#L5LABEL", StringComparison.OrdinalIgnoreCase))\r
- {\r
- block.Label[4] = str.Substring(8).Trim(new char[] { ':', ' ', '\t' });\r
- 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
- }\r
- }\r
- continue;\r
- }\r
- catch\r
- {\r
- continue;\r
- }\r
- }\r
- }\r
- reader.Close();\r
- if (block.b使用中)\r
- {\r
- this.tFILEの指定があるのにLxLABELが省略されているときはデフォルトの名前をセットする(block);\r
- this.tLxLABELの指定があるのにFILEが省略されているときはなかったものとする(block);\r
- this.blocks.Add(block);\r
- }\r
- }\r
-\r
-\r
- // その他\r
-\r
- #region [ private ]\r
- //-----------------\r
- private void tFILEの指定があるのにLxLABELが省略されているときはデフォルトの名前をセットする(CBlock block)\r
- {\r
- string[] strArray = new string[] { "BASIC", "ADVANCED", "EXTREME", "HYPER", "ULTIMATE" };\r
- for (int i = 0; i < 5; i++)\r
- {\r
- if (((block.File[i] != null) && (block.File[i].Length > 0)) && string.IsNullOrEmpty(block.Label[i]))\r
- {\r
- block.Label[i] = strArray[i];\r
- }\r
- }\r
- }\r
- private void tLxLABELの指定があるのにFILEが省略されているときはなかったものとする(CBlock block)\r
- {\r
- for (int i = 0; i < 5; i++)\r
- {\r
- if (((block.Label[i] != null) && (block.Label[i].Length > 0)) && string.IsNullOrEmpty(block.File[i]))\r
- {\r
- block.Label[i] = "";\r
- }\r
- }\r
- }\r
- //-----------------\r
- #endregion\r
- }\r
-}\r