2 using System.Collections.Generic;
4 using System.Diagnostics;
6 using System.Threading;
12 public class CDTXVmode
58 /// DTXファイルの再読み込みが必要かどうか
60 public bool NeedReload
64 // private set; // 本来はprivate setにすべきだが、デバッグが簡単になるので、しばらくはprivateなしのままにする。
70 public ECommand Command
76 public ESoundDeviceType soundDeviceType
81 public int nASIOdevice
87 /// 前回からサウンドデバイスが変更されたか
89 public bool ChangedSoundDevice
95 public string filename
103 public string previewFilename
108 public int previewVolume
113 public int previewPan
123 public bool lastGRmode
128 public bool TimeStretch
133 public bool lastTimeStretch
138 public bool VSyncWait
143 public bool lastVSyncWait
156 this.last_timestamp = DateTime.MinValue;
157 this.Enabled = false;
159 this.Refreshed = false;
160 this.NeedReload = false;
161 this.previewFilename = "";
163 this.lastGRmode = false;
164 this.TimeStretch = false;
165 this.lastTimeStretch = false;
166 this.VSyncWait = true;
167 this.lastVSyncWait = true;
171 /// DTXファイルのリロードが必要かどうか判定する
173 /// <param name="filename">DTXファイル名</param>
174 /// <returns>再読込が必要ならtrue</returns>
175 /// <remarks>プロパティNeedReloadにも結果が入る</remarks>
176 /// <remarks>これを呼び出すたびに、Refreshedをtrueにする</remarks>
177 /// <exception cref="FileNotFoundException"></exception>
178 public bool bIsNeedReloadDTX(string filename)
180 if (!File.Exists(filename)) // 指定したファイルが存在しないなら例外終了
182 Trace.TraceError("ファイルが見つかりません。({0})", filename);
183 this.last_path = filename;
184 throw new FileNotFoundException();
188 this.Refreshed = true;
190 // 前回とファイル名が異なるか、タイムスタンプが更新されているか、
191 // GRmode等の設定を変更したなら、DTX要更新
192 DateTime current_timestamp = File.GetLastWriteTime(filename);
193 if (last_path != filename || current_timestamp > last_timestamp ||
194 this.lastGRmode != this.GRmode || this.lastTimeStretch != this.TimeStretch || this.lastVSyncWait != this.VSyncWait)
196 this.last_path = filename;
197 this.last_timestamp = current_timestamp;
198 this.lastGRmode = this.GRmode;
199 this.lastTimeStretch = this.TimeStretch;
200 this.lastVSyncWait = this.VSyncWait;
202 this.NeedReload = true;
205 this.NeedReload = false;
211 /// Viewer関連の設定のみを更新して、Config.iniに書き出す
213 public void tUpdateConfigIni()
215 /// Viewer関連の設定のみを更新するために、
216 /// 1. 現在のconfig.ini相当の情報を、別変数にコピーしておく
217 /// 2. config.iniを読み込みなおす
218 /// 3. 別変数のコピーから、Viewer関連の設定を、configに入れ込む
219 /// 4. Config.iniを保存する
221 CConfigXml ConfigIni_backup = (CConfigXml) CDTXMania.Instance.ConfigIni.Clone(); // #36612 2016.9.12 yyagi
222 CDTXMania.Instance.LoadConfig();
224 // CConfigIni cc = new CConfigIni();
225 //string path = CDTXMania.Instance.strEXEのあるフォルダ + "Config.ini";
226 //if (File.Exists(path))
228 // FileInfo fi = new FileInfo(path);
229 // if (fi.Length > 0) // Config.iniが0byteだったなら、読み込まない
233 // CDTXMania..tファイルから読み込み(path);
237 // //ConfigIni = new CConfigIni(); // 存在してなければ新規生成
243 for (EPart inst = EPart.Drums; inst <= EPart.Bass; ++inst)
245 CDTXMania.Instance.ConfigIni.nViewerScrollSpeed[inst].Value = ConfigIni_backup.nScrollSpeed[inst];
247 CDTXMania.Instance.ConfigIni.bViewerShowDebugStatus.Value = ConfigIni_backup.bDebugInfo;
248 CDTXMania.Instance.ConfigIni.bViewerVSyncWait.Value = ConfigIni_backup.bVSyncWait;
249 CDTXMania.Instance.ConfigIni.bViewerTimeStretch.Value = ConfigIni_backup.bTimeStretch;
250 CDTXMania.Instance.ConfigIni.bViewerDrumsActive.Value = ConfigIni_backup.bDrums有効;
251 CDTXMania.Instance.ConfigIni.bViewerGuitarActive.Value = ConfigIni_backup.bGuitar有効;
253 CDTXMania.Instance.ConfigIni.rcViewerWindow.W = ConfigIni_backup.rcWindow.W;
254 CDTXMania.Instance.ConfigIni.rcViewerWindow.H = ConfigIni_backup.rcWindow.H;
255 CDTXMania.Instance.ConfigIni.rcViewerWindow.X = ConfigIni_backup.rcWindow.X;
256 CDTXMania.Instance.ConfigIni.rcViewerWindow.Y = ConfigIni_backup.rcWindow.Y;
258 CDTXMania.Instance.SaveConfig();
260 ConfigIni_backup = null;
263 private string last_path;
264 private DateTime last_timestamp;