OSDN Git Service

#47668 DTXC内で扱う分解能を下辺にするための布石。
[dtxmania/dtxmania.git] / DTXCreator / コード / 00.全体 / CDTX入出力.cs
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4 using System.Globalization;
5 using System.Text;
6 using System.IO;
7 using System.Windows.Forms;
8 using System.Drawing;
9 using DTXCreator.Properties;
10 using DTXCreator.譜面;
11 using DTXCreator.UndoRedo;
12 using DTXCreator.WAV_BMP_AVI;
13 using FDK;
14 using System.Diagnostics;
15
16 namespace DTXCreator
17 {
18         internal class CDTX入出力
19         {
20                 internal CDTX入出力( Cメインフォーム mf )
21                 {
22                         this._Form = mf;
23                 }
24                 public void tDTX出力( StreamWriter sw )
25                 {
26                         this.tDTX出力( sw, false );
27                 }
28                 public void tDTX出力( StreamWriter sw, bool bBGMのみ出力 )
29                 {
30                         sw.WriteLine( "; Created by DTXCreator " + Resources.DTXC_VERSION );
31                         this.tDTX出力_タイトルと製作者とコメントその他( sw );
32                         this.tDTX出力_自由入力欄( sw );
33                         this.tDTX出力_WAVリスト( sw, bBGMのみ出力 );
34                         this.tDTX出力_BMPリスト( sw );
35                         this.tDTX出力_AVIリスト( sw );
36                         this.tDTX出力_小節長倍率( sw );
37                         this.tDTX出力_BPxリスト( sw );
38                         this.tDTX出力_BEATチップのf値( sw );
39                         this.tDTX出力_全チップ( sw );
40                         sw.WriteLine();
41                         this.tDTX出力_レーン割付チップ( sw );
42                         this.tDTX出力_WAVリスト色設定( sw );
43                         this.tDTX出力_BMPリスト色設定( sw );
44                         this.tDTX出力_AVIリスト色設定( sw );
45                         this.tDTX出力_チップパレット( sw );
46                 }
47                 public void tDTX入力( E種別 e種別, ref string str全入力文字列 )
48                 {
49                         this.e種別 = e種別;
50                         if( str全入力文字列.Length != 0 )
51                         {
52                                 this.dic小節長倍率 = new Dictionary<int, float>();
53                                 this.dicBEATチップf値 = new Dictionary<int, float>();
54                                 this.listチップパレット = new List<int>();
55                                 this.listBGMWAV番号 = new List<int>();                                                                                        // #26775 2011.11.21 yyagi
56                                 this.nLastBarConverted = -1;
57                                 this.eDTXbgmChs = DTXbgmChs.GetEnumerator();
58                                 this._Form.listViewWAVリスト.BeginUpdate();
59                                 this._Form.listViewBMPリスト.BeginUpdate();
60                                 this._Form.listViewAVIリスト.BeginUpdate();
61                                 str全入力文字列 = str全入力文字列.Replace( Environment.NewLine, "\n" );
62                                 str全入力文字列 = str全入力文字列.Replace( '\t', ' ' );
63                                 StringBuilder builder = new StringBuilder();
64                                 CharEnumerator ce = str全入力文字列.GetEnumerator();
65                                 if( ce.MoveNext() )
66                                 {
67                                         do
68                                         {
69                                                 if( !this.tDTX入力_空白と改行をスキップする( ref ce ) )
70                                                 {
71                                                         break;
72                                                 }
73                                                 if( ce.Current == '#' )
74                                                 {
75                                                         if( ce.MoveNext() )
76                                                         {
77                                                                 StringBuilder sbコマンド文字列 = new StringBuilder( 0x20 );
78                                                                 if( this.tDTX入力_コマンド文字列を抜き出す( ref ce, ref sbコマンド文字列 ) )
79                                                                 {
80                                                                         StringBuilder sbパラメータ文字列 = new StringBuilder( 0x400 );
81                                                                         if( this.tDTX入力_パラメータ文字列を抜き出す( ref ce, ref sbパラメータ文字列 ) )
82                                                                         {
83                                                                                 StringBuilder sbコメント文字列 = new StringBuilder( 0x400 );
84                                                                                 if( this.tDTX入力_コメント文字列を抜き出す( ref ce, ref sbコメント文字列 ) )
85                                                                                 {
86                                                                                         if( !this.tDTX入力_行解析( ref sbコマンド文字列, ref sbパラメータ文字列, ref sbコメント文字列 ) )
87                                                                                         {
88                                                                                                 builder.Append( string.Concat( "#", sbコマンド文字列, ": ", sbパラメータ文字列 ) );
89                                                                                                 if( sbコメント文字列.Length > 0 )
90                                                                                                 {
91                                                                                                         builder.Append( "\t;" + sbコメント文字列 );
92                                                                                                 }
93                                                                                                 builder.Append( Environment.NewLine );
94                                                                                         }
95                                                                                         continue;
96                                                                                 }
97                                                                         }
98                                                                 }
99                                                         }
100                                                         break;
101                                                 }
102                                         }
103                                         while( this.tDTX入力_コメントをスキップする( ref ce ) );
104                                         CUndoRedo管理.bUndoRedoした直後 = true;
105                                         this._Form.textBox自由入力欄.Text = this._Form.textBox自由入力欄.Text + builder.ToString();
106                                         this.tDTX入力_小節内のチップリストを発声位置でソートする();
107                                         this.tDTX入力_小節長倍率配列を昇順ソート済みの小節リストに適用する();
108                                         this.tDTX入力_BPMチップにBPx数値をバインドする();
109                                         this.tDTX入力_キャッシュからListViewを一括構築する();
110                                         this.tDTX入力_チップパレットのListViewを一括構築する();
111                                         //this.tDTX入力_BEATチップにf値をバインドする();
112                                         if ( this.listBGMWAV番号.Count > 0 )                                                  // #26775 2011.11.21 yyagi
113                                         {
114                                                 foreach ( int nBGMWAV番号 in listBGMWAV番号 )                       // #26775 2011.11.21 yyagi
115                                                 {
116                                                         this._Form.mgrWAVリスト管理者.tWAVをキャッシュから検索して返す_なければ新規生成する( nBGMWAV番号 ).bBGMとして使用 = true;
117                                                 }
118                                         }
119                                         this._Form.listViewWAVリスト.EndUpdate();
120                                         this._Form.listViewBMPリスト.EndUpdate();
121                                         this._Form.listViewAVIリスト.EndUpdate();
122                                 }
123                         }
124                 }
125
126                 public enum E種別
127                 {
128                         DTX,
129                         GDA,
130                         G2D,
131                         BMS,
132                         BME
133                 }
134
135                 #region [ private ]
136                 //-----------------
137                 private Cメインフォーム _Form;
138                 private int[] arr素数リスト = new int[] {
139                         2, 3, 5, 7, 11, 13, 0x11, 0x13, 0x17, 0x1d, 0x1f, 0x25, 0x29, 0x2b, 0x2f, 0x35, 
140                         0x3b, 0x3d, 0x43, 0x47, 0x49, 0x4f, 0x53, 0x59, 0x61, 0x65, 0x67, 0x6b, 0x6d, 0x71, 0x7f, 0x83, 
141                         0x89, 0x8b, 0x95, 0x97, 0x9d, 0xa3, 0xa7, 0xad, 0xb3, 0xb5, 0xbf, 0xc1, 0xc5, 0xc7, 0xd3, 0xdf, 
142                         0xe3, 0xe5, 0xe9, 0xef, 0xf1, 0xfb, 0x101, 0x107, 0x10d, 0x10f, 0x115, 0x119, 0x11b, 0x125, 0x133, 0x137, 
143                         0x139, 0x13d, 0x14b, 0x151, 0x15b, 0x15d, 0x161, 0x167, 0x16f, 0x175, 0x17b, 0x17f
144                 };
145 #region [ #25990; for BMS/BME to DTX conversion ]
146                 // #25990 2011.8.12 yyagi: DTXのBGM用ch群(正確には効果音用ch群)
147                 private readonly int[] DTXbgmChs = new int[] {
148                               0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
149                         0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
150                         0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
151                         0x90, 0x91, 0x92
152                 };
153                 // #25990 2011.8.12 yyagi: BMS/BME→DTX チャネル変換テーブル(BGMとキーを除いて、右から左にそのまま変換)
154                 private readonly int[] BMSgeneralChToDTXgeneralCh = {
155                         0x00, -1,   0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
156                         0x10, -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
157                         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
158                         0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
159                         0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
160                         0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
161                         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
162                         0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
163                         0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
164                         0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
165                         0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
166                         0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
167                         0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
168                         0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
169                         0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
170                         0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
171                 };
172                 // #25990 2011.8.12 yyagi: BMS→DTXの、キー関係の変換表 (5鍵ならHH~LTとCYを使用)
173                 private readonly int[] BMSkeyChToDTXdrumsCh = {
174                 //      1key    2key,   3key,   4key,   5key,   scr,    free
175                         0x11,   0x12,   0x13,   0x14,   0x15,   0x16,   0x53
176                 //      HC,             SD,             BD,             HT,             LT,             CY,             FI
177                 };
178                 // #25990 2011.8.12 yyagi: BME→DTXの、キー関係の変換表 (7鍵ならLC~FTとCYを使用)
179                 private readonly int[] BMEkeyChToDTXdrumsCh = {
180                 //      1key    2key,   3key,   4key,   5key,   scr,    free,   6key,   7key
181                         0x1A,   0x11,   0x12,   0x13,   0x14,   0x16,   0x53,   0x15,   0x17
182                 //      LC,             HC,             SD,             BD,             HT,             CY,             FI,             LT,             FT
183                 };
184                 private int nLastBarConverted = -1;     // #25990 2011.8.12 yyagi BMS/BME→DTX変換用
185                 private IEnumerator eDTXbgmChs;                 // #25990 2011.8.12 yyagi BMS/BME→DTX変換用
186 #endregion
187                 private Dictionary<int, float> dic小節長倍率;
188                 private Dictionary<int, float> dicBEATチップf値;
189                 private E種別 e種別;
190                 private List<int> listチップパレット;
191                 private List<int> listBGMWAV番号 = null;                      // #26775 2011.11.21 yyagi
192                 
193                 private void tDTX入力_BPMチップにBPx数値をバインドする()
194                 {
195                         foreach( KeyValuePair<int, C小節> pair in this._Form.mgr譜面管理者.dic小節 )
196                         {
197                                 C小節 c小節 = pair.Value;
198                                 for( int i = 0; i < c小節.listチップ.Count; i++ )
199                                 {
200                                         Cチップ cチップ = c小節.listチップ[ i ];
201                                         float num2 = 0f;
202                                         if( ( cチップ.nチャンネル番号00toFF == 8 ) && this._Form.mgr譜面管理者.dicBPx.TryGetValue( cチップ.n値_整数1to1295, out num2 ) )
203                                         {
204                                                 cチップ.f値_浮動小数 = num2;
205                                         }
206                                         if( cチップ.nチャンネル番号00toFF == 3 )
207                                         {
208                                                 cチップ.nチャンネル番号00toFF = 8;
209                                                 cチップ.f値_浮動小数 = cチップ.n値_整数1to1295;
210                                                 cチップ.b裏 = false;
211                                                 for( int j = 1; j <= 36 * 36 - 1; j++ )
212                                                 {
213                                                         if( !this._Form.mgr譜面管理者.dicBPx.ContainsKey( j ) )
214                                                         {
215                                                                 this._Form.mgr譜面管理者.dicBPx.Add( j, cチップ.f値_浮動小数);
216                                                                 cチップ.n値_整数1to1295 = j;
217                                                                 break;
218                                                         }
219                                                 }
220                                         }
221                                 }
222                         }
223                 }
224                 //private void tDTX入力_BEATチップにf値をバインドする()
225                 //{
226                 //    foreach ( KeyValuePair<int, C小節> pair in this._Form.mgr譜面管理者.dic小節 )
227                 //    {
228                 //        C小節 c小節 = pair.Value;
229                 //        for ( int i = 0; i < c小節.listチップ.Count; i++ )
230                 //        {
231                 //            Cチップ cチップ = c小節.listチップ[ i ];
232                 //            float num2 = 0f;
233                 //            if ( ( cチップ.nチャンネル番号00toFF == 0xF8 || cチップ.nチャンネル番号00toFF == 0xF3 )
234                 //                && this._Form.mgr譜面管理者.dicBPx.TryGetValue( cチップ.n値・整数1to1295, out num2 ) )
235                 //            {
236                 //                cチップ.f値・浮動小数 = num2;
237                 //            }
238                 //            if ( cチップ.nチャンネル番号00toFF == 3 )
239                 //            {
240                 //                cチップ.nチャンネル番号00toFF = 8;
241                 //                cチップ.f値・浮動小数 = cチップ.n値・整数1to1295;
242                 //                cチップ.b裏 = false;
243                 //                for ( int j = 1; j <= 36 * 36 - 1; j++ )
244                 //                {
245                 //                    if ( !this._Form.mgr譜面管理者.dicBPx.ContainsKey( j ) )
246                 //                    {
247                 //                        this._Form.mgr譜面管理者.dicBPx.Add( j, cチップ.f値・浮動小数 );
248                 //                        cチップ.n値・整数1to1295 = j;
249                 //                        break;
250                 //                    }
251                 //                }
252                 //            }
253                 //        }
254                 //    }
255                 //}
256
257                 private void tDTX入力_キャッシュからListViewを一括構築する()
258                 {
259                         for( int i = 1; i <= 36 * 36 - 1; i++ )
260                         {
261                                 CWAV cwav = this._Form.mgrWAVリスト管理者.tWAVをキャッシュから検索して返す( i );
262                                 if( cwav != null )
263                                 {
264                                         cwav.tコピーto( this._Form.listViewWAVリスト.Items[ i - 1 ] );
265                                 }
266                                 CBMP cbmp = this._Form.mgrBMPリスト管理者.tBMPをキャッシュから検索して返す( i );
267                                 if( cbmp != null )
268                                 {
269                                         cbmp.tコピーto( this._Form.listViewBMPリスト.Items[ i - 1 ] );
270                                 }
271                                 CAVI cavi = this._Form.mgrAVIリスト管理者.tAVIをキャッシュから検索して返す( i );
272                                 if( cavi != null )
273                                 {
274                                         cavi.tコピーto( this._Form.listViewAVIリスト.Items[ i - 1 ] );
275                                 }
276                         }
277                 }
278                 private bool tDTX入力_コマンド文字列を抜き出す( ref CharEnumerator ce, ref StringBuilder sb文字列 )
279                 {
280                         if( this.tDTX入力_空白をスキップする( ref ce ) )
281                         {
282                                 while( ( ( ce.Current != ':' ) && ( ce.Current != ' ' ) ) && ( ( ce.Current != ';' ) && ( ce.Current != '\n' ) ) )
283                                 {
284                                         sb文字列.Append( ce.Current );
285                                         if( !ce.MoveNext() )
286                                         {
287                                                 return false;
288                                         }
289                                 }
290                                 if( ce.Current == ':' )
291                                 {
292                                         if( !ce.MoveNext() )
293                                         {
294                                                 return false;
295                                         }
296                                         if( !this.tDTX入力_空白をスキップする( ref ce ) )
297                                         {
298                                                 return false;
299                                         }
300                                 }
301                                 return true;
302                         }
303                         return false;
304                 }
305                 private bool tDTX入力_コメントをスキップする( ref CharEnumerator ce )
306                 {
307                         while( ce.Current != '\n' )
308                         {
309                                 if( !ce.MoveNext() )
310                                 {
311                                         return false;
312                                 }
313                         }
314                         return ce.MoveNext();
315                 }
316                 private bool tDTX入力_コメント文字列を抜き出す( ref CharEnumerator ce, ref StringBuilder sb文字列 )
317                 {
318                         if( ce.Current != ';' )
319                         {
320                                 return true;
321                         }
322                         if( ce.MoveNext() )
323                         {
324                                 while( ce.Current != '\n' )
325                                 {
326                                         sb文字列.Append( ce.Current );
327                                         if( !ce.MoveNext() )
328                                         {
329                                                 return false;
330                                         }
331                                 }
332                                 return true;
333                         }
334                         return false;
335                 }
336                 private void tDTX入力_チップパレットのListViewを一括構築する()
337                 {
338                         for( int i = 0; i < ( this.listチップパレット.Count / 2 ); i += 2 )
339                         {
340                                 int num2 = this.listチップパレット[ i * 2 ];
341                                 int num3 = this.listチップパレット[ ( i * 2 ) + 1 ];
342                                 string[] items = new string[ 3 ];
343                                 switch( num2 )
344                                 {
345                                         case 0:
346                                                 {
347                                                         CWAV cwav = this._Form.mgrWAVリスト管理者.tWAVをキャッシュから検索して返す( num3 );
348                                                         if( cwav != null )
349                                                         {
350                                                                 items[ 0 ] = cwav.strラベル名;
351                                                                 items[ 1 ] = C変換.str数値を36進数2桁に変換して返す( num3 );
352                                                                 items[ 2 ] = cwav.strファイル名;
353                                                                 ListViewItem item = new ListViewItem( items );
354                                                                 item.ImageIndex = num2;
355                                                                 item.ForeColor = cwav.col文字色;
356                                                                 item.BackColor = cwav.col背景色;
357                                                                 this._Form.dlgチップパレット.listViewチップリスト.Items.Add( item );
358                                                         }
359                                                         break;
360                                                 }
361                                         case 1:
362                                                 {
363                                                         CBMP cbmp = this._Form.mgrBMPリスト管理者.tBMPをキャッシュから検索して返す( num3 );
364                                                         if( cbmp != null )
365                                                         {
366                                                                 items[ 0 ] = cbmp.strラベル名;
367                                                                 items[ 1 ] = C変換.str数値を36進数2桁に変換して返す( num3 );
368                                                                 items[ 2 ] = cbmp.strファイル名;
369                                                                 ListViewItem item2 = new ListViewItem( items );
370                                                                 item2.ImageIndex = num2;
371                                                                 item2.ForeColor = cbmp.col文字色;
372                                                                 item2.BackColor = cbmp.col背景色;
373                                                                 this._Form.dlgチップパレット.listViewチップリスト.Items.Add( item2 );
374                                                         }
375                                                         break;
376                                                 }
377                                         case 2:
378                                                 {
379                                                         CAVI cavi = this._Form.mgrAVIリスト管理者.tAVIをキャッシュから検索して返す( num3 );
380                                                         if( cavi != null )
381                                                         {
382                                                                 items[ 0 ] = cavi.strラベル名;
383                                                                 items[ 1 ] = C変換.str数値を36進数2桁に変換して返す( num3 );
384                                                                 items[ 2 ] = cavi.strファイル名;
385                                                                 ListViewItem item3 = new ListViewItem( items );
386                                                                 item3.ImageIndex = num2;
387                                                                 item3.ForeColor = cavi.col文字色;
388                                                                 item3.BackColor = cavi.col背景色;
389                                                                 this._Form.dlgチップパレット.listViewチップリスト.Items.Add( item3 );
390                                                         }
391                                                         break;
392                                                 }
393                                 }
394                         }
395                 }
396                 private bool tDTX入力_パラメータ文字列を抜き出す( ref CharEnumerator ce, ref StringBuilder sb文字列 )
397                 {
398                         if( this.tDTX入力_空白をスキップする( ref ce ) )
399                         {
400                                 while( ( ce.Current != '\n' ) && ( ce.Current != ';' ) )
401                                 {
402                                         sb文字列.Append( ce.Current );
403                                         if( !ce.MoveNext() )
404                                         {
405                                                 return false;
406                                         }
407                                 }
408                                 return true;
409                         }
410                         return false;
411                 }
412                 private bool tDTX入力_空白と改行をスキップする( ref CharEnumerator ce )
413                 {
414                         while( ( ce.Current == ' ' ) || ( ce.Current == '\n' ) )
415                         {
416                                 if( !ce.MoveNext() )
417                                 {
418                                         return false;
419                                 }
420                         }
421                         return true;
422                 }
423                 private bool tDTX入力_空白をスキップする( ref CharEnumerator ce )
424                 {
425                         while( ce.Current == ' ' )
426                         {
427                                 if( !ce.MoveNext() )
428                                 {
429                                         return false;
430                                 }
431                         }
432                         return true;
433                 }
434                 private bool tDTX入力_行解析( ref StringBuilder sbコマンド, ref StringBuilder sbパラメータ, ref StringBuilder sbコメント )
435                 {
436                         string strコマンド = sbコマンド.ToString();
437                         string strパラメータ = sbパラメータ.ToString().Trim();
438                         string strコメント = sbコメント.ToString();
439                         return (
440                                 this.tDTX入力_行解析_TITLE_ARTIST_COMMENT_その他( strコマンド, strパラメータ, strコメント ) ||
441                                 this.tDTX入力_行解析_WAVVOL_VOLUME( strコマンド, strパラメータ, strコメント ) ||
442                                 this.tDTX入力_行解析_WAVPAN_PAN( strコマンド, strパラメータ, strコメント ) ||
443                                 this.tDTX入力_行解析_WAV( strコマンド, strパラメータ, strコメント ) ||
444                                 this.tDTX入力_行解析_BGMWAV( strコマンド, strパラメータ, strコメント ) ||
445                                 this.tDTX入力_行解析_BMPTEX( strコマンド, strパラメータ, strコメント ) ||
446                                 this.tDTX入力_行解析_BMP( strコマンド, strパラメータ, strコメント ) ||
447                                 this.tDTX入力_行解析_AVI_AVIPAN( strコマンド, strパラメータ, strコメント ) ||
448                                 this.tDTX入力_行解析_BPx( strコマンド, strパラメータ, strコメント ) ||
449                                 this.tDTX入力_行解析_DTXC_LANEBINDEDCHIP( strコマンド, strパラメータ, strコメント ) ||
450                                 this.tDTX入力_行解析_DTXC_WAVFORECOLOR( strコマンド, strパラメータ, strコメント ) ||
451                                 this.tDTX入力_行解析_DTXC_WAVBACKCOLOR( strコマンド, strパラメータ, strコメント ) ||
452                                 this.tDTX入力_行解析_DTXC_BMPFORECOLOR( strコマンド, strパラメータ, strコメント ) ||
453                                 this.tDTX入力_行解析_DTXC_BMPBACKCOLOR( strコマンド, strパラメータ, strコメント ) ||
454                                 this.tDTX入力_行解析_DTXC_AVIFORECOLOR( strコマンド, strパラメータ, strコメント ) ||
455                                 this.tDTX入力_行解析_DTXC_AVIBACKCOLOR( strコマンド, strパラメータ, strコメント ) ||
456                                 this.tDTX入力_行解析_DTXC_CHIPPALETTE( strコマンド, strパラメータ, strコメント ) ||
457                                 this.tDTX入力_行解析_BEATチップのf値( strコマンド, strパラメータ, strコメント ) ||
458                                 this.tDTX入力_行解析_チャンネル( strコマンド, strパラメータ, strコメント )
459                         );
460                 }
461                 private bool tDTX入力_行解析_BEATチップのf値( string strコマンド, string strパラメータ, string strコメント )
462                 {
463                         if ( strコマンド.StartsWith( "BEAT", StringComparison.OrdinalIgnoreCase ) )
464                         {
465                                 strコマンド = strコマンド.Substring( 4 );
466                         }
467                         else
468                         {
469                                 return false;
470                         }
471                         int num = C変換.n値を文字列から取得して返す( strコマンド, 0 );
472                         if ( num < 0 )
473                         {
474                                 return false;
475                         }
476
477                         // 小節番号, grid, f値
478                         string[] strParams = strパラメータ.Split( new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries );
479
480                         #region [ パラメータ引数は全3個ないと無効。]
481                         //-----------------
482                         if ( strParams.Length < 3 )
483                         {
484                                 //Trace.TraceError( "BEAT: 引数が足りません。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 );
485                                 return false;
486                         }
487                         //-----------------
488                         #endregion
489
490                         int i = 0;
491
492                         #region [ 1. 小節番号 ]
493                         //-----------------
494                         if ( string.IsNullOrEmpty( strParams[ i ] ) )
495                         {
496                                 //Trace.TraceError( "BGAPAN: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 );
497                                 return false;
498                         }
499                         int n小節番号 = C変換.n値を文字列から取得して返す( strParams[ i ], 0 );
500                         if ( n小節番号 < 0 )
501                         {
502                                 //Trace.TraceError( "BGAPAN: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 );
503                                 return false;
504                         }
505                         i++;
506                         #endregion
507                         #region [ 2. Grid ]
508                         //-----------------
509                         if ( string.IsNullOrEmpty( strParams[ i ] ) )
510                         {
511                                 //Trace.TraceError( "BGAPAN: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 );
512                                 return false;
513                         }
514                         int nGrid = C変換.n値を文字列から取得して返す( strParams[ i ], 0 );
515                         if ( nGrid < 0 )
516                         {
517                                 //Trace.TraceError( "BGAPAN: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 );
518                                 return false;
519                         }
520                         i++;
521                         #endregion
522                         #region [ 3. f値 ]
523                         //-----------------
524                         if ( string.IsNullOrEmpty( strParams[ i ] ) )
525                         {
526                                 //Trace.TraceError( "BGAPAN: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 );
527                                 return false;
528                         }
529                         decimal f値 = 0;
530                         if ( ( !this.TryParse( strParams[ i ], out f値 ) || ( f値 < 0 ) ) )
531                         {
532                                 return false;
533                         }
534                         #endregion
535 //Debug.WriteLine( "入力: n小節番号=" + n小節番号 + ", nGrid=" + nGrid + ", f値=" + f値 + ", strParam=" + strParams[i] );
536                         this.dicBEATチップf値.Add( n小節番号 *  CWholeNoteDivision.n分解能 + nGrid, (float) f値 );
537
538                         return true;
539                 }
540                 private bool tDTX入力_行解析_AVI_AVIPAN( string strコマンド, string strパラメータ, string strコメント )
541                 {
542                         if( !strコマンド.StartsWith( "AVIPAN", StringComparison.OrdinalIgnoreCase ) && strコマンド.StartsWith( "AVI", StringComparison.OrdinalIgnoreCase ) )
543                         {
544                                 strコマンド = strコマンド.Substring( 3 );
545                         }
546                         else
547                         {
548                                 return false;
549                         }
550                         int num = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );
551                         if( ( num < 1 ) || ( num > 36 * 36 - 1 ) )
552                         {
553                                 return false;
554                         }
555                         CAVI cavi = this._Form.mgrAVIリスト管理者.tAVIをキャッシュから検索して返す_なければ新規生成する( num );
556                         cavi.strラベル名 = strコメント;
557                         cavi.strファイル名 = strパラメータ;
558                         return true;
559                 }
560                 private bool tDTX入力_行解析_BGMWAV( string strコマンド, string strパラメータ, string strコメント )
561                 {
562                         if( strコマンド.StartsWith( "bgmwav", StringComparison.OrdinalIgnoreCase ) )
563                         {
564                                 strコマンド = strコマンド.Substring( 6 );
565                         }
566                         else
567                         {
568                                 return false;
569                         }
570                         int num = C変換.n36進数2桁の文字列を数値に変換して返す( strパラメータ.Substring( 0, 2 ) );
571                         if( ( num < 1 ) || ( num > 36 * 36 - 1 ) )
572                         {
573                                 return false;
574                         }
575                         this.listBGMWAV番号.Add( num );
576                         return true;
577                 }
578                 private bool tDTX入力_行解析_BMP( string strコマンド, string strパラメータ, string strコメント )
579                 {
580                         if( ( strコマンド.Length > 3 ) && strコマンド.StartsWith( "BMP", StringComparison.OrdinalIgnoreCase ) )
581                         {
582                                 strコマンド = strコマンド.Substring( 3 );
583                         }
584                         else
585                         {
586                                 return false;
587                         }
588                         int num = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );
589                         if( ( num < 1 ) || ( num > 36 * 36 - 1 ) )
590                         {
591                                 return false;
592                         }
593                         CBMP cbmp = this._Form.mgrBMPリスト管理者.tBMPをキャッシュから検索して返す_なければ新規生成する( num );
594                         cbmp.strラベル名 = strコメント;
595                         cbmp.strファイル名 = strパラメータ;
596                         cbmp.bテクスチャ = false;
597                         return true;
598                 }
599                 private bool tDTX入力_行解析_BMPTEX( string strコマンド, string strパラメータ, string strコメント )
600                 {
601                         if( strコマンド.StartsWith( "BMPTEX", StringComparison.OrdinalIgnoreCase ) )
602                         {
603                                 strコマンド = strコマンド.Substring( 6 );
604                         }
605                         else
606                         {
607                                 return false;
608                         }
609                         int num = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );
610                         if( ( num < 1 ) || ( num > 36 * 36 - 1 ) )
611                         {
612                                 return false;
613                         }
614                         CBMP cbmp = this._Form.mgrBMPリスト管理者.tBMPをキャッシュから検索して返す_なければ新規生成する( num );
615                         cbmp.strラベル名 = strコメント;
616                         cbmp.strファイル名 = strパラメータ;
617                         cbmp.bテクスチャ = true;
618                         return true;
619                 }
620                 private bool tDTX入力_行解析_BPx( string strコマンド, string strパラメータ, string strコメント )
621                 {
622                         if( strコマンド.StartsWith( "BPM", StringComparison.OrdinalIgnoreCase ) )
623                         {
624                                 strコマンド = strコマンド.Substring( 3 );
625                         }
626                         else
627                         {
628                                 return false;
629                         }
630                         int key = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );
631                         if( ( key < 1 ) || ( key > 36 * 36 - 1 ) )
632                         {
633                                 return false;
634                         }
635                         decimal result = 0;
636                         if( ( !this.TryParse( strパラメータ, out result ) || ( result < 0 ) ) || ( result > 1000 ) )               // #23880 2011.1.6 yyagi
637                         {
638                                 return false;
639                         }
640                         this._Form.mgr譜面管理者.dicBPx.Add(key, (float)result);
641                         return true;
642                 }
643                 private bool tDTX入力_行解析_DTXC_AVIBACKCOLOR( string strコマンド, string strパラメータ, string strコメント )
644                 {
645                         int nChipNo;
646                         if( !strコマンド.Equals( "DTXC_AVIBACKCOLOR", StringComparison.OrdinalIgnoreCase ) )
647                         {
648                                 return false;
649                         }
650                         string[] strArray = strパラメータ.Split( new char[] { ' ', '\t' } );
651                         if( strArray.Length < 2 )
652                         {
653                                 return false;
654                         }
655                         if( !int.TryParse( strArray[ 0 ], out nChipNo ) )
656                         {
657                                 return false;
658                         }
659                         if( ( nChipNo < 0 ) || ( nChipNo > 36 * 36 - 2 ) )
660                         {
661                                 return false;
662                         }
663                         Color color = ColorTranslator.FromHtml( strArray[ 1 ] );
664                         if( ( nChipNo >= 0 ) && ( nChipNo <= 36 * 36 - 2 ) )
665                         {
666                                 this._Form.mgrAVIリスト管理者.tAVIをキャッシュから検索して返す_なければ新規生成する( nChipNo + 1 ).col背景色 = color;
667                         }
668                         return true;
669                 }
670                 private bool tDTX入力_行解析_DTXC_AVIFORECOLOR( string strコマンド, string strパラメータ, string strコメント )
671                 {
672                         int nChipNo;
673                         if( !strコマンド.Equals( "DTXC_AVIFORECOLOR", StringComparison.OrdinalIgnoreCase ) )
674                         {
675                                 return false;
676                         }
677                         string[] strArray = strパラメータ.Split( new char[] { ' ', '\t' } );
678                         if( strArray.Length < 2 )
679                         {
680                                 return false;
681                         }
682                         if( !int.TryParse( strArray[ 0 ], out nChipNo ) )
683                         {
684                                 return false;
685                         }
686                         if( ( nChipNo < 0 ) || ( nChipNo > 36 * 36 - 2 ) )
687                         {
688                                 return false;
689                         }
690                         Color color = ColorTranslator.FromHtml( strArray[ 1 ] );
691                         if( ( nChipNo >= 0 ) && ( nChipNo <= 36 * 36 - 2 ) )
692                         {
693                                 this._Form.mgrAVIリスト管理者.tAVIをキャッシュから検索して返す_なければ新規生成する( nChipNo + 1 ).col文字色 = color;
694                         }
695                         return true;
696                 }
697                 private bool tDTX入力_行解析_DTXC_BMPBACKCOLOR( string strコマンド, string strパラメータ, string strコメント )
698                 {
699                         int nChipNo;
700                         if( !strコマンド.Equals( "DTXC_BMPBACKCOLOR", StringComparison.OrdinalIgnoreCase ) )
701                         {
702                                 return false;
703                         }
704                         string[] strArray = strパラメータ.Split( new char[] { ' ', '\t' } );
705                         if( strArray.Length < 2 )
706                         {
707                                 return false;
708                         }
709                         if( !int.TryParse( strArray[ 0 ], out nChipNo ) )
710                         {
711                                 return false;
712                         }
713                         if( ( nChipNo < 0 ) || ( nChipNo > 36 * 36 - 2 ) )
714                         {
715                                 return false;
716                         }
717                         Color color = ColorTranslator.FromHtml( strArray[ 1 ] );
718                         if( ( nChipNo >= 0 ) && ( nChipNo <= 36 * 36 - 2 ) )
719                         {
720                                 this._Form.mgrBMPリスト管理者.tBMPをキャッシュから検索して返す_なければ新規生成する( nChipNo + 1 ).col背景色 = color;
721                         }
722                         return true;
723                 }
724                 private bool tDTX入力_行解析_DTXC_BMPFORECOLOR( string strコマンド, string strパラメータ, string strコメント )
725                 {
726                         int nChipNo;
727                         if( !strコマンド.Equals( "DTXC_BMPFORECOLOR", StringComparison.OrdinalIgnoreCase ) )
728                         {
729                                 return false;
730                         }
731                         string[] strArray = strパラメータ.Split( new char[] { ' ', '\t' } );
732                         if( strArray.Length < 2 )
733                         {
734                                 return false;
735                         }
736                         if( !int.TryParse( strArray[ 0 ], out nChipNo ) )
737                         {
738                                 return false;
739                         }
740                         if( ( nChipNo < 0 ) || ( nChipNo > 36 * 36 - 2 ) )
741                         {
742                                 return false;
743                         }
744                         Color color = ColorTranslator.FromHtml( strArray[ 1 ] );
745                         if( ( nChipNo >= 0 ) && ( nChipNo <= 36 * 36 - 2 ) )
746                         {
747                                 this._Form.mgrBMPリスト管理者.tBMPをキャッシュから検索して返す_なければ新規生成する( nChipNo + 1 ).col文字色 = color;
748                         }
749                         return true;
750                 }
751                 private bool tDTX入力_行解析_DTXC_CHIPPALETTE( string strコマンド, string strパラメータ, string strコメント )
752                 {
753                         if( !strコマンド.Equals( "DTXC_CHIPPALETTE", StringComparison.OrdinalIgnoreCase ) )
754                         {
755                                 return false;
756                         }
757                         foreach( string str in strパラメータ.Split( new char[] { ' ' } ) )
758                         {
759                                 int num;
760                                 string[] strArray2 = str.Split( new char[] { ',' } );
761                                 if( ( ( strArray2.Length == 2 ) && int.TryParse( strArray2[ 0 ], out num ) ) && ( ( num >= 0 ) && ( num <= 2 ) ) )
762                                 {
763                                         int item = C変換.n36進数2桁の文字列を数値に変換して返す( strArray2[ 1 ] );
764                                         if( ( item >= 1 ) && ( item <= 36 * 36 - 1 ) )
765                                         {
766                                                 this.listチップパレット.Add( num );
767                                                 this.listチップパレット.Add( item );
768                                         }
769                                 }
770                         }
771                         return true;
772                 }
773                 private bool tDTX入力_行解析_DTXC_LANEBINDEDCHIP( string strコマンド, string strパラメータ, string strコメント )
774                 {
775                         if( strコマンド.Equals( "DTXC_LANEBINDEDCHIP", StringComparison.OrdinalIgnoreCase ) && ( strパラメータ.Length == 8 ) )
776                         {
777                                 int nLaneNo;
778                                 if( !int.TryParse( strパラメータ.Substring( 0, 2 ), out nLaneNo ) )
779                                 {
780                                         return false;
781                                 }
782                                 int nChipNoFore = C変換.n36進数2桁の文字列を数値に変換して返す( strパラメータ.Substring( 3, 2 ) );
783                                 if( ( nChipNoFore < 0 ) || ( nChipNoFore > 36 * 36 - 1 ) )
784                                 {
785                                         return false;
786                                 }
787                                 int nChipNoBack = C変換.n36進数2桁の文字列を数値に変換して返す( strパラメータ.Substring( 6, 2 ) );
788                                 if( ( nChipNoBack < 0 ) || ( nChipNoBack > 36 * 36 - 1 ) )
789                                 {
790                                         return false;
791                                 }
792                                 if( ( nLaneNo >= 0 ) && ( nLaneNo < this._Form.mgr譜面管理者.listレーン.Count ) )
793                                 {
794                                         if( nChipNoFore != 0 )
795                                         {
796                                                 this._Form.mgr譜面管理者.listレーン[ nLaneNo ].nレーン割付チップ_表0or1to1295 = nChipNoFore;
797                                         }
798                                         if( nChipNoBack != 0 )
799                                         {
800                                                 this._Form.mgr譜面管理者.listレーン[ nLaneNo ].nレーン割付チップ_裏0or1to1295 = nChipNoBack;
801                                         }
802                                         return true;
803                                 }
804                         }
805                         return false;
806                 }
807                 private bool tDTX入力_行解析_DTXC_WAVBACKCOLOR( string strコマンド, string strパラメータ, string strコメント )
808                 {
809                         int nChipNo;
810                         if( !strコマンド.Equals( "DTXC_WAVBACKCOLOR", StringComparison.OrdinalIgnoreCase ) )
811                         {
812                                 return false;
813                         }
814                         string[] strArray = strパラメータ.Split( new char[] { ' ', '\t' } );
815                         if( strArray.Length < 2 )
816                         {
817                                 return false;
818                         }
819                         if( !int.TryParse( strArray[ 0 ], out nChipNo ) )
820                         {
821                                 return false;
822                         }
823                         if( ( nChipNo < 0 ) || ( nChipNo > 36 * 36 - 2 ) )
824                         {
825                                 return false;
826                         }
827                         Color color = ColorTranslator.FromHtml( strArray[ 1 ] );
828                         if( ( nChipNo >= 0 ) && ( nChipNo <= 36 * 36 - 2 ) )
829                         {
830                                 this._Form.mgrWAVリスト管理者.tWAVをキャッシュから検索して返す_なければ新規生成する( nChipNo ).col背景色 = color;
831                         }
832                         return true;
833                 }
834                 private bool tDTX入力_行解析_DTXC_WAVFORECOLOR( string strコマンド, string strパラメータ, string strコメント )
835                 {
836                         int nChipNo;
837                         if( !strコマンド.Equals( "DTXC_WAVFORECOLOR", StringComparison.OrdinalIgnoreCase ) )
838                         {
839                                 return false;
840                         }
841                         string[] strArray = strパラメータ.Split( new char[] { ' ', '\t' } );
842                         if( strArray.Length < 2 )
843                         {
844                                 return false;
845                         }
846                         if( !int.TryParse( strArray[ 0 ], out nChipNo ) )
847                         {
848                                 return false;
849                         }
850                         if( ( nChipNo < 0 ) || ( nChipNo > 36 * 36 - 2 ) )
851                         {
852                                 return false;
853                         }
854                         Color color = ColorTranslator.FromHtml( strArray[ 1 ] );
855                         if( ( nChipNo >= 0 ) && ( nChipNo <= 36 * 36 - 2 ) )
856                         {
857                                 this._Form.mgrWAVリスト管理者.tWAVをキャッシュから検索して返す_なければ新規生成する( nChipNo ).col文字色 = color;
858                         }
859                         return true;
860                 }
861                 private bool tDTX入力_行解析_TITLE_ARTIST_COMMENT_その他( string strコマンド, string strパラメータ, string strコメント )
862                 {
863                         if( strコマンド.Equals( "TITLE", StringComparison.OrdinalIgnoreCase ) )
864                         {
865                                 CUndoRedo管理.bUndoRedoした直後 = true;
866                                 this._Form.textBox曲名.Text = strパラメータ.Trim();
867                                 return true;
868                         }
869                         if( strコマンド.Equals( "ARTIST", StringComparison.OrdinalIgnoreCase ) )
870                         {
871                                 CUndoRedo管理.bUndoRedoした直後 = true;
872                                 this._Form.textBox製作者.Text = strパラメータ.Trim();
873                                 return true;
874                         }
875                         if ( strコマンド.Equals( "GENRE", StringComparison.OrdinalIgnoreCase ) )
876                         {
877                                 CUndoRedo管理.bUndoRedoした直後 = true;
878                                 this._Form.textBoxGenre.Text = strパラメータ.Trim();
879                                 return true;
880                         }
881                         if( strコマンド.Equals( "USE556X710BGAAVI", StringComparison.OrdinalIgnoreCase) )
882                         {
883                                 CUndoRedo管理.bUndoRedoした直後 = true;
884                                 this._Form.check556x710BGAAVI.Checked = strパラメータ.Trim() == "1" ? true : false;
885                                 return true;
886                         }
887                         if( strコマンド.Equals( "COMMENT", StringComparison.OrdinalIgnoreCase ) )
888                         {
889                                 CUndoRedo管理.bUndoRedoした直後 = true;
890                                 this._Form.textBoxコメント.Text = strパラメータ.Trim();
891                                 return true;
892                         }
893                         if( strコマンド.Equals( "PANEL", StringComparison.OrdinalIgnoreCase ) )
894                         {
895                                 int dummyResult;                                                                // #23885, #26007 2011.8.13 yyagi: not to confuse "#PANEL strings (panel)" and "#PANEL int (panpot of EL)"
896                                 if ( !int.TryParse( strパラメータ, out dummyResult ) )     // 数値じゃないならPANELとみなす
897                                 {
898                                         CUndoRedo管理.bUndoRedoした直後 = true;
899                                         this._Form.textBoxパネル.Text = strパラメータ.Trim();
900                                         return true;
901                                 }                                                                                               // 数値なら、ここでは何もせず、後で#PANに拾ってもらう (PAN ELとみなす)
902                         }
903                         if( strコマンド.Equals( "PREVIEW", StringComparison.OrdinalIgnoreCase ) )
904                         {
905                                 CUndoRedo管理.bUndoRedoした直後 = true;
906                                 this._Form.textBoxPREVIEW.Text = strパラメータ.Trim();
907                                 return true;
908                         }
909                         if( strコマンド.Equals( "PREIMAGE", StringComparison.OrdinalIgnoreCase ) )
910                         {
911                                 CUndoRedo管理.bUndoRedoした直後 = true;
912                                 this._Form.textBoxPREIMAGE.Text = strパラメータ.Trim();
913                                 return true;
914                         }
915                         if( strコマンド.Equals( "STAGEFILE", StringComparison.OrdinalIgnoreCase ) )
916                         {
917                                 CUndoRedo管理.bUndoRedoした直後 = true;
918                                 this._Form.textBoxSTAGEFILE.Text = strパラメータ.Trim();
919                                 return true;
920                         }
921                         if( strコマンド.Equals( "BACKGROUND", StringComparison.OrdinalIgnoreCase ) || strコマンド.Equals( "WALL", StringComparison.OrdinalIgnoreCase ) )
922                         {
923                                 CUndoRedo管理.bUndoRedoした直後 = true;
924                                 this._Form.textBoxBACKGROUND.Text = strパラメータ.Trim();
925                                 return true;
926                         }
927                         if( strコマンド.Equals( "RESULTIMAGE", StringComparison.OrdinalIgnoreCase ) )
928                         {
929                                 CUndoRedo管理.bUndoRedoした直後 = true;
930                                 this._Form.textBoxRESULTIMAGE.Text = strパラメータ.Trim();
931                                 return true;
932                         }
933                         if( strコマンド.Equals( "BPM", StringComparison.OrdinalIgnoreCase ) )
934                         {
935                                 decimal dBpm;
936                                 if( !this.TryParse( strパラメータ, out dBpm ) )            // #23880 2011.1.6 yyagi
937                                 {
938                                         dBpm = 120.0M;
939                                 }
940                                 CUndoRedo管理.bUndoRedoした直後 = true;
941                                 this._Form.numericUpDownBPM.Value = dBpm;
942                                 return true;
943                         }
944                         if( strコマンド.Equals( "DLEVEL", StringComparison.OrdinalIgnoreCase ) )
945                         {
946                                 int nLevel;
947                                 if( !int.TryParse( strパラメータ, out nLevel ) )
948                                 {
949                                         nLevel = 0;
950                                 }
951                                 else if( nLevel < 0 )
952                                 {
953                                         nLevel = 0;
954                                 }
955                                 else if( nLevel > 100 )
956                                 {
957                                         nLevel = 100;
958                                 }
959                                 CUndoRedo管理.bUndoRedoした直後 = true;
960                                 this._Form.hScrollBarDLEVEL.Value = nLevel;
961                                 CUndoRedo管理.bUndoRedoした直後 = true;
962                                 this._Form.textBoxDLEVEL.Text = nLevel.ToString();
963                                 return true;
964                         }
965                         if( strコマンド.Equals( "GLEVEL", StringComparison.OrdinalIgnoreCase ) )
966                         {
967                                 int nLevel;
968                                 if( !int.TryParse( strパラメータ, out nLevel ) )
969                                 {
970                                         nLevel = 0;
971                                 }
972                                 else if( nLevel < 0 )
973                                 {
974                                         nLevel = 0;
975                                 }
976                                 else if( nLevel > 100 )
977                                 {
978                                         nLevel = 100;
979                                 }
980                                 CUndoRedo管理.bUndoRedoした直後 = true;
981                                 this._Form.hScrollBarGLEVEL.Value = nLevel;
982                                 CUndoRedo管理.bUndoRedoした直後 = true;
983                                 this._Form.textBoxGLEVEL.Text = nLevel.ToString();
984                                 return true;
985                         }
986                         if( strコマンド.Equals( "BLEVEL", StringComparison.OrdinalIgnoreCase ) )
987                         {
988                                 int nLevel;
989                                 if( !int.TryParse( strパラメータ, out nLevel ) )
990                                 {
991                                         nLevel = 0;
992                                 }
993                                 else if( nLevel < 0 )
994                                 {
995                                         nLevel = 0;
996                                 }
997                                 else if( nLevel > 100 )
998                                 {
999                                         nLevel = 100;
1000                                 }
1001                                 CUndoRedo管理.bUndoRedoした直後 = true;
1002                                 this._Form.hScrollBarBLEVEL.Value = nLevel;
1003                                 CUndoRedo管理.bUndoRedoした直後 = true;
1004                                 this._Form.textBoxBLEVEL.Text = nLevel.ToString();
1005                                 return true;
1006                         }
1007                         if( strコマンド.Equals( "DTXVPLAYSPEED", StringComparison.OrdinalIgnoreCase ) )
1008                         {
1009                                 decimal dPlaySpeed;
1010 //                              if ( !this.TryParse( strパラメータ, out num5 ) )           // #24790 2011.4.8 yyagi
1011                                 if ( !decimal.TryParse( strパラメータ, out dPlaySpeed ) )          // #24790 2011.4.8 yyagi
1012                                 {
1013                                         dPlaySpeed = 0M;
1014                                 }
1015                                 else if( dPlaySpeed < 0.5M )
1016                                 {
1017                                         dPlaySpeed = 0.5M;
1018                                 }
1019                                 else if( dPlaySpeed > 1.5M )
1020                                 {
1021                                         dPlaySpeed = 1.5M;
1022                                 }
1023                                 decimal dIndex = ( 1.5M - dPlaySpeed ) * 10M;
1024                                 int nIndex = (int) dIndex;
1025                                 if( nIndex < 0 )
1026                                 {
1027                                         nIndex = 0;
1028                                 }
1029                                 else if( nIndex > 10 )
1030                                 {
1031                                         nIndex = 10;
1032                                 }
1033                                 CUndoRedo管理.bUndoRedoした直後 = true;
1034                                 this._Form.toolStripComboBox演奏速度.SelectedIndex = nIndex;
1035                                 return true;
1036                         } else {
1037                                 return false;
1038                         }
1039                 }
1040                 private bool tDTX入力_行解析_WAV( string strコマンド, string strパラメータ, string strコメント )
1041                 {
1042                         if( strコマンド.StartsWith( "wav", StringComparison.OrdinalIgnoreCase ) )
1043                         {
1044                                 strコマンド = strコマンド.Substring( 3 );
1045                         }
1046                         else
1047                         {
1048                                 return false;
1049                         }
1050                         int nChipNo = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );
1051                         if( ( nChipNo < 1 ) || ( nChipNo > 36 * 36 - 1 ) )
1052                         {
1053                                 return false;
1054                         }
1055                         CWAV cwav = this._Form.mgrWAVリスト管理者.tWAVをキャッシュから検索して返す_なければ新規生成する( nChipNo );
1056                         cwav.strラベル名 = strコメント;
1057                         cwav.strファイル名 = strパラメータ;
1058                         return true;
1059                 }
1060                 private bool tDTX入力_行解析_WAVPAN_PAN( string strコマンド, string strパラメータ, string strコメント )
1061                 {
1062                         int nPan;
1063                         if( strコマンド.StartsWith( "WAVPAN", StringComparison.OrdinalIgnoreCase ) )
1064                         {
1065                                 strコマンド = strコマンド.Substring( 6 );
1066                         }
1067                         else if( strコマンド.StartsWith( "PAN", StringComparison.OrdinalIgnoreCase ) )
1068                         {
1069                                 strコマンド = strコマンド.Substring( 3 );
1070                         }
1071                         else
1072                         {
1073                                 return false;
1074                         }
1075                         if( strコマンド.Length < 2 )
1076                         {
1077                                 return false;
1078                         }
1079                         int nChipNo = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );
1080                         if( int.TryParse( strパラメータ, out nPan ) )
1081                         {
1082                                 if( nPan < -100 )
1083                                 {
1084                                         nPan = -100;
1085                                 }
1086                                 else if( nPan >= 100 )
1087                                 {
1088                                         nPan = 100;
1089                                 }
1090                                 this._Form.mgrWAVリスト管理者.tWAVをキャッシュから検索して返す_なければ新規生成する( nChipNo ).n位置_100to100 = nPan;
1091                         }
1092                         return true;
1093                 }
1094                 private bool tDTX入力_行解析_WAVVOL_VOLUME( string strコマンド, string strパラメータ, string strコメント )
1095                 {
1096                         int nVol;
1097                         if( strコマンド.StartsWith( "WAVVOL", StringComparison.OrdinalIgnoreCase ) )
1098                         {
1099                                 strコマンド = strコマンド.Substring( 6 );
1100                         }
1101                         else if( strコマンド.StartsWith( "VOLUME", StringComparison.OrdinalIgnoreCase ) )
1102                         {
1103                                 strコマンド = strコマンド.Substring( 6 );
1104                         }
1105                         else
1106                         {
1107                                 return false;
1108                         }
1109                         if( strコマンド.Length < 2 )
1110                         {
1111                                 return false;
1112                         }
1113                         int nChipNo = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );
1114                         if( int.TryParse( strパラメータ, out nVol ) )
1115                         {
1116                                 if( nVol < 0 )
1117                                 {
1118                                         nVol = 0;
1119                                 }
1120                                 else if( nVol >= 100 )
1121                                 {
1122                                         nVol = 100;
1123                                 }
1124                                 this._Form.mgrWAVリスト管理者.tWAVをキャッシュから検索して返す_なければ新規生成する( nChipNo ).n音量0to100 = nVol;
1125                         }
1126                         return true;
1127                 }
1128                 private bool tDTX入力_行解析_チャンネル( string strコマンド, string strパラメータ, string strコメント )
1129                 {
1130                         int nBar, nCh;
1131                         if( !this.tDTX入力_行解析_チャンネル_コマンドから小節番号とチャンネル番号を抜き出す( strコマンド, out nBar, out nCh ) )
1132                         {
1133                                 return false;
1134                         }
1135                         if( nCh == 2 )  // Bar Length
1136                         {
1137                                 decimal dBarLength;
1138                                 if( !this.TryParse( strパラメータ, out dBarLength ) )      // #23880 2011.1.6 yyagi
1139                                 {
1140                                         dBarLength = 1m;
1141                                 }
1142                                 this.dic小節長倍率.Add( nBar, (float)dBarLength );
1143                                 this.tDTX入力_行解析_チャンネル_小節番号に対応する小節を探すか新規に作って返す( nBar );        // #32609 2013.12.16 yyagi
1144                                 return true;
1145                         }
1146                         #region [ Guitar ]
1147                         if ( ( nCh >= 0x20 ) && ( nCh <= 0x27 ) )
1148                         {
1149                                 C小節 c小節 = this.tDTX入力_行解析_チャンネル_小節番号に対応する小節を探すか新規に作って返す( nBar );
1150                                 int startIndex = 0;
1151                                 while( ( startIndex = strパラメータ.IndexOf( '_' ) ) != -1 )
1152                                 {
1153                                         strパラメータ = strパラメータ.Remove( startIndex, 1 );
1154                                 }
1155                                 int nChips = strパラメータ.Length / 2;
1156                                 for( int i = 0; i < nChips; i++ )
1157                                 {
1158                                         int nChipNo = C変換.n36進数2桁の文字列を数値に変換して返す( strパラメータ.Substring( i * 2, 2 ) );
1159                                         if( nChipNo != 0 )
1160                                         {
1161                                                 int nLaneGtV = this._Form.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "GtV" );
1162                                                 int nLaneGtR = this._Form.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "GtR" );
1163                                                 int nLaneGtG = this._Form.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "GtG" );
1164                                                 int nLaneGtB = this._Form.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "GtB" );
1165                                                 Cチップ item = new Cチップ();
1166                                                 item.nレーン番号0to = nLaneGtV;
1167                                                 item.n位置grid = i;
1168                                                 item.n値_整数1to1295 = nChipNo;
1169                                                 item.n読み込み時の解像度 = nChips;
1170                                                 c小節.listチップ.Add( item );
1171                                                 switch( nCh )
1172                                                 {
1173                                                         case 0x20:
1174                                                                 item = new Cチップ();
1175                                                                 item.nレーン番号0to = nLaneGtR;
1176                                                                 item.n位置grid = i;
1177                                                                 item.n値_整数1to1295 = 2;
1178                                                                 item.n読み込み時の解像度 = nChips;
1179                                                                 c小節.listチップ.Add( item );
1180                                                                 break;
1181
1182                                                         case 0x21:
1183                                                                 item = new Cチップ();
1184                                                                 item.nレーン番号0to = nLaneGtB;
1185                                                                 item.n位置grid = i;
1186                                                                 item.n値_整数1to1295 = 1;
1187                                                                 item.n読み込み時の解像度 = nChips;
1188                                                                 c小節.listチップ.Add( item );
1189                                                                 break;
1190
1191                                                         case 0x22:
1192                                                                 item = new Cチップ();
1193                                                                 item.nレーン番号0to = nLaneGtG;
1194                                                                 item.n位置grid = i;
1195                                                                 item.n値_整数1to1295 = 1;
1196                                                                 item.n読み込み時の解像度 = nChips;
1197                                                                 c小節.listチップ.Add( item );
1198                                                                 break;
1199
1200                                                         case 0x23:
1201                                                                 item = new Cチップ();
1202                                                                 item.nレーン番号0to = nLaneGtG;
1203                                                                 item.n位置grid = i;
1204                                                                 item.n値_整数1to1295 = 1;
1205                                                                 item.n読み込み時の解像度 = nChips;
1206                                                                 c小節.listチップ.Add( item );
1207                                                                 item = new Cチップ();
1208                                                                 item.nレーン番号0to = nLaneGtB;
1209                                                                 item.n位置grid = i;
1210                                                                 item.n値_整数1to1295 = 1;
1211                                                                 item.n読み込み時の解像度 = nChips;
1212                                                                 c小節.listチップ.Add( item );
1213                                                                 break;
1214
1215                                                         case 0x24:
1216                                                                 item = new Cチップ();
1217                                                                 item.nレーン番号0to = nLaneGtR;
1218                                                                 item.n位置grid = i;
1219                                                                 item.n値_整数1to1295 = 1;
1220                                                                 item.n読み込み時の解像度 = nChips;
1221                                                                 c小節.listチップ.Add( item );
1222                                                                 break;
1223
1224                                                         case 0x25:
1225                                                                 item = new Cチップ();
1226                                                                 item.nレーン番号0to = nLaneGtR;
1227                                                                 item.n位置grid = i;
1228                                                                 item.n値_整数1to1295 = 1;
1229                                                                 item.n読み込み時の解像度 = nChips;
1230                                                                 c小節.listチップ.Add( item );
1231                                                                 item = new Cチップ();
1232                                                                 item.nレーン番号0to = nLaneGtB;
1233                                                                 item.n位置grid = i;
1234                                                                 item.n値_整数1to1295 = 1;
1235                                                                 item.n読み込み時の解像度 = nChips;
1236                                                                 c小節.listチップ.Add( item );
1237                                                                 break;
1238
1239                                                         case 0x26:
1240                                                                 item = new Cチップ();
1241                                                                 item.nレーン番号0to = nLaneGtR;
1242                                                                 item.n位置grid = i;
1243                                                                 item.n値_整数1to1295 = 1;
1244                                                                 item.n読み込み時の解像度 = nChips;
1245                                                                 c小節.listチップ.Add( item );
1246                                                                 item = new Cチップ();
1247                                                                 item.nレーン番号0to = nLaneGtG;
1248                                                                 item.n位置grid = i;
1249                                                                 item.n値_整数1to1295 = 1;
1250                                                                 item.n読み込み時の解像度 = nChips;
1251                                                                 c小節.listチップ.Add( item );
1252                                                                 break;
1253
1254                                                         case 0x27:
1255                                                                 item = new Cチップ();
1256                                                                 item.nレーン番号0to = nLaneGtR;
1257                                                                 item.n位置grid = i;
1258                                                                 item.n値_整数1to1295 = 1;
1259                                                                 item.n読み込み時の解像度 = nChips;
1260                                                                 c小節.listチップ.Add( item );
1261                                                                 item = new Cチップ();
1262                                                                 item.nレーン番号0to = nLaneGtG;
1263                                                                 item.n位置grid = i;
1264                                                                 item.n値_整数1to1295 = 1;
1265                                                                 item.n読み込み時の解像度 = nChips;
1266                                                                 c小節.listチップ.Add( item );
1267                                                                 item = new Cチップ();
1268                                                                 item.nレーン番号0to = nLaneGtB;
1269                                                                 item.n位置grid = i;
1270                                                                 item.n値_整数1to1295 = 1;
1271                                                                 item.n読み込み時の解像度 = nChips;
1272                                                                 c小節.listチップ.Add( item );
1273                                                                 break;
1274                                                 }
1275                                         }
1276                                 }
1277                                 return true;
1278                         }
1279                         #endregion
1280                         #region [ Bass ]
1281                         if ( ( nCh >= 0xa0 ) && ( nCh <= 0xa7 ) )
1282                         {
1283                                 C小節 c小節 = this.tDTX入力_行解析_チャンネル_小節番号に対応する小節を探すか新規に作って返す( nBar );
1284                                 int startIndex = 0;
1285                                 while( ( startIndex = strパラメータ.IndexOf( '_' ) ) != -1 )
1286                                 {
1287                                         strパラメータ = strパラメータ.Remove( startIndex, 1 );
1288                                 }
1289                                 int nChips = strパラメータ.Length / 2;
1290                                 for( int i = 0; i < nChips; i++ )
1291                                 {
1292                                         int nChipNo = C変換.n36進数2桁の文字列を数値に変換して返す( strパラメータ.Substring( i * 2, 2 ) );
1293                                         if( nChipNo != 0 )
1294                                         {
1295                                                 int nLaneBsV = this._Form.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "BsV" );
1296                                                 int nLaneBsR = this._Form.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "BsR" );
1297                                                 int nLanrBsG = this._Form.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "BsG" );
1298                                                 int nLaneBsB = this._Form.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "BsB" );
1299                                                 Cチップ item = new Cチップ();
1300                                                 item.nレーン番号0to = nLaneBsV;
1301                                                 item.n位置grid = i;
1302                                                 item.n値_整数1to1295 = nChipNo;
1303                                                 item.n読み込み時の解像度 = nChips;
1304                                                 c小節.listチップ.Add( item );
1305                                                 switch( nCh )
1306                                                 {
1307                                                         case 160:
1308                                                                 item = new Cチップ();
1309                                                                 item.nレーン番号0to = nLaneBsR;
1310                                                                 item.n位置grid = i;
1311                                                                 item.n値_整数1to1295 = 2;
1312                                                                 item.n読み込み時の解像度 = nChips;
1313                                                                 c小節.listチップ.Add( item );
1314                                                                 break;
1315
1316                                                         case 0xa1:
1317                                                                 item = new Cチップ();
1318                                                                 item.nレーン番号0to = nLaneBsB;
1319                                                                 item.n位置grid = i;
1320                                                                 item.n値_整数1to1295 = 1;
1321                                                                 item.n読み込み時の解像度 = nChips;
1322                                                                 c小節.listチップ.Add( item );
1323                                                                 break;
1324
1325                                                         case 0xa2:
1326                                                                 item = new Cチップ();
1327                                                                 item.nレーン番号0to = nLanrBsG;
1328                                                                 item.n位置grid = i;
1329                                                                 item.n値_整数1to1295 = 1;
1330                                                                 item.n読み込み時の解像度 = nChips;
1331                                                                 c小節.listチップ.Add( item );
1332                                                                 break;
1333
1334                                                         case 0xa3:
1335                                                                 item = new Cチップ();
1336                                                                 item.nレーン番号0to = nLanrBsG;
1337                                                                 item.n位置grid = i;
1338                                                                 item.n値_整数1to1295 = 1;
1339                                                                 item.n読み込み時の解像度 = nChips;
1340                                                                 c小節.listチップ.Add( item );
1341                                                                 item = new Cチップ();
1342                                                                 item.nレーン番号0to = nLaneBsB;
1343                                                                 item.n位置grid = i;
1344                                                                 item.n値_整数1to1295 = 1;
1345                                                                 item.n読み込み時の解像度 = nChips;
1346                                                                 c小節.listチップ.Add( item );
1347                                                                 break;
1348
1349                                                         case 0xa4:
1350                                                                 item = new Cチップ();
1351                                                                 item.nレーン番号0to = nLaneBsR;
1352                                                                 item.n位置grid = i;
1353                                                                 item.n値_整数1to1295 = 1;
1354                                                                 item.n読み込み時の解像度 = nChips;
1355                                                                 c小節.listチップ.Add( item );
1356                                                                 break;
1357
1358                                                         case 0xa5:
1359                                                                 item = new Cチップ();
1360                                                                 item.nレーン番号0to = nLaneBsR;
1361                                                                 item.n位置grid = i;
1362                                                                 item.n値_整数1to1295 = 1;
1363                                                                 item.n読み込み時の解像度 = nChips;
1364                                                                 c小節.listチップ.Add( item );
1365                                                                 item = new Cチップ();
1366                                                                 item.nレーン番号0to = nLaneBsB;
1367                                                                 item.n位置grid = i;
1368                                                                 item.n値_整数1to1295 = 1;
1369                                                                 item.n読み込み時の解像度 = nChips;
1370                                                                 c小節.listチップ.Add( item );
1371                                                                 break;
1372
1373                                                         case 0xa6:
1374                                                                 item = new Cチップ();
1375                                                                 item.nレーン番号0to = nLaneBsR;
1376                                                                 item.n位置grid = i;
1377                                                                 item.n値_整数1to1295 = 1;
1378                                                                 item.n読み込み時の解像度 = nChips;
1379                                                                 c小節.listチップ.Add( item );
1380                                                                 item = new Cチップ();
1381                                                                 item.nレーン番号0to = nLanrBsG;
1382                                                                 item.n位置grid = i;
1383                                                                 item.n値_整数1to1295 = 1;
1384                                                                 item.n読み込み時の解像度 = nChips;
1385                                                                 c小節.listチップ.Add( item );
1386                                                                 break;
1387
1388                                                         case 0xa7:
1389                                                                 item = new Cチップ();
1390                                                                 item.nレーン番号0to = nLaneBsR;
1391                                                                 item.n位置grid = i;
1392                                                                 item.n値_整数1to1295 = 1;
1393                                                                 item.n読み込み時の解像度 = nChips;
1394                                                                 c小節.listチップ.Add( item );
1395                                                                 item = new Cチップ();
1396                                                                 item.nレーン番号0to = nLanrBsG;
1397                                                                 item.n位置grid = i;
1398                                                                 item.n値_整数1to1295 = 1;
1399                                                                 item.n読み込み時の解像度 = nChips;
1400                                                                 c小節.listチップ.Add( item );
1401                                                                 item = new Cチップ();
1402                                                                 item.nレーン番号0to = nLaneBsB;
1403                                                                 item.n位置grid = i;
1404                                                                 item.n値_整数1to1295 = 1;
1405                                                                 item.n読み込み時の解像度 = nChips;
1406                                                                 c小節.listチップ.Add( item );
1407                                                                 break;
1408                                                 }
1409                                         }
1410                                 }
1411                                 return true;
1412                         }
1413                         #endregion
1414                         #region [ Other Channels ]
1415                         int nレーン番号 = -1;
1416                         bool flag = false;
1417                         if( this.tDTX入力_行解析_チャンネル_チャンネルに該当するレーン番号を返す( nCh, out nレーン番号, out flag ) )
1418                         {
1419                                 C小節 c小節 = this.tDTX入力_行解析_チャンネル_小節番号に対応する小節を探すか新規に作って返す( nBar );
1420                                 int nPosOf_ = 0;
1421                                 while( ( nPosOf_ = strパラメータ.IndexOf( '_' ) ) != -1 )
1422                                 {
1423                                         strパラメータ = strパラメータ.Remove( nPosOf_, 1 );
1424                                 }
1425                                 int nChips = strパラメータ.Length / 2;
1426                                 for( int i = 0; i < nChips; i++ )
1427                                 {
1428                                         int nChipNo = ( nCh == 3 ) ? C変換.n16進数2桁の文字列を数値に変換して返す( strパラメータ.Substring( i * 2, 2 ) ) : C変換.n36進数2桁の文字列を数値に変換して返す( strパラメータ.Substring( i * 2, 2 ) );
1429                                         if( nChipNo > 0 )
1430                                         {
1431                                                 Cチップ cチップ = new Cチップ();
1432                                                 cチップ.nチャンネル番号00toFF = nCh;
1433                                                 cチップ.nレーン番号0to = nレーン番号;
1434                                                 cチップ.n位置grid = i;
1435                                                 cチップ.n読み込み時の解像度 = nChips;
1436                                                 cチップ.n値_整数1to1295 = nChipNo;
1437                                                 cチップ.b裏 = flag;
1438                                                 float f;
1439                                                 if ( ( nCh == 0xF8 || nCh == 0xF3 ) &&                                                                                          // BEATチップの場合
1440                                                         dicBEATチップf値.TryGetValue( nBar * CWholeNoteDivision.n分解能 + (i * CWholeNoteDivision.n分解能 / nChips ), out f ) )
1441                                                 {
1442                                                         cチップ.f値_浮動小数 = f;
1443 //Debug.WriteLine( "f値: nBar=" + nBar + ", f値=" + f );
1444                                                 }
1445                                                 c小節.listチップ.Add( cチップ );
1446                                         }
1447                                 }
1448                                 return true;
1449                         }
1450                         StringBuilder builder = new StringBuilder( 0x400 );
1451                         builder.Append( "#" + C変換.str小節番号を文字列3桁に変換して返す( nBar ) + C変換.str数値を16進数2桁に変換して返す( nCh ) + ": " + strパラメータ );
1452                         if( strコメント.Length > 0 )
1453                         {
1454                                 builder.Append( " ;" + strコメント );
1455                         }
1456                         builder.Append( Environment.NewLine );
1457                         CUndoRedo管理.bUndoRedoした直後 = true;
1458                         this._Form.textBox自由入力欄.AppendText( builder.ToString() );
1459                         return true;
1460                         #endregion
1461                 }
1462                 private int tDTX入力_行解析_チャンネル_GDAチャンネル文字列2桁をチャンネル番号にして返す( string strチャンネル文字列2桁 )
1463                 {
1464                         if( strチャンネル文字列2桁.Length == 2 )
1465                         {
1466                                 switch( strチャンネル文字列2桁.ToUpper() )
1467                                 {
1468                                         case "TC":
1469                                                 return 3;
1470
1471                                         case "BL":
1472                                                 return 2;
1473
1474                                         case "GS":
1475                                                 return 0x29;
1476
1477                                         case "DS":
1478                                                 return 0x30;
1479
1480                                         case "FI":
1481                                                 return 0x53;
1482
1483                                         case "HH":
1484                                                 return 0x11;
1485
1486                                         case "SD":
1487                                                 return 0x12;
1488
1489                                         case "BD":
1490                                                 return 0x13;
1491
1492                                         case "HT":
1493                                                 return 0x14;
1494
1495                                         case "LT":
1496                                                 return 0x15;
1497
1498                                         case "CY":
1499                                                 return 0x16;
1500
1501                                         case "G1":
1502                                                 return 0x21;
1503
1504                                         case "G2":
1505                                                 return 0x22;
1506
1507                                         case "G3":
1508                                                 return 0x23;
1509
1510                                         case "G4":
1511                                                 return 0x24;
1512
1513                                         case "G5":
1514                                                 return 0x25;
1515
1516                                         case "G6":
1517                                                 return 0x26;
1518
1519                                         case "G7":
1520                                                 return 0x27;
1521
1522                                         case "GW":
1523                                                 return 0x28;
1524
1525                                         case "01":
1526                                                 return 0x61;
1527
1528                                         case "02":
1529                                                 return 0x62;
1530
1531                                         case "03":
1532                                                 return 0x63;
1533
1534                                         case "04":
1535                                                 return 0x64;
1536
1537                                         case "05":
1538                                                 return 0x65;
1539
1540                                         case "06":
1541                                                 return 0x66;
1542
1543                                         case "07":
1544                                                 return 0x67;
1545
1546                                         case "08":
1547                                                 return 0x68;
1548
1549                                         case "09":
1550                                                 return 0x69;
1551
1552                                         case "0A":
1553                                                 return 0x70;
1554
1555                                         case "0B":
1556                                                 return 0x71;
1557
1558                                         case "0C":
1559                                                 return 0x72;
1560
1561                                         case "0D":
1562                                                 return 0x73;
1563
1564                                         case "0E":
1565                                                 return 0x74;
1566
1567                                         case "0F":
1568                                                 return 0x75;
1569
1570                                         case "10":
1571                                                 return 0x76;
1572
1573                                         case "11":
1574                                                 return 0x77;
1575
1576                                         case "12":
1577                                                 return 0x78;
1578
1579                                         case "13":
1580                                                 return 0x79;
1581
1582                                         case "14":
1583                                                 return 0x80;
1584
1585                                         case "15":
1586                                                 return 0x81;
1587
1588                                         case "16":
1589                                                 return 0x82;
1590
1591                                         case "17":
1592                                                 return 0x83;
1593
1594                                         case "18":
1595                                                 return 0x84;
1596
1597                                         case "19":
1598                                                 return 0x85;
1599
1600                                         case "1A":
1601                                                 return 0x86;
1602
1603                                         case "1B":
1604                                                 return 0x87;
1605
1606                                         case "1C":
1607                                                 return 0x88;
1608
1609                                         case "1D":
1610                                                 return 0x89;
1611
1612                                         case "1E":
1613                                                 return 0x90;
1614
1615                                         case "1F":
1616                                                 return 0x91;
1617
1618                                         case "20":
1619                                                 return 0x92;
1620
1621                                         case "B1":
1622                                                 return 0xa1;
1623
1624                                         case "B2":
1625                                                 return 0xa2;
1626
1627                                         case "B3":
1628                                                 return 0xa3;
1629
1630                                         case "B4":
1631                                                 return 0xa4;
1632
1633                                         case "B5":
1634                                                 return 0xa5;
1635
1636                                         case "B6":
1637                                                 return 0xa6;
1638
1639                                         case "B7":
1640                                                 return 0xa7;
1641
1642                                         case "BW":
1643                                                 return 0xa8;
1644
1645                                         case "G0":
1646                                                 return 0x20;
1647
1648                                         case "B0":
1649                                                 return 0xa0;
1650                                 }
1651                         }
1652                         return -1;
1653                 }
1654
1655                 // #25990 2011.8.12 yyagi BMS/BME→DTX変換メイン
1656                 private int tDTX入力_行解析_チャンネル_BMSチャンネル文字列2桁をチャンネル番号にして返す( string strチャンネル文字列2桁, int bar, E種別 eType )
1657                 {
1658                         if ( bar >= 0 &&  strチャンネル文字列2桁.Length == 2 )
1659                         {
1660                                 if ( nLastBarConverted != bar )                 // 小節が変わったら、BGM用に使うch群
1661                                 {
1662                                         nLastBarConverted = bar;
1663                                         eDTXbgmChs.Reset();
1664                                 }
1665
1666                                 int bmsCh = Convert.ToInt32( strチャンネル文字列2桁, 16 );
1667                                 if ( bmsCh == 0x01 )                                            // BGMなら
1668                                 {
1669                                         if ( !eDTXbgmChs.MoveNext() )                   // BGM用に使うSEチャネルの空きがもう無い
1670                                         {
1671                                                 return -1;
1672                                         }
1673                                         return (int) eDTXbgmChs.Current;
1674                                 }
1675                                 else if ( 0x11 <= bmsCh && bmsCh <= 0x19 )      // 鍵盤なら
1676                                 {
1677                                         return ( eType == E種別.BMS ) ? BMSkeyChToDTXdrumsCh[ bmsCh - 0x11 ] : BMEkeyChToDTXdrumsCh[ bmsCh - 0x11 ];
1678                                 }
1679                                 else                                                                            // それ以外なら
1680                                 {
1681                                         return BMSgeneralChToDTXgeneralCh[ bmsCh ];
1682                                 }
1683                         }
1684                         return -1;
1685                 }
1686                 private bool tDTX入力_行解析_チャンネル_コマンドから小節番号とチャンネル番号を抜き出す( string strコマンド, out int n小節番号, out int nチャンネル番号 )
1687                 {
1688                         if( strコマンド.Length >= 5 )
1689                         {
1690                                 n小節番号 = C変換.n小節番号の文字列3桁を数値に変換して返す( strコマンド.Substring( 0, 3 ) );
1691                                 if( ( this.e種別 == E種別.GDA ) || ( this.e種別 == E種別.G2D ) )
1692                                 {
1693                                         nチャンネル番号 = this.tDTX入力_行解析_チャンネル_GDAチャンネル文字列2桁をチャンネル番号にして返す( strコマンド.Substring( 3, 2 ) );
1694                                 }
1695                                 else if( ( this.e種別 == E種別.BMS ) || ( this.e種別 == E種別.BME ) )   // #25990 2011.8.12 yyagi
1696                                 {
1697                                         nチャンネル番号 = this.tDTX入力_行解析_チャンネル_BMSチャンネル文字列2桁をチャンネル番号にして返す( strコマンド.Substring( 3, 2 ), n小節番号, this.e種別 );
1698                                 }
1699                                 else
1700                                 {
1701                                         nチャンネル番号 = C変換.n16進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 3, 2 ) );
1702                                 }
1703                                 return ( ( n小節番号 >= 0 ) && ( nチャンネル番号 > 0 ) );
1704                         }
1705                         n小節番号 = -1;
1706                         nチャンネル番号 = -1;
1707                         return false;
1708                 }
1709                 private bool tDTX入力_行解析_チャンネル_チャンネルに該当するレーン番号を返す( int nチャンネル番号, out int nレーン番号, out bool b裏 )
1710                 {
1711                         nレーン番号 = -1;
1712                         b裏 = false;
1713                         for( int i = 0; i < this._Form.mgr譜面管理者.listレーン.Count; i++ )
1714                         {
1715                                 Cレーン cレーン = this._Form.mgr譜面管理者.listレーン[ i ];
1716                                 if( cレーン.nチャンネル番号_表00toFF == nチャンネル番号 )
1717                                 {
1718                                         nレーン番号 = i;
1719                                         b裏 = false;
1720                                         return true;
1721                                 }
1722                                 if( cレーン.nチャンネル番号_裏00toFF == nチャンネル番号 )
1723                                 {
1724                                         nレーン番号 = i;
1725                                         b裏 = true;
1726                                         return true;
1727                                 }
1728                         }
1729                         return false;
1730                 }
1731                 private C小節 tDTX入力_行解析_チャンネル_小節番号に対応する小節を探すか新規に作って返す( int n小節番号 )
1732                 {
1733                         C小節 c小節 = this._Form.mgr譜面管理者.p小節を返す( n小節番号 );
1734                         if( c小節 == null )
1735                         {
1736                                 if( n小節番号 > this._Form.mgr譜面管理者.n現在の最大の小節番号を返す() )
1737                                 {
1738                                         for( int i = this._Form.mgr譜面管理者.n現在の最大の小節番号を返す() + 1; i <= n小節番号; i++ )
1739                                         {
1740                                                 c小節 = new C小節( i );
1741                                                 this._Form.mgr譜面管理者.dic小節.Add( i, c小節 );
1742                                         }
1743                                         return c小節;
1744                                 }
1745                                 c小節 = new C小節( n小節番号 );
1746                                 this._Form.mgr譜面管理者.dic小節.Add( n小節番号, c小節 );
1747                         }
1748                         return c小節;
1749                 }
1750                 private void tDTX入力_小節長倍率配列を昇順ソート済みの小節リストに適用する()
1751                 {
1752                         float num = 1f;
1753                         for( int i = 0; i < this._Form.mgr譜面管理者.dic小節.Count; i++ )
1754                         {
1755                                 C小節 c小節 = this._Form.mgr譜面管理者.dic小節[ i ];
1756                                 foreach( KeyValuePair<int, float> pair in this.dic小節長倍率 )
1757                                 {
1758                                         if( c小節.n小節番号0to3599 == pair.Key )
1759                                         {
1760                                                 num = pair.Value;
1761                                         }
1762                                 }
1763                                 c小節.f小節長倍率 = num;
1764                                 for( int j = 0; j < c小節.listチップ.Count; j++ )
1765                                 {
1766                                         c小節.listチップ[ j ].n位置grid = ( c小節.listチップ[ j ].n位置grid * c小節.n小節長倍率を考慮した現在の小節の高さgrid ) / c小節.listチップ[ j ].n読み込み時の解像度;
1767                                 }
1768                         }
1769                 }
1770                 private void tDTX入力_小節内のチップリストを発声位置でソートする()
1771                 {
1772                         foreach( KeyValuePair<int, C小節> pair in this._Form.mgr譜面管理者.dic小節 )
1773                         {
1774                                 pair.Value.listチップ.Sort();
1775                         }
1776                 }
1777
1778                 private void tDTX出力_AVIリスト( StreamWriter sw )
1779                 {
1780                         sw.WriteLine();
1781                         for( int i = 1; i <= 36 * 36 - 1; i++ )
1782                         {
1783                                 CAVI cavi = this._Form.mgrAVIリスト管理者.tAVIをキャッシュから検索して返す( i );
1784                                 if( ( cavi != null ) && ( cavi.strファイル名.Length > 0 ) )
1785                                 {
1786                                         string str = C変換.str数値を36進数2桁に変換して返す( cavi.nAVI番号1to1295 );
1787                                         sw.Write( "#AVI{0}: {1}", str, cavi.strファイル名 );
1788                                         if( cavi.strラベル名.Length > 0 )
1789                                         {
1790                                                 sw.Write( "\t;{0}", cavi.strラベル名 );
1791                                         }
1792                                         sw.WriteLine();
1793                                 }
1794                         }
1795                 }
1796                 private void tDTX出力_AVIリスト色設定( StreamWriter sw )
1797                 {
1798                         Color color = ColorTranslator.FromHtml( "window" );
1799                         Color color2 = ColorTranslator.FromHtml( "windowtext" );
1800                         for( int i = 1; i <= 36 * 36 - 1; i++ )
1801                         {
1802                                 CAVI cavi = this._Form.mgrAVIリスト管理者.tAVIをキャッシュから検索して返す( i );
1803                                 if( cavi != null )
1804                                 {
1805                                         if( cavi.col文字色 != color2 )
1806                                         {
1807                                                 sw.WriteLine( "#DTXC_AVIFORECOLOR: {0} {1}", i, ColorTranslator.ToHtml( cavi.col文字色 ) );
1808                                         }
1809                                         if( cavi.col背景色 != color )
1810                                         {
1811                                                 sw.WriteLine( "#DTXC_AVIBACKCOLOR: {0} {1}", i, ColorTranslator.ToHtml( cavi.col背景色 ) );
1812                                         }
1813                                 }
1814                         }
1815                 }
1816                 private void tDTX出力_BMPリスト( StreamWriter sw )
1817                 {
1818                         sw.WriteLine();
1819                         for( int i = 1; i <= 36 * 36 - 1; i++ )
1820                         {
1821                                 CBMP cbmp = this._Form.mgrBMPリスト管理者.tBMPをキャッシュから検索して返す( i );
1822                                 if( ( cbmp != null ) && ( cbmp.strファイル名.Length > 0 ) )
1823                                 {
1824                                         string str = C変換.str数値を36進数2桁に変換して返す( cbmp.nBMP番号1to1295 );
1825                                         if( !cbmp.bテクスチャ )
1826                                         {
1827                                                 sw.Write( "#BMP{0}: {1}", str, cbmp.strファイル名 );
1828                                                 if( cbmp.strラベル名.Length > 0 )
1829                                                 {
1830                                                         sw.Write( "\t;{0}", cbmp.strラベル名 );
1831                                                 }
1832                                                 sw.WriteLine();
1833                                         }
1834                                         else
1835                                         {
1836                                                 sw.Write( "#BMPTEX{0}: {1}", str, cbmp.strファイル名 );
1837                                                 if( cbmp.strラベル名.Length > 0 )
1838                                                 {
1839                                                         sw.Write( "\t;{0}", cbmp.strラベル名 );
1840                                                 }
1841                                                 sw.WriteLine();
1842                                         }
1843                                 }
1844                         }
1845                 }
1846                 private void tDTX出力_BMPリスト色設定( StreamWriter sw )
1847                 {
1848                         Color color = ColorTranslator.FromHtml( "window" );
1849                         Color color2 = ColorTranslator.FromHtml( "windowtext" );
1850                         for( int i = 1; i <= 36 * 36 - 1; i++ )
1851                         {
1852                                 CBMP cbmp = this._Form.mgrBMPリスト管理者.tBMPをキャッシュから検索して返す( i );
1853                                 if( cbmp != null )
1854                                 {
1855                                         if( cbmp.col文字色 != color2 )
1856                                         {
1857                                                 sw.WriteLine( "#DTXC_BMPFORECOLOR: {0} {1}", i, ColorTranslator.ToHtml( cbmp.col文字色 ) );
1858                                         }
1859                                         if( cbmp.col背景色 != color )
1860                                         {
1861                                                 sw.WriteLine( "#DTXC_BMPBACKCOLOR: {0} {1}", i, ColorTranslator.ToHtml( cbmp.col背景色 ) );
1862                                         }
1863                                 }
1864                         }
1865                 }
1866                 private void tDTX出力_BPxリスト( StreamWriter sw )
1867                 {
1868                         sw.WriteLine();
1869                         foreach( KeyValuePair<int, float> pair in this._Form.mgr譜面管理者.dicBPx )
1870                         {
1871                                 sw.WriteLine( "#BPM{0}: {1}", C変換.str数値を36進数2桁に変換して返す( pair.Key ), pair.Value );
1872                         }
1873                 }
1874                 private void tDTX出力_WAVリスト( StreamWriter sw, bool bBGMのみ出力 )
1875                 {
1876                         sw.WriteLine();
1877                         for( int i = 1; i <= 36 * 36 - 1; i++ )
1878                         {
1879                                 CWAV cwav = this._Form.mgrWAVリスト管理者.tWAVをキャッシュから検索して返す( i );
1880                                 if( ( ( cwav != null ) && ( cwav.strファイル名.Length > 0 ) ) && ( !bBGMのみ出力 || cwav.bBGMとして使用 ) )
1881                                 {
1882                                         string str = C変換.str数値を36進数2桁に変換して返す( cwav.nWAV番号1to1295 );
1883                                         sw.Write( "#WAV{0}: {1}", str, cwav.strファイル名 );
1884                                         if( cwav.strラベル名.Length > 0 )
1885                                         {
1886                                                 sw.Write( "\t;{0}", cwav.strラベル名 );
1887                                         }
1888                                         sw.WriteLine();
1889                                         if( cwav.n音量0to100 != 100 )
1890                                         {
1891                                                 sw.WriteLine( "#VOLUME{0}: {1}", str, cwav.n音量0to100.ToString() );
1892                                         }
1893                                         if( cwav.n位置_100to100 != 0 )
1894                                         {
1895                                                 sw.WriteLine( "#PAN{0}: {1}", str, cwav.n位置_100to100.ToString() );
1896                                         }
1897                                         if( cwav.bBGMとして使用 )
1898                                         {
1899                                                 sw.WriteLine( "#BGMWAV: {0}", str );
1900                                         }
1901                                 }
1902                         }
1903                 }
1904                 private void tDTX出力_WAVリスト色設定( StreamWriter sw )
1905                 {
1906                         Color color = ColorTranslator.FromHtml( "window" );
1907                         Color color2 = ColorTranslator.FromHtml( "windowtext" );
1908                         for( int i = 1; i <= 36 * 36 - 1; i++ )
1909                         {
1910                                 CWAV cwav = this._Form.mgrWAVリスト管理者.tWAVをキャッシュから検索して返す( i );
1911                                 if( cwav != null )
1912                                 {
1913                                         if( cwav.col文字色 != color2 )
1914                                         {
1915                                                 sw.WriteLine( "#DTXC_WAVFORECOLOR: {0} {1}", i, ColorTranslator.ToHtml( cwav.col文字色 ) );
1916                                         }
1917                                         if( cwav.col背景色 != color )
1918                                         {
1919                                                 sw.WriteLine( "#DTXC_WAVBACKCOLOR: {0} {1}", i, ColorTranslator.ToHtml( cwav.col背景色 ) );
1920                                         }
1921                                 }
1922                         }
1923                 }
1924                 private void tDTX出力_タイトルと製作者とコメントその他( StreamWriter sw )
1925                 {
1926                         sw.WriteLine();
1927                         if( this._Form.textBox曲名.Text.Length == 0 )
1928                         {
1929                                 sw.WriteLine( "#TITLE: (no title)" );
1930                         }
1931                         else
1932                         {
1933                                 sw.WriteLine( "#TITLE: " + this._Form.textBox曲名.Text );
1934                         }
1935                         if( this._Form.textBox製作者.Text.Length > 0 )
1936                         {
1937                                 sw.WriteLine( "#ARTIST: " + this._Form.textBox製作者.Text );
1938                         }
1939                         if( this._Form.textBoxGenre.Text.Length > 0 )
1940                         {
1941                                 sw.WriteLine( "#GENRE: " + this._Form.textBoxGenre.Text );
1942                         }
1943                         if( this._Form.check556x710BGAAVI.Checked )
1944                         {
1945                                 sw.WriteLine("#USE556X710BGAAVI: 1");
1946                         }
1947                         if( this._Form.textBoxコメント.Text.Length > 0 )
1948                         {
1949                                 sw.WriteLine( "#COMMENT: " + this._Form.textBoxコメント.Text );
1950                         }
1951                         if( this._Form.textBoxパネル.Text.Length > 0 )
1952                         {
1953                                 sw.WriteLine( "#PANEL: " + this._Form.textBoxパネル.Text );
1954                         }
1955                         if( this._Form.textBoxPREVIEW.Text.Length > 0 )
1956                         {
1957                                 sw.WriteLine( "#PREVIEW: " + this._Form.textBoxPREVIEW.Text );
1958                         }
1959                         if( this._Form.textBoxPREIMAGE.Text.Length > 0 )
1960                         {
1961                                 sw.WriteLine( "#PREIMAGE: " + this._Form.textBoxPREIMAGE.Text );
1962                         }
1963                         if( this._Form.textBoxSTAGEFILE.Text.Length > 0 )
1964                         {
1965                                 sw.WriteLine( "#STAGEFILE: " + this._Form.textBoxSTAGEFILE.Text );
1966                         }
1967                         if( this._Form.textBoxBACKGROUND.Text.Length > 0 )
1968                         {
1969                                 sw.WriteLine( "#BACKGROUND: " + this._Form.textBoxBACKGROUND.Text );
1970                         }
1971                         if( this._Form.textBoxRESULTIMAGE.Text.Length > 0 )
1972                         {
1973                                 sw.WriteLine( "#RESULTIMAGE: " + this._Form.textBoxRESULTIMAGE.Text );
1974                         }
1975                         if( this._Form.numericUpDownBPM.Value != 0M )
1976                         {
1977                                 sw.WriteLine( "#BPM: " + this._Form.numericUpDownBPM.Value );
1978                         }
1979                         // if( this._Form.hScrollBarDLEVEL.Value != 0 )
1980                         {
1981                                 sw.WriteLine( "#DLEVEL: " + this._Form.hScrollBarDLEVEL.Value );
1982                         }
1983                         // if( this._Form.hScrollBarGLEVEL.Value != 0 )
1984                         {
1985                                 sw.WriteLine( "#GLEVEL: " + this._Form.hScrollBarGLEVEL.Value );
1986                         }
1987                         // if( this._Form.hScrollBarBLEVEL.Value != 0 )
1988                         {
1989                                 sw.WriteLine( "#BLEVEL: " + this._Form.hScrollBarBLEVEL.Value );
1990                         }
1991                         if( this._Form.mgr譜面管理者.strPATH_WAV.Length != 0 )
1992                         {
1993                                 sw.WriteLine( "#PATH_WAV: " + this._Form.mgr譜面管理者.strPATH_WAV );
1994                         }
1995                         if( this._Form.toolStripComboBox演奏速度.SelectedIndex != 5 )
1996                         {
1997                                 sw.WriteLine( "#DTXVPLAYSPEED: " + ( 1.5f - ( this._Form.toolStripComboBox演奏速度.SelectedIndex * 0.1f ) ) );
1998                         }
1999                 }
2000                 private void tDTX出力_チップパレット( StreamWriter sw )
2001                 {
2002                         sw.Write( "#DTXC_CHIPPALETTE: " );
2003                         foreach( ListViewItem item in this._Form.dlgチップパレット.listViewチップリスト.Items )
2004                         {
2005                                 sw.Write( " {0},{1}", item.ImageIndex, item.SubItems[ 1 ].Text );
2006                         }
2007                         sw.WriteLine();
2008                 }
2009                 private void tDTX出力_レーン割付チップ( StreamWriter sw )
2010                 {
2011                         sw.WriteLine();
2012                         for( int i = 0; i < this._Form.mgr譜面管理者.listレーン.Count; i++ )
2013                         {
2014                                 Cレーン cレーン = this._Form.mgr譜面管理者.listレーン[ i ];
2015                                 if( ( cレーン.nレーン割付チップ_表0or1to1295 > 0 ) || ( cレーン.nレーン割付チップ_裏0or1to1295 > 0 ) )
2016                                 {
2017                                         sw.WriteLine( "#DTXC_LANEBINDEDCHIP: {0} {1} {2}", i.ToString( "00" ), C変換.str数値を36進数2桁に変換して返す( cレーン.nレーン割付チップ_表0or1to1295), C変換.str数値を36進数2桁に変換して返す( cレーン.nレーン割付チップ_裏0or1to1295) );
2018                                 }
2019                         }
2020                 }
2021                 private void tDTX出力_自由入力欄( StreamWriter sw )
2022                 {
2023                         sw.WriteLine();
2024                         if( this._Form.textBox自由入力欄.Text.Length > 0 )
2025                         {
2026                                 sw.WriteLine();
2027                                 sw.Write( this._Form.textBox自由入力欄.Text );
2028                                 sw.WriteLine();
2029                         }
2030                 }
2031                 private void tDTX出力_小節長倍率( StreamWriter sw )
2032                 {
2033                         sw.WriteLine();
2034                         float num = 1f;
2035                         for( int i = 0; i < this._Form.mgr譜面管理者.dic小節.Count; i++ )
2036                         {
2037                                 C小節 c小節 = this._Form.mgr譜面管理者.dic小節[ i ];
2038                                 if( c小節.f小節長倍率 != num )
2039                                 {
2040                                         num = c小節.f小節長倍率;
2041                                         sw.WriteLine( "#{0}02: {1}", C変換.str小節番号を文字列3桁に変換して返す( c小節.n小節番号0to3599 ), num );
2042                                 }
2043                         }
2044                 }
2045                 private void tDTX出力_BEATチップのf値( StreamWriter sw )
2046                 {
2047                         sw.WriteLine();
2048                         int laneBEAT = this._Form.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "BEAT" );
2049 // Debug.WriteLine( "laneBEAT=" + laneBEAT );
2050                         int c = 0;
2051                         foreach ( KeyValuePair<int, C小節> pair in this._Form.mgr譜面管理者.dic小節 )
2052                         {
2053                                 C小節 c小節 = pair.Value;
2054                                 for ( int index = 0; index < c小節.listチップ.Count; index++ )
2055                                 {
2056                                         if ( c小節.listチップ[ index ].nレーン番号0to == laneBEAT )
2057                                         {
2058 // int n小節番号 = c小節.n小節番号0to3599;
2059 // Debug.WriteLine( "n小節番号=" + c小節.n小節番号0to3599 + ", 小節内Grid=" + c小節.listチップ[ index ].n位置grid + ",lane=" + c小節.listチップ[ index ].nレーン番号0to + ", f値=" + c小節.listチップ[ index ].f値・浮動小数 );
2060                                                 //string str = C変換.str数値を36進数2桁に変換して返す( c );
2061                                                 sw.WriteLine( "#BEAT{0}: {1}, {2}, {3}", c++, c小節.n小節番号0to3599, c小節.listチップ[ index ].n位置grid, c小節.listチップ[ index ].f値_浮動小数);
2062                                         }
2063                                 }
2064                         }
2065                 }
2066                 private void tDTX出力_全チップ( StreamWriter sw )
2067                 {
2068                         sw.WriteLine();
2069                         foreach( KeyValuePair<int, C小節> pair in this._Form.mgr譜面管理者.dic小節 )
2070                         {
2071                                 C小節 c小節 = pair.Value;
2072                                 List<int> list = new List<int>();
2073                                 foreach( Cチップ cチップ in c小節.listチップ )
2074                                 {
2075                                         if( list.IndexOf( cチップ.nチャンネル番号00toFF ) < 0 )
2076                                         {
2077                                                 list.Add( cチップ.nチャンネル番号00toFF );
2078                                         }
2079                                 }
2080                                 int[,] numArray = new int[ c小節.n小節長倍率を考慮した現在の小節の高さgrid, 2 ];
2081                                 foreach( int num in list )
2082                                 {
2083                                         if( num != 0 )
2084                                         {
2085                                                 for( int num2 = 0; num2 < c小節.n小節長倍率を考慮した現在の小節の高さgrid; num2++ )
2086                                                 {
2087                                                         numArray[ num2, 0 ] = numArray[ num2, 1 ] = 0;
2088                                                 }
2089                                                 foreach( Cチップ cチップ2 in c小節.listチップ )
2090                                                 {
2091                                                         if( cチップ2.nチャンネル番号00toFF == num )
2092                                                         {
2093                                                                 numArray[ cチップ2.n位置grid, 0 ] = cチップ2.n値_整数1to1295;
2094                                                         }
2095                                                 }
2096                                                 int num3 = 0;
2097                                                 for( int num4 = 0; num4 < c小節.n小節長倍率を考慮した現在の小節の高さgrid; num4++ )
2098                                                 {
2099                                                         num3 += numArray[ num4, 0 ];
2100                                                 }
2101                                                 if( num3 != 0 )
2102                                                 {
2103                                                         int num5 = c小節.n小節長倍率を考慮した現在の小節の高さgrid;
2104                                                         foreach( int num6 in this.arr素数リスト )
2105                                                         {
2106                                                                 while( this.tDTX出力_全チップ_解像度をN分の1にできる( num6, ref numArray, num5 ) )
2107                                                                 {
2108                                                                         num5 /= num6;
2109                                                                         for( int num7 = 0; num7 < num5; num7++ )
2110                                                                         {
2111                                                                                 numArray[ num7, 0 ] = numArray[ num7 * num6, 0 ];
2112                                                                         }
2113                                                                 }
2114                                                         }
2115                                                         StringBuilder builder = new StringBuilder();
2116                                                         for( int num8 = 0; num8 < num5; num8++ )
2117                                                         {
2118                                                                 if( num == 3 )
2119                                                                 {
2120                                                                         builder.Append( C変換.str数値を16進数2桁に変換して返す( numArray[ num8, 0 ] ) );
2121                                                                 }
2122                                                                 else
2123                                                                 {
2124                                                                         builder.Append( C変換.str数値を36進数2桁に変換して返す( numArray[ num8, 0 ] ) );
2125                                                                 }
2126                                                         }
2127                                                         sw.WriteLine( "#{0}{1}: {2}", C変換.str小節番号を文字列3桁に変換して返す( c小節.n小節番号0to3599 ), C変換.str数値を16進数2桁に変換して返す( num ), builder.ToString() );
2128                                                 }
2129                                         }
2130                                 }
2131                                 for( int i = 0; i < c小節.n小節長倍率を考慮した現在の小節の高さgrid; i++ )
2132                                 {
2133                                         numArray[ i, 0 ] = numArray[ i, 1 ] = 0;
2134                                 }
2135                                 foreach( Cチップ cチップ3 in c小節.listチップ )
2136                                 {
2137                                         Cレーン cレーン = this._Form.mgr譜面管理者.listレーン[ cチップ3.nレーン番号0to ];
2138                                         switch( cレーン.eレーン種別 )
2139                                         {
2140                                                 case Cレーン.E種別.GtV:
2141                                                         {
2142                                                                 numArray[ cチップ3.n位置grid, 0 ] = cチップ3.n値_整数1to1295;
2143                                                                 continue;
2144                                                         }
2145                                                 case Cレーン.E種別.GtR:
2146                                                         {
2147                                                                 numArray[ cチップ3.n位置grid, 1 ] |= ( cチップ3.n値_整数1to1295 == 1 ) ? 0x04 : 0xFF; // OPEN = 0xFF
2148                                                                 continue;
2149                                                         }
2150                                                 case Cレーン.E種別.GtG:
2151                                                         {
2152                                                                 numArray[ cチップ3.n位置grid, 1 ] |= 0x02;
2153                                                                 continue;
2154                                                         }
2155                                                 case Cレーン.E種別.GtB:
2156                                                         {
2157                                                                 numArray[ cチップ3.n位置grid, 1 ] |= 0x01;
2158                                                                 continue;
2159                                                         }
2160                                         }
2161                                 }
2162                                 for( int j = 0; j < c小節.n小節長倍率を考慮した現在の小節の高さgrid; j++ )
2163                                 {
2164                                         if( ( numArray[ j, 0 ] == 0 ) || ( numArray[ j, 1 ] == 0 ) )
2165                                         {
2166                                                 numArray[ j, 0 ] = 0;
2167                                                 numArray[ j, 1 ] = 0;
2168                                         }
2169                                 }
2170                                 int num11 = c小節.n小節長倍率を考慮した現在の小節の高さgrid;
2171                                 foreach( int num12 in this.arr素数リスト )
2172                                 {
2173                                         while( this.tDTX出力_全チップ_解像度をN分の1にできる( num12, ref numArray, num11 ) )
2174                                         {
2175                                                 num11 /= num12;
2176                                                 for( int num13 = 0; num13 < num11; num13++ )
2177                                                 {
2178                                                         numArray[ num13, 0 ] = numArray[ num13 * num12, 0 ];
2179                                                         numArray[ num13, 1 ] = numArray[ num13 * num12, 1 ];
2180                                                 }
2181                                         }
2182                                 }
2183                                 bool[] flagArray = new bool[ 8 ];
2184                                 for( int k = 0; k < 8; k++ )
2185                                 {
2186                                         flagArray[ k ] = false;
2187                                 }
2188                                 for( int m = 0; m < num11; m++ )
2189                                 {
2190                                         if( numArray[ m, 1 ] == 0xff )
2191                                         {
2192                                                 flagArray[ 0 ] = true;
2193                                         }
2194                                         else if( numArray[ m, 1 ] != 0 )
2195                                         {
2196                                                 flagArray[ numArray[ m, 1 ] ] = true;
2197                                         }
2198                                 }
2199                                 StringBuilder[] builderArray = new StringBuilder[ 8 ];
2200                                 for( int n = 0; n < 8; n++ )
2201                                 {
2202                                         builderArray[ n ] = new StringBuilder();
2203                                 }
2204                                 for( int num17 = 0; num17 < num11; num17++ )
2205                                 {
2206                                         int num18 = ( numArray[ num17, 1 ] == 0xff ) ? 0x20 : ( numArray[ num17, 1 ] + 0x20 );
2207                                         for( int num19 = 0; num19 < 8; num19++ )
2208                                         {
2209                                                 if( flagArray[ num19 ] )
2210                                                 {
2211                                                         if( num19 == ( num18 - 0x20 ) )
2212                                                         {
2213                                                                 builderArray[ num19 ].Append( C変換.str数値を36進数2桁に変換して返す( numArray[ num17, 0 ] ) );
2214                                                         }
2215                                                         else
2216                                                         {
2217                                                                 builderArray[ num19 ].Append( "00" );
2218                                                         }
2219                                                 }
2220                                         }
2221                                 }
2222                                 for( int num20 = 0; num20 < 8; num20++ )
2223                                 {
2224                                         if( builderArray[ num20 ].Length != 0 )
2225                                         {
2226                                                 sw.WriteLine( "#{0}{1}: {2}", C変換.str小節番号を文字列3桁に変換して返す( c小節.n小節番号0to3599 ), C変換.str数値を16進数2桁に変換して返す( 0x20 + num20 ), builderArray[ num20 ].ToString() );
2227                                         }
2228                                 }
2229                                 for( int num21 = 0; num21 < c小節.n小節長倍率を考慮した現在の小節の高さgrid; num21++ )
2230                                 {
2231                                         numArray[ num21, 0 ] = numArray[ num21, 1 ] = 0;
2232                                 }
2233                                 foreach( Cチップ cチップ4 in c小節.listチップ )
2234                                 {
2235                                         Cレーン cレーン2 = this._Form.mgr譜面管理者.listレーン[ cチップ4.nレーン番号0to ];
2236                                         switch( cレーン2.eレーン種別 )
2237                                         {
2238                                                 case Cレーン.E種別.BsV:
2239                                                         {
2240                                                                 numArray[ cチップ4.n位置grid, 0 ] = cチップ4.n値_整数1to1295;
2241                                                                 continue;
2242                                                         }
2243                                                 case Cレーン.E種別.BsR:
2244                                                         {
2245                                                                 numArray[ cチップ4.n位置grid, 1 ] |= ( cチップ4.n値_整数1to1295 == 1 ) ? 4 : 0xff;   // OPEN = 0xFF
2246                                                                 continue;
2247                                                         }
2248                                                 case Cレーン.E種別.BsG:
2249                                                         {
2250                                                                 numArray[ cチップ4.n位置grid, 1 ] |= 0x02;
2251                                                                 continue;
2252                                                         }
2253                                                 case Cレーン.E種別.BsB:
2254                                                         {
2255                                                                 numArray[ cチップ4.n位置grid, 1 ] |= 0x01;
2256                                                                 continue;
2257                                                         }
2258                                         }
2259                                 }
2260                                 for( int num22 = 0; num22 < c小節.n小節長倍率を考慮した現在の小節の高さgrid; num22++ )
2261                                 {
2262                                         if( ( numArray[ num22, 0 ] == 0 ) || ( numArray[ num22, 1 ] == 0 ) )
2263                                         {
2264                                                 numArray[ num22, 0 ] = 0;
2265                                                 numArray[ num22, 1 ] = 0;
2266                                         }
2267                                 }
2268                                 int num23 = c小節.n小節長倍率を考慮した現在の小節の高さgrid;
2269                                 foreach( int num24 in this.arr素数リスト )
2270                                 {
2271                                         while( this.tDTX出力_全チップ_解像度をN分の1にできる( num24, ref numArray, num23 ) )
2272                                         {
2273                                                 num23 /= num24;
2274                                                 for( int num25 = 0; num25 < num23; num25++ )
2275                                                 {
2276                                                         numArray[ num25, 0 ] = numArray[ num25 * num24, 0 ];
2277                                                         numArray[ num25, 1 ] = numArray[ num25 * num24, 1 ];
2278                                                 }
2279                                         }
2280                                 }
2281                                 bool[] flagArray2 = new bool[ 8 ];
2282                                 for( int num26 = 0; num26 < 8; num26++ )
2283                                 {
2284                                         flagArray2[ num26 ] = false;
2285                                 }
2286                                 for( int num27 = 0; num27 < num23; num27++ )
2287                                 {
2288                                         if( numArray[ num27, 1 ] == 0xff )
2289                                         {
2290                                                 flagArray2[ 0 ] = true;
2291                                         }
2292                                         else if( numArray[ num27, 1 ] != 0 )
2293                                         {
2294                                                 flagArray2[ numArray[ num27, 1 ] ] = true;
2295                                         }
2296                                 }
2297                                 StringBuilder[] builderArray2 = new StringBuilder[ 8 ];
2298                                 for( int num28 = 0; num28 < 8; num28++ )
2299                                 {
2300                                         builderArray2[ num28 ] = new StringBuilder();
2301                                 }
2302                                 for( int num29 = 0; num29 < num23; num29++ )
2303                                 {
2304                                         int num30 = ( numArray[ num29, 1 ] == 0xff ) ? 160 : ( numArray[ num29, 1 ] + 160 );
2305                                         for( int num31 = 0; num31 < 8; num31++ )
2306                                         {
2307                                                 if( flagArray2[ num31 ] )
2308                                                 {
2309                                                         if( num31 == ( num30 - 160 ) )
2310                                                         {
2311                                                                 builderArray2[ num31 ].Append( C変換.str数値を36進数2桁に変換して返す( numArray[ num29, 0 ] ) );
2312                                                         }
2313                                                         else
2314                                                         {
2315                                                                 builderArray2[ num31 ].Append( "00" );
2316                                                         }
2317                                                 }
2318                                         }
2319                                 }
2320                                 for( int num32 = 0; num32 < 8; num32++ )
2321                                 {
2322                                         if( builderArray2[ num32 ].Length != 0 )
2323                                         {
2324                                                 sw.WriteLine( "#{0}{1}: {2}", C変換.str小節番号を文字列3桁に変換して返す( c小節.n小節番号0to3599 ), C変換.str数値を16進数2桁に変換して返す( 160 + num32 ), builderArray2[ num32 ].ToString() );
2325                                         }
2326                                 }
2327                         }
2328                 }
2329                 private bool tDTX出力_全チップ_解像度をN分の1にできる( int N, ref int[ , ] arrチップ配列, int n現在の解像度 )
2330                 {
2331                         if( ( n現在の解像度 % N ) != 0 )
2332                         {
2333                                 return false;
2334                         }
2335                         for( int i = 0; i < ( n現在の解像度 / N ); i++ )
2336                         {
2337                                 for( int j = 1; j < N; j++ )
2338                                 {
2339                                         if( arrチップ配列[ ( i * N ) + j, 0 ] != 0 )
2340                                         {
2341                                                 return false;
2342                                         }
2343                                 }
2344                         }
2345                         return true;
2346                 }
2347
2348                 #region [#23880 2010.12.30 yyagi: コンマとスペースの両方を小数点として扱うTryParse]
2349                 /// <summary>
2350                 /// 小数点としてコンマとピリオドの両方を受け付けるTryParse()
2351                 /// </summary>
2352                 /// <param name="s">strings convert to double</param>
2353                 /// <param name="result">parsed double value</param>
2354                 /// <returns>s が正常に変換された場合は true。それ以外の場合は false。</returns>
2355                 /// <exception cref="ArgumentException">style が NumberStyles 値でないか、style に NumberStyles.AllowHexSpecifier 値が含まれている</exception>
2356                 private bool TryParse(string s, out decimal result)
2357                 {       // #23880 2010.12.30 yyagi: alternative TryParse to permit both '.' and ',' for decimal point
2358                         // EU諸国での #BPM 123,45 のような記述に対応するため、
2359                         // 小数点の最終位置を検出して、それをlocaleにあった
2360                         // 文字に置き換えてからTryParse()する
2361                         // 桁区切りの文字はスキップする
2362
2363                         const string DecimalSeparators = ".,";                          // 小数点文字
2364                         const string GroupSeparators = ".,' ";                          // 桁区切り文字
2365                         const string NumberSymbols = "0123456789";                      // 数値文字
2366
2367                         int len = s.Length;                                                                     // 文字列長
2368                         int decimalPosition = len;                                                      // 真の小数点の位置 最初は文字列終端位置に仮置きする
2369
2370                         for (int i = 0; i < len; i++)
2371                         {                                                       // まず、真の小数点(一番最後に現れる小数点)の位置を求める
2372                                 char c = s[i];
2373                                 if (NumberSymbols.IndexOf(c) >= 0)
2374                                 {                               // 数値だったらスキップ
2375                                         continue;
2376                                 }
2377                                 else if (DecimalSeparators.IndexOf(c) >= 0)
2378                                 {               // 小数点文字だったら、その都度位置を上書き記憶
2379                                         decimalPosition = i;
2380                                 }
2381                                 else if (GroupSeparators.IndexOf(c) >= 0)
2382                                 {               // 桁区切り文字の場合もスキップ
2383                                         continue;
2384                                 }
2385                                 else
2386                                 {                                                                                       // 数値・小数点・区切り文字以外がきたらループ終了
2387                                         break;
2388                                 }
2389                         }
2390
2391                         StringBuilder decimalStr = new StringBuilder(16);
2392                         for (int i = 0; i < len; i++)
2393                         {                                                       // 次に、localeにあった数値文字列を生成する
2394                                 char c = s[i];
2395                                 if (NumberSymbols.IndexOf(c) >= 0)
2396                                 {                               // 数値だったら
2397                                         decimalStr.Append(c);                                                   // そのままコピー
2398                                 }
2399                                 else if (DecimalSeparators.IndexOf(c) >= 0)
2400                                 {               // 小数点文字だったら
2401                                         if (i == decimalPosition)
2402                                         {                                               // 最後に出現した小数点文字なら、localeに合った小数点を出力する
2403                                                 decimalStr.Append(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);
2404                                         }
2405                                 }
2406                                 else if (GroupSeparators.IndexOf(c) >= 0)
2407                                 {               // 桁区切り文字だったら
2408                                         continue;                                                                               // 何もしない(スキップ)
2409                                 }
2410                                 else
2411                                 {
2412                                         break;
2413                                 }
2414                         }
2415                         return decimal.TryParse(decimalStr.ToString(), out result);     // 最後に、自分のlocale向けの文字列に対してTryParse実行
2416                 }
2417                 #endregion
2418                 //-----------------
2419                 #endregion
2420         }
2421 }