OSDN Git Service

StrokeStyleT.コマンドライン引数を処理する() に渡す args から、exe 名を除外。
[strokestylet/CsWin10Desktop3.git] / StrokeStyleT / StrokeStyleT.cs
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Diagnostics;
5 using System.Linq;
6 using System.Windows.Forms;
7 using Microsoft.VisualBasic.ApplicationServices;
8
9 namespace SST
10 {
11         class StrokeStyleT : FDK.ApplicationBase
12         {
13                 // グローバルリソース (static) 
14                 public static SST.フォルダ フォルダ => ( StrokeStyleT.bs_フォルダ );
15                 public static FDK.入力.Keyboard キーボード入力 => ( StrokeStyleT.bs_キーボード入力 );
16                 public static FDK.入力.MidiIn MIDI入力 => ( StrokeStyleT.bs_MIDI入力 );
17                 public static FDK.メディア.サウンド.WASAPI排他.ExclusiveDevice Wasapiデバイス => ( StrokeStyleT.bs_Wasapiデバイス );
18                 public static Random 乱数 => ( StrokeStyleT.bs_乱数 );
19                 public static SST.ユーザ.ユーザ管理 ユーザ管理 => ( StrokeStyleT.bs_ユーザ管理 );
20                 public static SST.曲.曲ツリー管理 曲ツリー管理 => ( StrokeStyleT.bs_曲ツリー管理 );
21                 public static SSTFormat.スコア 演奏スコア { get; set; } = null;
22                 public static SST.設定.Config Config => ( StrokeStyleT.bs_Config );
23                 public static bool ビュアーモード => ( StrokeStyleT.bs_ビュアーモード );
24                 public static string ビューファイル => ( StrokeStyleT.bs_ビューファイル );
25
26                 public static void すべての入力デバイスをポーリングする()
27                 {
28                         // hack: 追加の入力デバイスができたら、ここにポーリングコードを追加すること。
29                         StrokeStyleT.キーボード入力?.ポーリングする();
30                         StrokeStyleT.MIDI入力?.ポーリングする();
31                 }
32
33                 // get only static property の初期化。
34                 static StrokeStyleT()
35                 {
36                         // フォルダ変数を真っ先に登録する。(ほかのメンバのコンストラクタでフォルダ変数を利用できるようにするため。)
37                         StrokeStyleT.bs_フォルダ = new SST.フォルダ();
38                         SST.フォルダ.フォルダ変数を追加する( "Static", StrokeStyleT.フォルダ.StaticFolder );
39                         SST.フォルダ.フォルダ変数を追加する( "AppData", StrokeStyleT.フォルダ.AppDataFolder );
40                         SST.フォルダ.フォルダ変数を追加する( "User", null );
41
42                         // その他の static の生成。
43                         StrokeStyleT.bs_ユーザ管理 = new ユーザ.ユーザ管理();
44                         StrokeStyleT.bs_曲ツリー管理 = new 曲.曲ツリー管理();
45                 }
46
47                 protected override void 初期化する()
48                 {
49                         FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
50                         Debug.Assert( null == this.スレッド排他領域.デバイスリソース, "デバイスリソースの作成前であること。" );
51
52                         this.コマンドライン引数を処理する( Environment.GetCommandLineArgs().Skip( 1 ) );  // 最初の要素は exe ファイル名なのでスキップする。
53
54                         this.MainForm.Text = $"StrokeStyle<T> {System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()}";
55                         this.設計画面サイズdpx = new SharpDX.Size2F( 1920, 1080 );     // 設計画面サイズdpx(固定)
56
57                         #region " コンフィグ を初期化する。"
58                         //----------------
59                         FDK.Log.Info( "コンフィグを初期化します。" );
60                         StrokeStyleT.bs_Config = new 設定.Config();
61                         StrokeStyleT.bs_Config.ConfigXmlを読み込む();
62                         //----------------
63                         #endregion
64                         #region " コンフィグで指定されたウィンドウサイズに変更。"
65                         //----------------
66                         this.MainForm.ClientSize = new System.Drawing.Size( StrokeStyleT.Config.物理画面サイズpx.Width, StrokeStyleT.Config.物理画面サイズpx.Height );
67                         //----------------
68                         #endregion
69
70                         #region " System.Stopwatch が高解像度タイマを使わないならエラー。"
71                         //-----------------
72                         if( false == System.Diagnostics.Stopwatch.IsHighResolution )
73                                 throw new SSTException( "このシステムは、高解像度タイマをサポートしていません。" );
74                         //-----------------
75                         #endregion
76                         #region " MediaFoundation を起動する。"
77                         //-----------------
78                         SharpDX.MediaFoundation.MediaManager.Startup();
79                         //-----------------
80                         #endregion
81                         #region " Sleep 精度を上げる。"
82                         //-----------------
83                         StrokeStyleT.timeBeginPeriod( 1 );
84                         //-----------------
85                         #endregion
86
87                         #region " ステージのActionを接続する。"
88                         //----------------
89                         this.結果ステージ.演奏ステージインスタンスを取得する = () => this.演奏ステージ;
90                         //----------------
91                         #endregion
92                         #region " ユーザを初期化する。"
93                         //-----------------
94                         FDK.Log.Info( "ユーザ情報を初期化します。" );
95                         StrokeStyleT.ユーザ管理.UsersXmlを読み込む();
96
97                         // ユーザ別の初期化。
98                         foreach( var ユーザ in StrokeStyleT.ユーザ管理.ユーザリスト )
99                                 ユーザ.SourcesXmlを読み込む();
100                         //-----------------
101                         #endregion
102                         #region " WASAPI デバイスを初期化する。"
103                         //----------------
104                         StrokeStyleT.bs_Wasapiデバイス = new FDK.メディア.サウンド.WASAPI排他.ExclusiveDevice();
105                         StrokeStyleT.bs_Wasapiデバイス.初期化する( 15.0f );
106                         //----------------
107                         #endregion
108                         #region " キーボード入力 を初期化する。"
109                         //-----------------
110                         FDK.Log.Info( "キーボード入力デバイスを初期化します。" );
111                         StrokeStyleT.bs_キーボード入力 = new FDK.入力.Keyboard( this.MainForm.Handle );
112                         //-----------------
113                         #endregion
114                         #region " MIDI入力 を初期化する。"
115                         //-----------------
116                         FDK.Log.Info( "MIDI入力デバイスを初期化します。" );
117                         StrokeStyleT.bs_MIDI入力 = new FDK.入力.MidiIn();
118                         //-----------------
119                         #endregion
120
121                         this.現在のステージ = this.最初のダミーステージ;
122
123 //#warning 全画面モード切替えを KeyDown で仮実装。
124                         this.MainForm.KeyDown += ( target, arg ) => {
125                                 // Alt+Enter → 画面モードの切り替え
126 //                              if( ( arg.KeyCode == System.Windows.Forms.Keys.Return ) && ( arg.Modifiers == Keys.Alt ) )
127 //                                      this.全画面モードとウィンドウモードを切り替える();
128                         };
129
130                         FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
131                 }
132                 protected override void 終了する()
133                 {
134                         FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
135
136                         Debug.Assert( null != this.スレッド排他領域.デバイスリソース, "デバイスリソースが解放される前であること。" );
137
138                         #region " ステージを終了し、解放する。"
139                         //----------------
140                         if( ( null != this.現在のステージ ) && ( this.現在のステージ.活性化している ) )
141                                 this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
142
143                         this.最初のダミーステージ  = null;
144                         this.起動ステージ = null;
145                         this.タイトルステージ = null;
146                         this.ログインステージ = null;
147                         this.選曲ステージ = null;
148                         this.曲読込ステージ = null;
149                         this.演奏ステージ = null;
150                         this.結果ステージ = null;
151                         //----------------
152                         #endregion
153                         #region " MIDI入力 を解放する。"
154                         //-----------------
155                         FDK.Log.Info( "MIDI入力デバイスを解放します。" );
156                         FDK.Utilities.解放する( ref StrokeStyleT.bs_MIDI入力 );
157                         //-----------------
158                         #endregion
159                         #region " キーボード入力 を解放する。"
160                         //-----------------
161                         FDK.Log.Info( "キーボード入力デバイスを解放します。" );
162                         FDK.Utilities.解放する( ref StrokeStyleT.bs_キーボード入力 );
163                         //-----------------
164                         #endregion
165                         #region " WASAPIデバイスを解放する。"
166                         //----------------
167                         FDK.Log.Info( "WASAPIデバイスを解放します。" );
168                         FDK.Utilities.解放する( ref StrokeStyleT.bs_Wasapiデバイス );
169                         //----------------
170                         #endregion
171                         #region " コンフィグを解放する。"
172                         //----------------
173                         FDK.Log.Info( "コンフィグを解放します。" );
174                         StrokeStyleT.bs_Config = null;
175                         //----------------
176                         #endregion
177                         #region " MediaFoundation を終了する。"
178                         //-----------------
179                         SharpDX.MediaFoundation.MediaManager.Shutdown();
180                         //-----------------
181                         #endregion
182
183                         FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
184                 }
185                 protected override void シーンを描画する()
186                 {
187                         // このメソッドは、GUIスレッドではなく進行描画スレッドから呼び出されるので注意。
188
189                         this.スレッド排他領域.WriteLock( () => {
190
191                                 #region " 描画の準備を行う。"
192                                 //----------------
193                                 var dr = this.スレッド排他領域.デバイスリソース;
194                                 var d3dDevice = (SharpDX.Direct3D11.Device) null;
195                                 using( var d3dLock = new FDK.同期.AutoD3DDeviceLock( dr.DXGIDeviceManager, out d3dDevice ) )
196                                 using( d3dDevice )
197                                 using( var d3dContext = d3dDevice.ImmediateContext )
198                                 {
199                                         // 既定のD3Dレンダーターゲットビューを黒でクリアする。
200                                         d3dContext.ClearRenderTargetView( dr.D3DRenderTargetView, SharpDX.Color4.Black );
201
202                                         // 深度バッファを 1.0f でクリアする。
203                                         d3dContext.ClearDepthStencilView(
204                                                 dr.D3DDepthStencilView,
205                                                 SharpDX.Direct3D11.DepthStencilClearFlags.Depth,
206                                                 depth: 1.0f,
207                                                 stencil: 0 );
208                                 }
209                                 //----------------
210                                 #endregion
211
212                                 this.現在のステージ?.進行描画する( this.スレッド排他領域.デバイスリソース );
213
214                         } );
215
216                         // スワップチェーンを表示する。垂直帰線待ちなどで時間がかかるので、この部分はスレッド排他領域の外に配置すること。
217                         if( false == this.スレッド排他領域.アプリを終了せよ )
218                         {
219                                 this.スレッド排他領域.デバイスリソース.SwapChain.Present(
220                                         ( StrokeStyleT.Config.垂直帰線待ちを行う ) ? 1 : 0,
221                                         SharpDX.DXGI.PresentFlags.None );
222                         }
223
224                         // ステージの状態をチェックし、必要あれば遷移またはアプリを終了する。
225                         this.スレッド排他領域.WriteLock( () => {
226
227                                 if( null != this.現在のステージ )
228                                 {
229                                         switch( this.現在のステージ.GetType().Name )
230                                         {
231                                                 case nameof( ステージ.ステージ ):
232                                                         #region " 最初のダミーステージ → 起動ステージへ。"
233                                                         //----------------
234                                                         this.起動ステージ.活性化する( this.スレッド排他領域.デバイスリソース );
235                                                         this.現在のステージ = this.起動ステージ;
236                                                         //----------------
237                                                         #endregion
238                                                         break;
239
240                                                 case nameof( ステージ.起動.起動ステージ ):
241                                                         #region " 終了 → タイトルステージへ。"
242                                                         //---------------
243                                                         if( this.起動ステージ.現在のフェーズ == ステージ.起動.起動ステージ.フェーズ.終了 )
244                                                         {
245                                                                 this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
246                                                                 this.現在のステージ = this.タイトルステージ;
247                                                                 this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
248                                                         }
249                                                         //---------------
250                                                         #endregion
251                                                         break;
252
253                                                 case nameof( ステージ.タイトル.タイトルステージ ):
254                                                         #region " 確定 → ログインステージへ。"
255                                                         //---------------
256                                                         if( this.タイトルステージ.現在のフェーズ == ステージ.タイトル.タイトルステージ.フェーズ.確定 )
257                                                         {
258                                                                 this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
259                                                                 this.現在のステージ = this.ログインステージ;
260                                                                 this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
261                                                         }
262                                                         //---------------
263                                                         #endregion
264                                                         #region " キャンセル → アプリを終了する。"
265                                                         //---------------
266                                                         else if( this.タイトルステージ.現在のフェーズ == ステージ.タイトル.タイトルステージ.フェーズ.キャンセル )
267                                                         {
268                                                                 this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
269                                                                 this.現在のステージ = null;
270                                                                 this.スレッド排他領域.アプリを終了せよ = true;
271                                                         }
272                                                         //---------------
273                                                         #endregion
274                                                         break;
275
276                                                 case nameof( ステージ.ログイン.ログインステージ ):
277                                                         #region " 確定 → ログイン処理を行って、選曲ステージへ。"
278                                                         //---------------
279                                                         if( this.ログインステージ.現在のフェーズ == ステージ.ログイン.ログインステージ.フェーズ.確定 )
280                                                         {
281                                                                 // ログイン処理(1) ユーザリストに対してユーザを選択する。
282                                                                 StrokeStyleT.ユーザ管理.ユーザを選択する( this.ログインステージ.ユーザインデックス );
283                                                                 FDK.Log.Info( $"ユーザが選択されました。[{StrokeStyleT.ユーザ管理.現在選択されているユーザ.名前}]" );
284
285                                                                 // ログイン処理(2) 選択ユーザの曲ツリーを構築する。
286                                                                 StrokeStyleT.ユーザ管理.現在選択されているユーザ.曲を検索して曲ツリーを構築する();
287
288                                                                 // ログイン処理(3) 構築した曲ツリーを曲リスト管理に登録する。
289                                                                 StrokeStyleT.曲ツリー管理.現在の管理対象ツリー = StrokeStyleT.ユーザ管理.現在選択されているユーザ.曲ツリーのルートノード;
290
291                                                                 // 選曲ステージへ。
292                                                                 this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
293                                                                 this.現在のステージ = this.選曲ステージ;
294                                                                 this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
295                                                         }
296                                                         //---------------
297                                                         #endregion
298                                                         #region " キャンセル → タイトルステージへ。"
299                                                         //---------------
300                                                         else if( this.ログインステージ.現在のフェーズ == ステージ.ログイン.ログインステージ.フェーズ.キャンセル )
301                                                         {
302                                                                 this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
303                                                                 this.現在のステージ = this.タイトルステージ;
304                                                                 this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
305                                                         }
306                                                         //---------------
307                                                         #endregion
308                                                         break;
309
310                                                 case nameof( ステージ.選曲.選曲ステージ ):
311                                                         #region " 曲確定 → 曲読込ステージへ。"
312                                                         //---------------
313                                                         if( this.選曲ステージ.現在のフェーズ == ステージ.選曲.選曲ステージ.フェーズ.曲確定 )
314                                                         {
315                                                                 // 曲ノードが選択されていることを確認。
316                                                                 Trace.Assert( null != StrokeStyleT.曲ツリー管理.現在選択されているノード, "[バグあり] 選択曲が null です。" );
317                                                                 this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
318                                                                 this.現在のステージ = this.曲読込ステージ;
319                                                                 this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
320                                                         }
321                                                         //---------------
322                                                         #endregion
323                                                         #region " キャンセル → アプリを終了する。"
324                                                         //---------------
325                                                         else if( this.選曲ステージ.現在のフェーズ == ステージ.選曲.選曲ステージ.フェーズ.キャンセル )
326                                                         {
327                                                                 this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
328                                                                 this.現在のステージ = null;
329                                                                 this.スレッド排他領域.アプリを終了せよ = true;
330                                                         }
331                                                         //---------------
332                                                         #endregion
333                                                         break;
334
335                                                 case nameof( ステージ.曲読込.曲読込ステージ ):
336                                                         #region " 終了 → 演奏ステージへ。"
337                                                         //--------------------
338                                                         if( this.曲読込ステージ.現在のフェーズ == ステージ.曲読込.曲読込ステージ.フェーズ.終了 )
339                                                         {
340                                                                 // 演奏スコアインスタンスが作成されていることを確認。
341                                                                 Debug.Assert( null != StrokeStyleT.演奏スコア );
342
343                                                                 this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
344                                                                 this.現在のステージ = this.演奏ステージ;
345                                                                 this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
346                                                         }
347                                                         //--------------------
348                                                         #endregion
349                                                         break;
350
351                                                 case nameof( ステージ.演奏.演奏ステージ ):
352                                                         #region " 演奏終了 → 結果ステージへ。"
353                                                         //--------------------
354                                                         if( this.演奏ステージ.現在のフェーズ == ステージ.演奏.演奏ステージ.フェーズ.クリアor失敗 )
355                                                         {
356                                                                 this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
357                                                                 this.現在のステージ = this.結果ステージ;
358                                                                 this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
359                                                         }
360                                                         //--------------------
361                                                         #endregion
362                                                         #region " キャンセル → 選曲ステージへ。"
363                                                         //--------------------
364                                                         if( this.演奏ステージ.現在のフェーズ == ステージ.演奏.演奏ステージ.フェーズ.キャンセル )
365                                                         {
366 #warning 結果ステージのデバッグのため、演奏キャンセル時も結果ステージへ遷移する。
367                                                                 this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
368                                                                 this.現在のステージ = this.結果ステージ;
369                                                                 this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
370                                                                 //this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
371                                                                 //this.現在のステージ = this.選曲ステージ;
372                                                                 //this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
373                                                         }
374                                                         //--------------------
375                                                         #endregion
376                                                         break;
377
378                                                 case nameof( ステージ.結果.結果ステージ ):
379                                                         #region " 終了 → 選曲ステージへ。"
380                                                         //--------------------
381                                                         if( this.結果ステージ.現在のフェーズ == ステージ.結果.結果ステージ.フェーズ.終了 )
382                                                         {
383                                                                 this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
384                                                                 this.現在のステージ = this.選曲ステージ;
385                                                                 this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
386                                                         }
387                                                         //--------------------
388                                                         #endregion
389                                                         break;
390                                         }
391                                 }
392
393                         } );
394                 }
395                 protected override void デバイス依存リソースを再構築する()
396                 {
397                         FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
398
399                         this.現在のステージ?.デバイス依存リソースを作成する( this.スレッド排他領域.デバイスリソース );
400
401                         FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
402                 }
403                 protected override void デバイス依存リソースを解放する()
404                 {
405                         FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
406
407                         this.現在のステージ?.デバイス依存リソースを解放する( this.スレッド排他領域.デバイスリソース );
408
409                         FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
410                 }
411                 /// <summary>
412                 /// アプリが二重起動されたときに発生するイベント。
413                 /// </summary>
414                 /// <remarks>
415                 /// 後続のインスタンスは起動せず、既存のインスタンスに対してこのイベントが発生する。
416                 /// eventArg.CommandLine で、後続のインスタンスのコマンドライン引数を確認することができる。
417                 /// </remarks>
418                 protected override void OnStartupNextInstance( StartupNextInstanceEventArgs eventArgs )
419                 {
420                         FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
421
422                         this.コマンドライン引数を処理する( eventArgs.CommandLine );
423
424                         FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
425                 }
426
427                 // 各ステージの、唯一のインスタンス。最終的に null を代入するので、readonlyにはしない。
428                 protected SST.ステージ.ステージ 最初のダミーステージ = new ステージ.ステージ();
429                 protected SST.ステージ.起動.起動ステージ 起動ステージ = new ステージ.起動.起動ステージ();
430                 protected SST.ステージ.タイトル.タイトルステージ タイトルステージ = new ステージ.タイトル.タイトルステージ();
431                 protected SST.ステージ.ログイン.ログインステージ ログインステージ = new ステージ.ログイン.ログインステージ();
432                 protected SST.ステージ.選曲.選曲ステージ 選曲ステージ = new ステージ.選曲.選曲ステージ();
433                 protected SST.ステージ.曲読込.曲読込ステージ 曲読込ステージ = new ステージ.曲読込.曲読込ステージ();
434                 protected SST.ステージ.演奏.演奏ステージ 演奏ステージ = new ステージ.演奏.演奏ステージ();
435                 protected SST.ステージ.結果.結果ステージ 結果ステージ = new ステージ.結果.結果ステージ();
436
437                 private SST.ステージ.ステージ 現在のステージ = null;
438                 
439                 #region " バックストア。"
440                 //----------------
441                 private static SST.フォルダ bs_フォルダ = null;
442                 private static FDK.入力.Keyboard bs_キーボード入力 = null;
443                 private static FDK.入力.MidiIn bs_MIDI入力 = null;
444                 private static FDK.メディア.サウンド.WASAPI排他.ExclusiveDevice bs_Wasapiデバイス = null;
445                 private static readonly Random bs_乱数 = new Random( DateTime.Now.Millisecond );
446                 private static SST.ユーザ.ユーザ管理 bs_ユーザ管理 = null;
447                 private static SST.曲.曲ツリー管理 bs_曲ツリー管理 = null;
448                 private static SST.設定.Config bs_Config = null;
449
450                 private static bool bs_ビュアーモード = false;
451                 private static string bs_ビューファイル = null;
452                 //----------------
453                 #endregion
454
455                 /// <param name="args">コマンドライン引数の列挙。exeファイル名は含まない。</param>
456                 private void コマンドライン引数を処理する( IEnumerable<string> args )
457                 {
458                         FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
459                         FDK.Log.Info( $"args.Count = {args.Count()}" );
460                         //Mono.Options.OptionSet
461
462
463
464
465                         FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
466
467                 }
468
469                 #region " Win32 API "
470                 //-----------------
471                 [ System.Runtime.InteropServices.DllImport( "winmm.dll", EntryPoint = "timeBeginPeriod" )]
472                 private static extern uint timeBeginPeriod( uint uMilliseconds );
473
474                 [System.Runtime.InteropServices.DllImport( "winmm.dll", EntryPoint = "timeEndPeriod" )]
475                 private static extern uint timeEndPeriod( uint uMilliseconds );
476                 //-----------------
477                 #endregion
478         }
479 }