/// <summary> /// 指定された .score.ini を読み込む。内容の真偽は判定しない。 /// </summary> /// <param name="iniファイル名">読み込む .score.ini ファイルを指定します(絶対パスが安全)。</param> public void t読み込み(string iniファイル名) { this.iniファイルのあるフォルダ名 = Path.GetDirectoryName(iniファイル名); this.iniファイル名 = Path.GetFileName(iniファイル名); Eセクション種別 section = Eセクション種別.Unknown; if (File.Exists(iniファイル名)) { string str; Encoding inienc = TJAPlayer3.JudgeTextEncoding.JudgeFileEncoding(iniファイル名); StreamReader reader = new StreamReader(iniファイル名, inienc); while ((str = reader.ReadLine()) != null) { str = str.Replace('\t', ' ').TrimStart(new char[] { '\t', ' ' }); if ((str.Length != 0) && (str[0] != ';')) { try { string item; string para; C演奏記録 c演奏記録; #region [ section ] if (str[0] == '[') { StringBuilder builder = new StringBuilder(0x20); int num = 1; while ((num < str.Length) && (str[num] != ']')) { builder.Append(str[num++]); } string str2 = builder.ToString(); if (str2.Equals("File")) { section = Eセクション種別.File; } else if (str2.Equals("HiScore.Drums")) { section = Eセクション種別.HiScoreDrums; } else if (str2.Equals("HiSkill.Drums")) { section = Eセクション種別.HiSkillDrums; } // #23595 2011.1.9 ikanick else if (str2.Equals("LastPlay.Drums")) { section = Eセクション種別.LastPlayDrums; } //---------------------------------------------------- else { section = Eセクション種別.Unknown; } } #endregion else { string[] strArray = str.Split(new char[] { '=' }); if (strArray.Length == 2) { item = strArray[0].Trim(); para = strArray[1].Trim(); switch (section) { case Eセクション種別.File: { if (!item.Equals("Title")) { goto Label_01C7; } this.stファイル.Title = para; continue; } case Eセクション種別.HiScoreDrums: case Eセクション種別.HiSkillDrums: case Eセクション種別.LastPlayDrums: // #23595 2011.1.9 ikanick { c演奏記録 = this.stセクション[(int)section]; if (!item.Equals("Score")) { goto Label_03B9; } c演奏記録.nスコア = long.Parse(para); continue; } } } } continue; #region [ File section ] Label_01C7: if (item.Equals("Name")) { this.stファイル.Name = para; } else if (item.Equals("Hash")) { this.stファイル.Hash = para; } else if (item.Equals("PlayCountDrums")) { this.stファイル.PlayCountDrums = C変換.n値を文字列から取得して範囲内に丸めて返す(para, 0, 99999999, 0); } // #23596 10.11.16 add ikanick------------------------------------/ else if (item.Equals("ClearCountDrums")) { this.stファイル.ClearCountDrums = C変換.n値を文字列から取得して範囲内に丸めて返す(para, 0, 99999999, 0); } // #24459 2011.2.24 yyagi-----------------------------------------/ else if (item.Equals("BestRankDrums")) { this.stファイル.BestRank = C変換.n値を文字列から取得して範囲内に丸めて返す(para, (int)ERANK.SS, (int)ERANK.E, (int)ERANK.UNKNOWN); } //----------------------------------------------------------------/ else if (item.Equals("History0")) { this.stファイル.History[0] = para; } else if (item.Equals("History1")) { this.stファイル.History[1] = para; } else if (item.Equals("History2")) { this.stファイル.History[2] = para; } else if (item.Equals("History3")) { this.stファイル.History[3] = para; } else if (item.Equals("History4")) { this.stファイル.History[4] = para; } else if (item.Equals("HistoryCount")) { this.stファイル.HistoryCount = C変換.n値を文字列から取得して範囲内に丸めて返す(para, 0, 99999999, 0); } else if (item.Equals("BGMAdjust")) { this.stファイル.BGMAdjust = C変換.n値を文字列から取得して返す(para, 0); } continue; #endregion #region [ Score section ] Label_03B9: if (item.Equals("HiScore1")) { c演奏記録.nハイスコア[0] = int.Parse(para); } else if (item.Equals("HiScore2")) { c演奏記録.nハイスコア[1] = int.Parse(para); } else if (item.Equals("HiScore3")) { c演奏記録.nハイスコア[2] = int.Parse(para); } else if (item.Equals("HiScore4")) { c演奏記録.nハイスコア[3] = int.Parse(para); } else if (item.Equals("HiScore5")) { c演奏記録.nハイスコア[4] = int.Parse(para); } else if (item.Equals("HiScore6")) { c演奏記録.nハイスコア[5] = int.Parse(para); } else if (item.Equals("HiScore7")) { c演奏記録.nハイスコア[6] = int.Parse(para); } if (item.Equals("PlaySkill")) { try { c演奏記録.db演奏型スキル値 = (double)decimal.Parse(para); } catch { c演奏記録.db演奏型スキル値 = 0.0; } } else if (item.Equals("Skill")) { try { c演奏記録.dbゲーム型スキル値 = (double)decimal.Parse(para); } catch { c演奏記録.dbゲーム型スキル値 = 0.0; } } else if (item.Equals("Perfect")) { c演奏記録.nPerfect数 = int.Parse(para); } else if (item.Equals("Great")) { c演奏記録.nGreat数 = int.Parse(para); } else if (item.Equals("Good")) { c演奏記録.nGood数 = int.Parse(para); } else if (item.Equals("Poor")) { c演奏記録.nPoor数 = int.Parse(para); } else if (item.Equals("Miss")) { c演奏記録.nMiss数 = int.Parse(para); } else if (item.Equals("Roll")) { c演奏記録.n連打数 = int.Parse(para); } else if (item.Equals("MaxCombo")) { c演奏記録.n最大コンボ数 = int.Parse(para); } else if (item.Equals("TotalChips")) { c演奏記録.n全チップ数 = int.Parse(para); } else if (item.Equals("Risky")) { c演奏記録.nRisky = int.Parse(para); } else if (item.Equals("TightDrums")) { c演奏記録.bTight = C変換.bONorOFF(para[0]); } #endregion else { #region [ ScrollSpeedDrums ] if (item.Equals("ScrollSpeedDrums")) { c演奏記録.f譜面スクロール速度 = (float)decimal.Parse(para); } #endregion #region [ PlaySpeed ] else if (item.Equals("PlaySpeed")) { string[] strArray2 = para.Split(new char[] { '/' }); if (strArray2.Length == 2) { c演奏記録.n演奏速度分子 = int.Parse(strArray2[0]); c演奏記録.n演奏速度分母 = int.Parse(strArray2[1]); } } #endregion else { #region [ Drums ] if (item.Equals("Drums")) { c演奏記録.bDrums有効 = C変換.bONorOFF(para[0]); } #endregion #region [ StageFailed ] else if (item.Equals("StageFailed")) { c演奏記録.bSTAGEFAILED有効 = C変換.bONorOFF(para[0]); } #endregion else { #region [ DamageLevel ] if (item.Equals("DamageLevel")) { switch (int.Parse(para)) { case 0: { c演奏記録.eダメージレベル = Eダメージレベル.少ない; continue; } case 1: { c演奏記録.eダメージレベル = Eダメージレベル.普通; continue; } case 2: { c演奏記録.eダメージレベル = Eダメージレベル.大きい; continue; } } throw new Exception("DamageLevel の値が無効です。"); } #endregion if (item.Equals("UseKeyboard")) { c演奏記録.b演奏にキーボードを使用した = C変換.bONorOFF(para[0]); } else if (item.Equals("UseMIDIIN")) { c演奏記録.b演奏にMIDI入力を使用した = C変換.bONorOFF(para[0]); } else if (item.Equals("UseJoypad")) { c演奏記録.b演奏にジョイパッドを使用した = C変換.bONorOFF(para[0]); } else if (item.Equals("UseMouse")) { c演奏記録.b演奏にマウスを使用した = C変換.bONorOFF(para[0]); } else if (item.Equals("PerfectRange")) { c演奏記録.nPerfectになる範囲ms = int.Parse(para); } else if (item.Equals("GreatRange")) { c演奏記録.nGreatになる範囲ms = int.Parse(para); } else if (item.Equals("GoodRange")) { c演奏記録.nGoodになる範囲ms = int.Parse(para); } else if (item.Equals("PoorRange")) { c演奏記録.nPoorになる範囲ms = int.Parse(para); } else if (item.Equals("DTXManiaVersion")) { c演奏記録.strDTXManiaのバージョン = para; } else if (item.Equals("DateTime")) { c演奏記録.最終更新日時 = para; } else if (item.Equals("Hash")) { c演奏記録.Hash = para; } else if (item.Equals("9LaneMode")) { c演奏記録.レーン9モード = C変換.bONorOFF(para[0]); } else if (item.Equals("HiScore1")) { c演奏記録.nハイスコア[0] = int.Parse(para); } else if (item.Equals("HiScore2")) { c演奏記録.nハイスコア[1] = int.Parse(para); } else if (item.Equals("HiScore3")) { c演奏記録.nハイスコア[2] = int.Parse(para); } else if (item.Equals("HiScore4")) { c演奏記録.nハイスコア[3] = int.Parse(para); } else if (item.Equals("HiScore5")) { c演奏記録.nハイスコア[4] = int.Parse(para); } else if (item.Equals("HiScore6")) { c演奏記録.nハイスコア[5] = int.Parse(para); } else if (item.Equals("HiScore7")) { c演奏記録.nハイスコア[6] = int.Parse(para); } else if (item.Equals("Crown1")) { c演奏記録.n王冠[0] = int.Parse(para); } else if (item.Equals("Crown2")) { c演奏記録.n王冠[1] = int.Parse(para); } else if (item.Equals("Crown3")) { c演奏記録.n王冠[2] = int.Parse(para); } else if (item.Equals("Crown4")) { c演奏記録.n王冠[3] = int.Parse(para); } else if (item.Equals("Crown5")) { c演奏記録.n王冠[4] = int.Parse(para); } else if (item.Equals("Crown6")) { c演奏記録.n王冠[5] = int.Parse(para); } else if (item.Equals("Crown7")) { c演奏記録.n王冠[6] = int.Parse(para); } } } } continue; } catch (Exception exception) { Trace.TraceError(exception.ToString()); Trace.TraceError("読み込みを中断します。({0})", iniファイル名); break; } } } reader.Close(); } }
// メソッド /// <summary> /// <para>現在の this.Record[] オブジェクトの、指定されたセクションの情報が正当であるか否かを判定する。 /// 真偽どちらでも、その内容は書き換えない。</para> /// </summary> /// <param name="eセクション">判定するセクション。</param> /// <returns>正当である(整合性がある)場合は true。</returns> public bool b整合性がある(Eセクション種別 eセクション) { return(true); // オープンソース化に伴い、整合性チェックを無効化。(2010.10.21) }