OSDN Git Service

Merge branch 'feature/37178_プロジェクトとソリューションファイルの英語化' into develop
[dtxmania/dtxmania.git] / DTXManiaプロジェクト / コード / ステージ / CDTXVmode.cs
diff --git a/DTXManiaプロジェクト/コード/ステージ/CDTXVmode.cs b/DTXManiaプロジェクト/コード/ステージ/CDTXVmode.cs
deleted file mode 100644 (file)
index c5bc9bb..0000000
+++ /dev/null
@@ -1,437 +0,0 @@
-using System;\r
-using System.Collections.Generic;\r
-using System.Text;\r
-using System.Diagnostics;\r
-using System.IO;\r
-using System.Threading;\r
-using FDK;\r
-\r
-\r
-namespace DTXMania\r
-{\r
-       public class CDTXVmode\r
-       {\r
-               public enum ECommand\r
-               {\r
-                       Stop,\r
-                       Play,\r
-                       Preview\r
-               }\r
-\r
-               /// <summary>\r
-               /// DTXVモードかどうか\r
-               /// </summary>\r
-               public bool Enabled\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               /// <summary>\r
-               /// プレビューサウンドの再生が発生した\r
-               /// </summary>\r
-               public bool Preview\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               /// <summary>\r
-               /// 外部から再指示が発生したか\r
-               /// </summary>\r
-               public bool Refreshed\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               /// <summary>\r
-               /// 演奏開始小節番号\r
-               /// </summary>\r
-               public int nStartBar\r
-               {\r
-                       get;\r
-                       set;\r
-               }\r
-\r
-               /// <summary>\r
-               /// DTXファイルの再読み込みが必要かどうか\r
-               /// </summary>\r
-               public bool NeedReload\r
-               {\r
-                       get;\r
-                       private set;\r
-                       //                      private set;    // 本来はprivate setにすべきだが、デバッグが簡単になるので、しばらくはprivateなしのままにする。\r
-               }\r
-\r
-               /// <summary>\r
-               /// DTXCからのコマンド\r
-               /// </summary>\r
-               public ECommand Command\r
-               {\r
-                       get;\r
-                       private set;\r
-               }\r
-\r
-               public ESoundDeviceType soundDeviceType\r
-               {\r
-                       get;\r
-                       private set;\r
-               }\r
-               public int nASIOdevice\r
-               {\r
-                       get;\r
-                       private set;\r
-               }\r
-               /// <summary>\r
-               /// 前回からサウンドデバイスが変更されたか\r
-               /// </summary>\r
-               public bool ChangedSoundDevice\r
-               {\r
-                       get;\r
-                       private set;\r
-               }\r
-\r
-               public string filename\r
-               {\r
-                       get\r
-                       {\r
-                               return last_path;\r
-                       }\r
-               }\r
-\r
-               public string previewFilename\r
-               {\r
-                       get;\r
-                       private set;\r
-               }\r
-               public int previewVolume\r
-               {\r
-                       get;\r
-                       private set;\r
-               }\r
-               public int previewPan\r
-               {\r
-                       get;\r
-                       private set;\r
-               }\r
-               public bool GRmode\r
-               {\r
-                       get;\r
-                       private set;\r
-               }\r
-               public bool lastGRmode\r
-               {\r
-                       get;\r
-                       private set;\r
-               }\r
-               public bool TimeStretch\r
-               {\r
-                       get;\r
-                       private set;\r
-               }\r
-               public bool lastTimeStretch\r
-               {\r
-                       get;\r
-                       private set;\r
-               }\r
-               public bool VSyncWait\r
-               {\r
-                       get;\r
-                       private set;\r
-               }\r
-               public bool lastVSyncWait\r
-               {\r
-                       get;\r
-                       private set;\r
-               }\r
-\r
-\r
-               /// <summary>\r
-               /// コンストラクタ\r
-               /// </summary>\r
-               public CDTXVmode()\r
-               {\r
-                       this.last_path = "";\r
-                       this.last_timestamp = DateTime.MinValue;\r
-                       this.Enabled = false;\r
-                       this.nStartBar = 0;\r
-                       this.Refreshed = false;\r
-                       this.NeedReload = false;\r
-                       this.previewFilename = "";\r
-                       this.GRmode = false;\r
-                       this.lastGRmode = false;\r
-                       this.TimeStretch = false;\r
-                       this.lastTimeStretch = false;\r
-                       this.VSyncWait = true;\r
-                       this.lastVSyncWait = true;\r
-               }\r
-\r
-               /// <summary>\r
-               /// DTXファイルのリロードが必要かどうか判定する\r
-               /// </summary>\r
-               /// <param name="filename">DTXファイル名</param>\r
-               /// <returns>再読込が必要ならtrue</returns>\r
-               /// <remarks>プロパティNeedReloadにも結果が入る</remarks>\r
-               /// <remarks>これを呼び出すたびに、Refreshedをtrueにする</remarks>\r
-               /// <exception cref="FileNotFoundException"></exception>\r
-               public bool bIsNeedReloadDTX(string filename)\r
-               {\r
-                       if (!File.Exists(filename))     // 指定したファイルが存在しないなら例外終了\r
-                       {\r
-                               Trace.TraceError("ファイルが見つかりません。({0})", filename);\r
-                               throw new FileNotFoundException();\r
-                               //return false;\r
-                       }\r
-\r
-                       this.Refreshed = true;\r
-\r
-                       // 前回とファイル名が異なるか、タイムスタンプが更新されているか、\r
-                       // GRmode等の設定を変更したなら、DTX要更新\r
-                       DateTime current_timestamp = File.GetLastWriteTime(filename);\r
-                       if (last_path != filename || current_timestamp > last_timestamp ||\r
-                               this.lastGRmode != this.GRmode || this.lastTimeStretch != this.TimeStretch || this.lastVSyncWait != this.VSyncWait)\r
-                       {\r
-                               this.last_path = filename;\r
-                               this.last_timestamp = current_timestamp;\r
-                               this.lastGRmode = this.GRmode;\r
-                               this.lastTimeStretch = this.TimeStretch;\r
-                               this.lastVSyncWait = this.VSyncWait;\r
-\r
-                               this.NeedReload = true;\r
-                               return true;\r
-                       }\r
-                       this.NeedReload = false;\r
-                       return false;\r
-               }\r
-\r
-               /// <summary>\r
-               /// \r
-               /// </summary>\r
-               /// <param name="arg"></param>\r
-               /// <param name="nStartBar"></param>\r
-               /// <param name="command"></param>\r
-               /// <returns>DTXV用の引数であればtrue</returns>\r
-               /// <remarks>内部でEnabled, nStartBar, Command, NeedReload, filename, last_path, last_timestampを設定する</remarks>\r
-               public bool ParseArguments(string arg)\r
-               {\r
-                       bool ret = false, analyzing = true;\r
-                       this.nStartBar = 0;\r
-\r
-                       if (arg != null)\r
-                       {\r
-                               while (analyzing)\r
-                               {\r
-                                       if (arg == "")\r
-                                       {\r
-                                               analyzing = false;\r
-                                       }\r
-                                       else if (arg.StartsWith("-V", StringComparison.OrdinalIgnoreCase))    // サウンド再生\r
-                                       {\r
-                                               // -Vvvv,ppp,"filename"の形式。 vvv=volume, ppp=pan.\r
-                                               this.Enabled = true;\r
-                                               this.Command = ECommand.Preview;\r
-                                               this.Refreshed = true;\r
-                                               ret = true;\r
-                                               arg = arg.Substring(2);\r
-\r
-                                               int pVol = arg.IndexOf(',');                  //Trace.TraceInformation( "pVol=" + pVol );\r
-                                               string strVol = arg.Substring(0, pVol);           //Trace.TraceInformation( "strVol=" + strVol );\r
-                                               this.previewVolume = Convert.ToInt32(strVol);         //Trace.TraceInformation( "previewVolume=" + previewVolume );\r
-                                               int pPan = arg.IndexOf(',', pVol + 1);            //Trace.TraceInformation( "pPan=" + pPan );\r
-                                               string strPan = arg.Substring(pVol + 1, pPan - pVol - 1);   //Trace.TraceInformation( "strPan=" + strPan );\r
-                                               this.previewPan = Convert.ToInt32(strPan);          //Trace.TraceInformation( "previewPan=" + previewPan );\r
-\r
-                                               arg = arg.Substring(pPan + 1);\r
-                                               arg = arg.Trim(new char[] { '\"' });\r
-                                               this.previewFilename = arg;\r
-                                               analyzing = false;\r
-                                       }\r
-                                       // -S  -Nxxx  filename\r
-                                       else if (arg.StartsWith("-S", StringComparison.OrdinalIgnoreCase))    // DTXV再生停止\r
-                                       {\r
-                                               this.Enabled = true;\r
-                                               this.Command = ECommand.Stop;\r
-                                               this.Refreshed = true;\r
-                                               ret = true;\r
-                                               arg = arg.Substring(2);\r
-                                       }\r
-                                       else if (arg.StartsWith("-D", StringComparison.OrdinalIgnoreCase))\r
-                                       {\r
-                                               // -DW, -DA1など\r
-                                               arg = arg.Substring(2); // -D を削除\r
-                                               switch (arg[0])\r
-                                               {\r
-                                                       #region [ DirectSound ]\r
-                                                       case 'D':\r
-                                                               if (this.soundDeviceType != ESoundDeviceType.DirectSound)\r
-                                                               {\r
-                                                                       this.ChangedSoundDevice = true;\r
-                                                                       this.soundDeviceType = ESoundDeviceType.DirectSound;\r
-                                                               }\r
-                                                               else\r
-                                                               {\r
-                                                                       this.ChangedSoundDevice = false;\r
-                                                               }\r
-                                                               arg = arg.Substring(1);\r
-                                                               break;\r
-                                                       #endregion\r
-                                                       #region [ WASAPI ]\r
-                                                       case 'W':\r
-                                                               if (this.soundDeviceType != ESoundDeviceType.ExclusiveWASAPI)\r
-                                                               {\r
-                                                                       this.ChangedSoundDevice = true;\r
-                                                                       this.soundDeviceType = ESoundDeviceType.ExclusiveWASAPI;\r
-                                                               }\r
-                                                               else\r
-                                                               {\r
-                                                                       this.ChangedSoundDevice = false;\r
-                                                               }\r
-                                                               arg = arg.Substring(1);\r
-                                                               break;\r
-                                                       #endregion\r
-                                                       #region [ ASIO ]\r
-                                                       case 'A':\r
-                                                               if (this.soundDeviceType != ESoundDeviceType.ASIO)\r
-                                                               {\r
-                                                                       this.ChangedSoundDevice = true;\r
-                                                                       this.soundDeviceType = ESoundDeviceType.ASIO;\r
-                                                               }\r
-                                                               else\r
-                                                               {\r
-                                                                       this.ChangedSoundDevice = false;\r
-                                                               }\r
-                                                               arg = arg.Substring(1);\r
-\r
-                                                               int nAsioDev = 0, p = 0;\r
-                                                               while (true)\r
-                                                               {\r
-                                                                       char c = arg[0];\r
-                                                                       if ('0' <= c && c <= '9')\r
-                                                                       {\r
-                                                                               nAsioDev *= 10;\r
-                                                                               nAsioDev += c - '0';\r
-                                                                               p++;\r
-                                                                               arg = arg.Substring(1);\r
-                                                                               continue;\r
-                                                                       }\r
-                                                                       else\r
-                                                                       {\r
-                                                                               break;\r
-                                                                       }\r
-                                                               }\r
-                                                               if (this.nASIOdevice != nAsioDev)\r
-                                                               {\r
-                                                                       this.ChangedSoundDevice = true;\r
-                                                                       this.nASIOdevice = nAsioDev;\r
-                                                               }\r
-                                                               break;\r
-                                                               #endregion\r
-                                               }\r
-                                               #region [ GRmode, TimeStretch, VSyncWait ]\r
-                                               {\r
-                                                       // Reload判定は、-Nのところで行う\r
-                                                       this.GRmode = (arg[0] == 'Y');\r
-                                                       this.TimeStretch = (arg[1] == 'Y');\r
-                                                       this.VSyncWait = (arg[2] == 'Y');\r
-\r
-                                                       arg = arg.Substring(3);\r
-                                               }\r
-                                               #endregion\r
-                                       }\r
-                                       else if (arg.StartsWith("-N", StringComparison.OrdinalIgnoreCase))\r
-                                       {\r
-                                               this.Enabled = true;\r
-                                               this.Command = ECommand.Play;\r
-                                               ret = true;\r
-\r
-                                               arg = arg.Substring(2);         // "-N"を除去\r
-                                               string[] p = arg.Split(new char[] { ' ' });\r
-                                               this.nStartBar = int.Parse(p[0]);     // 再生開始小節\r
-                                               if (this.nStartBar < 0)\r
-                                               {\r
-                                                       this.nStartBar = -1;\r
-                                               }\r
-\r
-                                               int startIndex = arg.IndexOf(' ');\r
-                                               string filename = arg.Substring(startIndex + 1);  // 再生ファイル名(フルパス) これで引数が終わっていることを想定\r
-                                               try\r
-                                               {\r
-                                                       filename = filename.Trim(new char[] { '\"' });\r
-                                                       bIsNeedReloadDTX(filename);\r
-                                               }\r
-                                               catch // 指定ファイルが存在しない\r
-                                               {\r
-                                               }\r
-                                               arg = "";\r
-                                               analyzing = false;\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               analyzing = false;\r
-                                       }\r
-                               }\r
-                       }\r
-                       //string[] s = { "Stop", "Play", "Preview" };\r
-                       //Trace.TraceInformation( "Command: " + s[ (int) this.Command ] );\r
-                       return ret;\r
-               }\r
-\r
-               /// <summary>\r
-               /// Viewer関連の設定のみを更新して、Config.iniに書き出す\r
-               /// </summary>\r
-               public void tUpdateConfigIni()\r
-               {\r
-                       /// Viewer関連の設定のみを更新するために、\r
-                       /// 1. 現在のconfig.ini相当の情報を、別変数にコピーしておく\r
-                       /// 2. config.iniを読み込みなおす\r
-                       /// 3. 別変数のコピーから、Viewer関連の設定を、configに入れ込む\r
-                       /// 4. Config.iniを保存する\r
-       \r
-                       CConfigXml ConfigIni_backup = (CConfigXml) CDTXMania.Instance.ConfigIni.Clone();                // #36612 2016.9.12 yyagi\r
-                       CDTXMania.Instance.LoadConfig();\r
-\r
-                       // CConfigIni cc = new CConfigIni();\r
-                       //string path = CDTXMania.Instance.strEXEのあるフォルダ + "Config.ini";\r
-                       //if (File.Exists(path))\r
-                       //{\r
-                       //      FileInfo fi = new FileInfo(path);\r
-                       //      if (fi.Length > 0)      // Config.iniが0byteだったなら、読み込まない\r
-                       //      {\r
-                       //              try\r
-                       //              {\r
-                       //                      CDTXMania..tファイルから読み込み(path);\r
-                       //              }\r
-                       //              catch\r
-                       //              {\r
-                       //                      //ConfigIni = new CConfigIni(); // 存在してなければ新規生成\r
-                       //              }\r
-                       //      }\r
-                       //      fi = null;\r
-                       //}\r
-\r
-                       for (EPart inst = EPart.Drums; inst <= EPart.Bass; ++inst)\r
-                       {\r
-                               CDTXMania.Instance.ConfigIni.nViewerScrollSpeed[inst].Value = ConfigIni_backup.nScrollSpeed[inst];\r
-                       }\r
-                       CDTXMania.Instance.ConfigIni.bViewerShowDebugStatus.Value = ConfigIni_backup.bDebugInfo;\r
-                       CDTXMania.Instance.ConfigIni.bViewerVSyncWait.Value = ConfigIni_backup.bVSyncWait;\r
-                       CDTXMania.Instance.ConfigIni.bViewerTimeStretch.Value = ConfigIni_backup.bTimeStretch;\r
-                       CDTXMania.Instance.ConfigIni.bViewerDrumsActive.Value = ConfigIni_backup.bDrums有効;\r
-                       CDTXMania.Instance.ConfigIni.bViewerGuitarActive.Value = ConfigIni_backup.bGuitar有効;\r
-\r
-                       CDTXMania.Instance.ConfigIni.rcViewerWindow.W = ConfigIni_backup.rcWindow.W;\r
-                       CDTXMania.Instance.ConfigIni.rcViewerWindow.H = ConfigIni_backup.rcWindow.H;\r
-                       CDTXMania.Instance.ConfigIni.rcViewerWindow.X = ConfigIni_backup.rcWindow.X;\r
-                       CDTXMania.Instance.ConfigIni.rcViewerWindow.Y = ConfigIni_backup.rcWindow.Y;\r
-\r
-                       CDTXMania.Instance.SaveConfig();\r
-\r
-                       ConfigIni_backup = null;\r
-               }\r
-\r
-               private string last_path;\r
-               private DateTime last_timestamp;\r
-\r
-       }\r
-}\r