• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版c431b214d06fd701b5b9406417882b9d484f4638 (tree)
时间2018-02-07 23:21:50
作者yyagi <yyagi.dtxmania@gmai...>
Commiteryyagi

Log Message

#28263 DTX2WAV003:

  • DTX2WAVの起動時にDTXMania本体が既に起動済みだった場合は、警告を表示して自身を終了する機能
  • 自身の二重起動抑制
  • NOWLOADINGサウンド抑制
  • ウェイリングチップ並びにウェイリングエフェクトの表示抑制
  • 録音完了ダイアログの表示位置修正

更改概述

  • delete: "DTXMania/\343\202\263\343\203\274\343\203\211/\343\202\271\343\203\206\343\203\274\343\202\270/06.\346\233\262\350\252\255\343\201\277\350\276\274\343\201\277/CStage\346\233\262\350\252\255\343\201\277\350\276\274\343\201\277.cs"
  • delete: "DTXMania/\343\202\263\343\203\274\343\203\211/\343\202\271\343\203\206\343\203\274\343\202\270/07.\346\274\224\345\245\217/CStage\346\274\224\345\245\217\347\224\273\351\235\242\345\205\261\351\200\232.cs"
  • modified: DTX2WAV/DTX2WAV.csproj (diff)
  • modified: DTX2WAV/Form1.cs (diff)
  • modified: DTX2WAV/Program.cs (diff)
  • modified: DTX2WAV/Properties/AssemblyInfo.cs (diff)
  • delete: DTX2WAV/{Form_FInished.Designer.cs => Form_FInished_OK.Designer.cs}
  • delete: DTX2WAV/{Form_FInished.cs => Form_FInished_OK.cs}
  • delete: DTX2WAV/{Form_FInished.resx => Form_FInished_OK.resx}

差异

--- a/DTX2WAV/DTX2WAV.csproj
+++ b/DTX2WAV/DTX2WAV.csproj
@@ -55,11 +55,11 @@
5555 <Compile Include="Form1.Designer.cs">
5656 <DependentUpon>Form1.cs</DependentUpon>
5757 </Compile>
58- <Compile Include="Form_FInished.cs">
58+ <Compile Include="Form_FInished_OK.cs">
5959 <SubType>Form</SubType>
6060 </Compile>
61- <Compile Include="Form_FInished.Designer.cs">
62- <DependentUpon>Form_FInished.cs</DependentUpon>
61+ <Compile Include="Form_FInished_OK.Designer.cs">
62+ <DependentUpon>Form_FInished_OK.cs</DependentUpon>
6363 </Compile>
6464 <Compile Include="Form_Recording.cs">
6565 <SubType>Form</SubType>
@@ -75,8 +75,8 @@
7575 <EmbeddedResource Include="Form1.resx">
7676 <DependentUpon>Form1.cs</DependentUpon>
7777 </EmbeddedResource>
78- <EmbeddedResource Include="Form_FInished.resx">
79- <DependentUpon>Form_FInished.cs</DependentUpon>
78+ <EmbeddedResource Include="Form_FInished_OK.resx">
79+ <DependentUpon>Form_FInished_OK.cs</DependentUpon>
8080 </EmbeddedResource>
8181 <EmbeddedResource Include="Form_Recording.resx">
8282 <DependentUpon>Form_Recording.cs</DependentUpon>
--- a/DTX2WAV/Form1.cs
+++ b/DTX2WAV/Form1.cs
@@ -16,7 +16,8 @@ namespace DTX2WAV
1616 public partial class Main : Form
1717 {
1818 Form_Recording formRecording;
19-
19+ Form_Finished_OK formFinishedOK;
20+
2021 public Main()
2122 {
2223 InitializeComponent();
@@ -212,10 +213,12 @@ namespace DTX2WAV
212213 // MessageBoxIcon.Information
213214 //);
214215
215- using (Form_Finished f = new Form_Finished())
216- {
217- f.ShowDialog();
218- }
216+ formFinishedOK = new Form_Finished_OK();
217+ //formFinishedOK.StartPosition = FormStartPosition.CenterParent;
218+ formFinishedOK.ShowDialog(this);
219+
220+ formFinishedOK.Dispose();
221+ formFinishedOK = null;
219222 }
220223
221224 /// <summary>
@@ -330,7 +333,6 @@ namespace DTX2WAV
330333 {
331334 COPYDATASTRUCT cds = (COPYDATASTRUCT)Marshal.PtrToStructure(m.LParam, typeof(COPYDATASTRUCT));
332335 string strMessage = Marshal.PtrToStringUni(cds.lpData);
333-//Debug.WriteLine("Msg received: " + strMessage);
334336 formRecording.label_state.Text = strMessage; // Form_Recordingにメッセージの内容を伝える
335337 }
336338 base.WndProc(ref m);
--- a/DTX2WAV/Form_FInished.Designer.cs
+++ b/DTX2WAV/Form_FInished_OK.Designer.cs
@@ -1,6 +1,6 @@
11 namespace DTX2WAV
22 {
3- partial class Form_Finished
3+ partial class Form_Finished_OK
44 {
55 /// <summary>
66 /// Required designer variable.
@@ -28,7 +28,7 @@
2828 /// </summary>
2929 private void InitializeComponent()
3030 {
31- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form_Finished));
31+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form_Finished_OK));
3232 this.button_OK = new System.Windows.Forms.Button();
3333 this.label_finished = new System.Windows.Forms.Label();
3434 this.SuspendLayout();
--- a/DTX2WAV/Form_FInished.cs
+++ b/DTX2WAV/Form_FInished_OK.cs
@@ -10,15 +10,16 @@ using System.Windows.Forms;
1010
1111 namespace DTX2WAV
1212 {
13- public partial class Form_Finished : Form
13+ public partial class Form_Finished_OK : Form
1414 {
15- public Form_Finished()
15+ public Form_Finished_OK()
1616 {
1717 InitializeComponent();
1818 }
1919
2020 private void button_OK_Click(object sender, EventArgs e)
2121 {
22- this.Close(); }
22+ this.Close();
23+ }
2324 }
2425 }
--- a/DTX2WAV/Program.cs
+++ b/DTX2WAV/Program.cs
@@ -3,6 +3,9 @@ using System.Collections.Generic;
33 using System.Linq;
44 using System.Threading.Tasks;
55 using System.Windows.Forms;
6+using System.Diagnostics;
7+using System.Runtime.InteropServices;
8+using System.IO;
69
710 namespace DTX2WAV
811 {
@@ -14,9 +17,169 @@ namespace DTX2WAV
1417 [STAThread]
1518 static void Main()
1619 {
17- Application.EnableVisualStyles();
18- Application.SetCompatibleTextRenderingDefault(false);
19- Application.Run(new Main());
20+ // 以下、DOBON.NETを参照した。mutexを使って二重起動を抑制。
21+ //Mutex名を決める(必ずアプリケーション固有の文字列に変更すること!)
22+ string mutexName = "DTX2WAV";
23+ //Mutexオブジェクトを作成する
24+ System.Threading.Mutex mutex = new System.Threading.Mutex(false, mutexName);
25+
26+ bool hasHandle = false;
27+ try
28+ {
29+ try
30+ {
31+ // mutexの所有権を要求する
32+ hasHandle = mutex.WaitOne(0, false);
33+ }
34+ //.NET Framework 2.0以降の場合
35+ catch (System.Threading.AbandonedMutexException)
36+ {
37+ //別のアプリケーションがmutexを解放しないで終了した時
38+ hasHandle = true;
39+ }
40+ #region [ mutexを得られなければ、既に起動済みと判断して、そっちを最前面に出して、こっちは終了 ]
41+ if (hasHandle == false)
42+ {
43+ //得られなかった場合は、すでに起動していると判断して終了
44+ //MessageBox.Show("多重起動はできません。");
45+
46+ // 得られなかった場合は、既に起動していると判断して、
47+ // 既に起動しているほうを最前面に出す
48+ Process prevProcess = GetPreviousProcess();
49+ if (prevProcess != null)
50+ {
51+ WakeupWindow(prevProcess.MainWindowHandle);
52+ }
53+ return;
54+ }
55+ #endregion
56+
57+ #region [ DTXMania本体が既に起動されていないか確認する。既に起動済みなら警告して終了 ]
58+ Process dtxmaniaProcess = GetProcessesByFileName("DTXManiaGR.exe");
59+ if (dtxmaniaProcess != null)
60+ {
61+ MessageBox.Show(
62+ "既にDTXMania本体が起動しています。DTX2WAVを起動する前に、DTXMania本体を終了してください。",
63+ "DTX2WAV",
64+ MessageBoxButtons.OK,
65+ MessageBoxIcon.Exclamation
66+ );
67+ return;
68+ }
69+
70+ #endregion
71+
72+ #region [ アプリを通常通り起動する ]
73+ Application.EnableVisualStyles();
74+ Application.SetCompatibleTextRenderingDefault(false);
75+ Application.Run(new Main());
76+ #endregion
77+ }
78+ finally
79+ {
80+ if (hasHandle)
81+ {
82+ // mutexを解放する
83+ mutex.ReleaseMutex();
84+ }
85+ mutex.Close();
86+ }
87+
88+
2089 }
90+
91+ // .NET TIPSより
92+ // 実行中の同じアプリケーションのプロセスを取得する
93+ // http://www.atmarkit.co.jp/fdotnet/dotnettips/151winshow/winshow.html
94+ public static Process GetPreviousProcess()
95+ {
96+ Process curProcess = Process.GetCurrentProcess();
97+ Process[] allProcesses = Process.GetProcessesByName(curProcess.ProcessName);
98+
99+ foreach (Process checkProcess in allProcesses)
100+ {
101+ // 自分自身のプロセスIDは無視する
102+ if (checkProcess.Id != curProcess.Id)
103+ {
104+ // プロセスのフルパス名を比較して同じアプリケーションか検証
105+ if (String.Compare(
106+ checkProcess.MainModule.FileName,
107+ curProcess.MainModule.FileName, true) == 0)
108+ {
109+ // 同じフルパス名のプロセスを取得
110+ return checkProcess;
111+ }
112+ }
113+ }
114+
115+ // 同じアプリケーションのプロセスが見つからない!
116+ return null;
117+ }
118+
119+ /// <summary>
120+ /// 指定した実行ファイル名のプロセスを取得する。
121+ /// https://dobon.net/vb/dotnet/process/getprocessesbyfilename.html
122+ /// </summary>
123+ /// <param name="searchFileName">検索する実行ファイル名。</param>
124+ /// <returns>最初に一致したProcess。</returns>
125+ public static System.Diagnostics.Process GetProcessesByFileName(string searchFileName)
126+ {
127+ searchFileName = searchFileName.ToLower();
128+
129+ //すべてのプロセスを列挙する
130+ foreach (System.Diagnostics.Process p
131+ in System.Diagnostics.Process.GetProcesses())
132+ {
133+ string fileName;
134+ try
135+ {
136+ //メインモジュールのパスを取得する
137+ fileName = p.MainModule.FileName;
138+ }
139+ catch (System.ComponentModel.Win32Exception)
140+ {
141+ //MainModuleの取得に失敗
142+ fileName = "";
143+ }
144+ if (0 < fileName.Length)
145+ {
146+ //ファイル名の部分を取得する
147+ fileName = System.IO.Path.GetFileName(fileName);
148+ //探しているファイル名と一致した時、コレクションに追加
149+ if (searchFileName.Equals(fileName.ToLower()))
150+ {
151+ return p;
152+ }
153+ }
154+ }
155+
156+ return null;
157+ }
158+
159+
160+ // .NET TIPSより
161+ // 外部プロセスのウィンドウを最前面にする
162+ // http://www.atmarkit.co.jp/fdotnet/dotnettips/151winshow/winshow.html
163+ public static void WakeupWindow(IntPtr hWnd)
164+ {
165+ // メイン・ウィンドウが最小化されていれば元に戻す
166+ if (IsIconic(hWnd))
167+ {
168+ ShowWindowAsync(hWnd, SW_RESTORE);
169+ }
170+
171+ // メイン・ウィンドウを最前面に表示する
172+ SetForegroundWindow(hWnd);
173+ }
174+ // 外部プロセスのメイン・ウィンドウを起動するためのWin32 API
175+ [DllImport("user32.dll")]
176+ private static extern bool SetForegroundWindow(IntPtr hWnd);
177+ [DllImport("user32.dll")]
178+ private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
179+ [DllImport("user32.dll")]
180+ private static extern bool IsIconic(IntPtr hWnd);
181+ // ShowWindowAsync関数のパラメータに渡す定義値
182+ private const int SW_RESTORE = 9; // 画面を元の大きさに戻す
183+
21184 }
22185 }
--- a/DTX2WAV/Properties/AssemblyInfo.cs
+++ b/DTX2WAV/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
3232 // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
3333 // 既定値にすることができます:
3434 // [assembly: AssemblyVersion("1.0.*")]
35-[assembly: AssemblyVersion("2.0.0.0")]
36-[assembly: AssemblyFileVersion("2.0.0.0")]
35+[assembly: AssemblyVersion("4.0.0.0")]
36+[assembly: AssemblyFileVersion("4.0.0.0")]
--- "a/DTXMania/\343\202\263\343\203\274\343\203\211/\343\202\271\343\203\206\343\203\274\343\202\270/06.\346\233\262\350\252\255\343\201\277\350\276\274\343\201\277/CStage\346\233\262\350\252\255\343\201\277\350\276\274\343\201\277.cs"
+++ "b/DTXMania/\343\202\263\343\203\274\343\203\211/\343\202\271\343\203\206\343\203\274\343\202\270/06.\346\233\262\350\252\255\343\201\277\350\276\274\343\201\277/CStage\346\233\262\350\252\255\343\201\277\350\276\274\343\201\277.cs"
@@ -83,7 +83,8 @@ namespace DTXMania
8383 this.strSTAGEFILE = CSkin.Path(@"Graphics\\ScreenNowLoading background.jpg");
8484 this.b音符を表示する = true;
8585 }
86- if (((cdtx.SOUND_NOWLOADING != null) && (cdtx.SOUND_NOWLOADING.Length > 0)) && File.Exists(cdtx.strフォルダ名 + cdtx.SOUND_NOWLOADING))
86+ if (((cdtx.SOUND_NOWLOADING != null) && (cdtx.SOUND_NOWLOADING.Length > 0)) && File.Exists(cdtx.strフォルダ名 + cdtx.SOUND_NOWLOADING)
87+ && (!CDTXMania.Instance.DTX2WAVmode.Enabled))
8788 {
8889 string strNowLoadingサウンドファイルパス = cdtx.strフォルダ名 + cdtx.SOUND_NOWLOADING;
8990 try
@@ -454,33 +455,37 @@ namespace DTXMania
454455
455456 case CStage.Eフェーズ.NOWLOADING_BMPファイルを読み込む:
456457 {
457- TimeSpan span;
458- DateTime timeBeginLoadBMPAVI = DateTime.Now;
459- if (CDTXMania.Instance.ConfigIni.bBGA)
460- CDTXMania.Instance.DTX.tBMP_BMPTEXの読み込み();
458+ if (!CDTXMania.Instance.DTX2WAVmode.Enabled)
459+ {
460+ TimeSpan span;
461+ DateTime timeBeginLoadBMPAVI = DateTime.Now;
462+ if (CDTXMania.Instance.ConfigIni.bBGA)
463+ CDTXMania.Instance.DTX.tBMP_BMPTEXの読み込み();
461464
462- if (CDTXMania.Instance.ConfigIni.bAVI)
463- CDTXMania.Instance.DTX.tAVIの読み込み();
464- span = (TimeSpan)(DateTime.Now - timeBeginLoadBMPAVI);
465- Trace.TraceInformation("BMP/AVI読込所要時間({0,4}): {1}", (CDTXMania.Instance.DTX.listBMP.Count + CDTXMania.Instance.DTX.listBMPTEX.Count + CDTXMania.Instance.DTX.listAVI.Count), span.ToString());
465+ if (CDTXMania.Instance.ConfigIni.bAVI)
466+ CDTXMania.Instance.DTX.tAVIの読み込み();
467+ span = (TimeSpan)(DateTime.Now - timeBeginLoadBMPAVI);
468+ Trace.TraceInformation("BMP/AVI読込所要時間({0,4}): {1}", (CDTXMania.Instance.DTX.listBMP.Count + CDTXMania.Instance.DTX.listBMPTEX.Count + CDTXMania.Instance.DTX.listAVI.Count), span.ToString());
466469
467470
468- if (bitmapFilename != null)
469- {
470- bitmapFilename.Dispose();
471- bitmapFilename = null;
472- }
473- if (graphicsFilename != null)
474- {
475- graphicsFilename.Dispose();
476- graphicsFilename = null;
477- }
478- if (ftFilename != null)
479- {
480- ftFilename.Dispose();
481- ftFilename = null;
471+ if (bitmapFilename != null)
472+ {
473+ bitmapFilename.Dispose();
474+ bitmapFilename = null;
475+ }
476+ if (graphicsFilename != null)
477+ {
478+ graphicsFilename.Dispose();
479+ graphicsFilename = null;
480+ }
481+ if (ftFilename != null)
482+ {
483+ ftFilename.Dispose();
484+ ftFilename = null;
485+ }
482486 }
483487 CDTXMania.Instance.Timer.t更新();
488+
484489 base.eフェーズID = CStage.Eフェーズ.NOWLOADING_LPを再配置する;
485490 return (int)E曲読込画面の戻り値.継続;
486491 }
--- "a/DTXMania/\343\202\263\343\203\274\343\203\211/\343\202\271\343\203\206\343\203\274\343\202\270/07.\346\274\224\345\245\217/CStage\346\274\224\345\245\217\347\224\273\351\235\242\345\205\261\351\200\232.cs"
+++ "b/DTXMania/\343\202\263\343\203\274\343\203\211/\343\202\271\343\203\206\343\203\274\343\202\270/07.\346\274\224\345\245\217/CStage\346\274\224\345\245\217\347\224\273\351\235\242\345\205\261\351\200\232.cs"
@@ -660,10 +660,10 @@ namespace DTXMania
660660 }
661661 }
662662
663- // AVI / BGA
664663 if (base.eフェーズID != CStage.Eフェーズ.演奏_STAGE_FAILED &&
665664 base.eフェーズID != CStage.Eフェーズ.演奏_STAGE_FAILED_フェードアウト)
666665 {
666+ // AVI / BGA
667667 actAVI.t進行描画(
668668 CDTXMania.Instance.ConfigIni.cdMovieX[CDTXMania.Instance.ConfigIni.eActiveInst],
669669 CDTXMania.Instance.ConfigIni.cdMovieY[CDTXMania.Instance.ConfigIni.eActiveInst],
@@ -3484,7 +3484,7 @@ namespace DTXMania
34843484
34853485 private void t進行描画_チップ_ウェイリング(ref CChip pChip)
34863486 {
3487- if (CDTXMania.Instance.ConfigIni.bGuitar有効)
3487+ if (CDTXMania.Instance.ConfigIni.bGuitar有効 && (!CDTXMania.Instance.DTX2WAVmode.Enabled))
34883488 {
34893489 EPart indexInst = pChip.bGuitar可視チップ_Wailing含む ? EPart.Guitar : EPart.Bass;
34903490 #region [ Sud Hid Inv 処理 ]