#xxxxx rev242~244のリファクタを、新スキンのbranchにもマージ。
@@ -16,22 +16,26 @@ | ||
16 | 16 | { |
17 | 17 | // 定数 |
18 | 18 | |
19 | - public enum E種別 | |
19 | + public enum E種別 { DTX, GDA, G2D, BMS, BME, SMF } | |
20 | + public enum Eレーンビットパターン | |
20 | 21 | { |
21 | - DTX, | |
22 | - GDA, | |
23 | - G2D, | |
24 | - BMS, | |
25 | - BME, | |
26 | - SMF | |
27 | - } | |
22 | + OPEN = 0, | |
23 | + xxB = 1, | |
24 | + xGx = 2, | |
25 | + xGB = 3, | |
26 | + Rxx = 4, | |
27 | + RxB = 5, | |
28 | + RGx = 6, | |
29 | + RGB = 7 | |
30 | + }; | |
28 | 31 | |
32 | + | |
29 | 33 | // クラス |
30 | 34 | |
31 | 35 | public class CAVI : IDisposable |
32 | 36 | { |
33 | 37 | public CAvi avi; |
34 | - private bool bDisposed; | |
38 | + private bool bDispose済み; | |
35 | 39 | public int n番号; |
36 | 40 | public string strコメント文 = ""; |
37 | 41 | public string strファイル名 = ""; |
@@ -38,33 +42,34 @@ | ||
38 | 42 | |
39 | 43 | public void OnDeviceCreated() |
40 | 44 | { |
41 | - string str; | |
42 | - string str2 = CDTXMania.DTX.PATH_WAV; | |
43 | - if( ( str2 != null ) && ( str2.Length > 0 ) ) | |
44 | - { | |
45 | - str = str2 + this.strファイル名; | |
46 | - } | |
45 | + #region [ strAVIファイル名の作成。] | |
46 | + //----------------- | |
47 | + string strAVIファイル名; | |
48 | + if( !string.IsNullOrEmpty( CDTXMania.DTX.PATH_WAV ) ) | |
49 | + strAVIファイル名 = CDTXMania.DTX.PATH_WAV + this.strファイル名; | |
47 | 50 | else |
51 | + strAVIファイル名 = CDTXMania.DTX.strフォルダ名 + this.strファイル名; | |
52 | + //----------------- | |
53 | + #endregion | |
54 | + | |
55 | + if( !File.Exists( strAVIファイル名 ) ) | |
48 | 56 | { |
49 | - str = CDTXMania.DTX.strフォルダ名 + this.strファイル名; | |
57 | + Trace.TraceWarning( "ファイルが存在しません。({0})({1})", this.strコメント文, strAVIファイル名 ); | |
58 | + this.avi = null; | |
59 | + return; | |
50 | 60 | } |
51 | - if( File.Exists( str ) ) | |
61 | + | |
62 | + // AVI の生成。 | |
63 | + | |
64 | + try | |
52 | 65 | { |
53 | - try | |
54 | - { | |
55 | - this.avi = new CAvi( str ); | |
56 | - Trace.TraceInformation( "動画を生成しました。({0})({1})({2}frames)", new object[] { this.strコメント文, str, this.avi.GetMaxFrameCount() } ); | |
57 | - } | |
58 | - catch( Exception exception ) | |
59 | - { | |
60 | - Trace.TraceError( exception.Message ); | |
61 | - Trace.TraceError( "動画の生成に失敗しました。({0})({1})", new object[] { this.strコメント文, str } ); | |
62 | - this.avi = null; | |
63 | - } | |
66 | + this.avi = new CAvi( strAVIファイル名 ); | |
67 | + Trace.TraceInformation( "動画を生成しました。({0})({1})({2}frames)", this.strコメント文, strAVIファイル名, this.avi.GetMaxFrameCount() ); | |
64 | 68 | } |
65 | - else | |
69 | + catch( Exception e ) | |
66 | 70 | { |
67 | - Trace.TraceWarning( "ファイルが存在しません。({0})({1})", new object[] { this.strコメント文, str } ); | |
71 | + Trace.TraceError( e.Message ); | |
72 | + Trace.TraceError( "動画の生成に失敗しました。({0})({1})", this.strコメント文, strAVIファイル名 ); | |
68 | 73 | this.avi = null; |
69 | 74 | } |
70 | 75 | } |
@@ -77,26 +82,28 @@ | ||
77 | 82 | //----------------- |
78 | 83 | public void Dispose() |
79 | 84 | { |
80 | - if( !this.bDisposed ) | |
85 | + if( this.bDispose済み ) | |
86 | + return; | |
87 | + | |
88 | + if( this.avi != null ) | |
81 | 89 | { |
82 | - if( this.avi != null ) | |
83 | - { | |
84 | - string str; | |
85 | - string str2 = CDTXMania.DTX.PATH_WAV; | |
86 | - if( ( str2 != null ) && ( str2.Length > 0 ) ) | |
87 | - { | |
88 | - str = str2 + this.strファイル名; | |
89 | - } | |
90 | - else | |
91 | - { | |
92 | - str = CDTXMania.DTX.strフォルダ名 + this.strファイル名; | |
93 | - } | |
94 | - this.avi.Dispose(); | |
95 | - this.avi = null; | |
96 | - Trace.TraceInformation( "動画を解放しました。({0})({1})", new object[] { this.strコメント文, str } ); | |
97 | - } | |
98 | - this.bDisposed = true; | |
90 | + #region [ strAVIファイル名 の作成。 ] | |
91 | + //----------------- | |
92 | + string strAVIファイル名; | |
93 | + if( !string.IsNullOrEmpty( CDTXMania.DTX.PATH_WAV ) ) | |
94 | + strAVIファイル名 = CDTXMania.DTX.PATH_WAV + this.strファイル名; | |
95 | + else | |
96 | + strAVIファイル名 = CDTXMania.DTX.strフォルダ名 + this.strファイル名; | |
97 | + //----------------- | |
98 | + #endregion | |
99 | + | |
100 | + this.avi.Dispose(); | |
101 | + this.avi = null; | |
102 | + | |
103 | + Trace.TraceInformation( "動画を解放しました。({0})({1})", this.strコメント文, strAVIファイル名 ); | |
99 | 104 | } |
105 | + | |
106 | + this.bDispose済み = true; | |
100 | 107 | } |
101 | 108 | //----------------- |
102 | 109 | #endregion |
@@ -115,7 +122,16 @@ | ||
115 | 122 | |
116 | 123 | public override string ToString() |
117 | 124 | { |
118 | - return string.Format( "CAVIPAN{0}: AVI:{14}, 開始サイズ:{1}x{2}, 終了サイズ:{3}x{4}, 動画側開始位置:{5}x{6}, 動画側終了位置:{7}x{8}, 表示側開始位置:{9}x{10}, 表示側終了位置:{11}x{12}, 移動時間:{13}ct", new object[] { CDTX.tZZ( this.n番号 ), this.sz開始サイズ.Width, this.sz開始サイズ.Height, this.sz終了サイズ.Width, this.sz終了サイズ.Height, this.pt動画側開始位置.X, this.pt動画側開始位置.Y, this.pt動画側終了位置.X, this.pt動画側終了位置.Y, this.pt表示側開始位置.X, this.pt表示側開始位置.Y, this.pt表示側終了位置.X, this.pt表示側終了位置.Y, this.n移動時間ct, CDTX.tZZ( this.nAVI番号 ) } ); | |
125 | + return string.Format( "CAVIPAN{0}: AVI:{14}, 開始サイズ:{1}x{2}, 終了サイズ:{3}x{4}, 動画側開始位置:{5}x{6}, 動画側終了位置:{7}x{8}, 表示側開始位置:{9}x{10}, 表示側終了位置:{11}x{12}, 移動時間:{13}ct", | |
126 | + CDTX.tZZ( this.n番号 ), | |
127 | + this.sz開始サイズ.Width, this.sz開始サイズ.Height, | |
128 | + this.sz終了サイズ.Width, this.sz終了サイズ.Height, | |
129 | + this.pt動画側開始位置.X, this.pt動画側開始位置.Y, | |
130 | + this.pt動画側終了位置.X, this.pt動画側終了位置.Y, | |
131 | + this.pt表示側開始位置.X, this.pt表示側開始位置.Y, | |
132 | + this.pt表示側終了位置.X, this.pt表示側終了位置.Y, | |
133 | + this.n移動時間ct, | |
134 | + CDTX.tZZ( this.nAVI番号 ) ); | |
119 | 135 | } |
120 | 136 | } |
121 | 137 | public class CBGA |
@@ -128,7 +144,12 @@ | ||
128 | 144 | |
129 | 145 | public override string ToString() |
130 | 146 | { |
131 | - return string.Format( "CBGA{0}, BMP:{1}, 画像側左上座標:{2}x{3}, 画像側右下座標:{4}x{5}, 表示座標:{6}x{7}", new object[] { CDTX.tZZ( this.n番号 ), CDTX.tZZ( this.nBMP番号 ), this.pt画像側左上座標.X, this.pt画像側左上座標.Y, this.pt画像側右下座標.X, this.pt画像側右下座標.Y, this.pt表示座標.X, this.pt表示座標.Y } ); | |
147 | + return string.Format( "CBGA{0}, BMP:{1}, 画像側左上座標:{2}x{3}, 画像側右下座標:{4}x{5}, 表示座標:{6}x{7}", | |
148 | + CDTX.tZZ( this.n番号 ), | |
149 | + CDTX.tZZ( this.nBMP番号 ), | |
150 | + this.pt画像側左上座標.X, this.pt画像側左上座標.Y, | |
151 | + this.pt画像側右下座標.X, this.pt画像側右下座標.Y, | |
152 | + this.pt表示座標.X, this.pt表示座標.Y ); | |
132 | 153 | } |
133 | 154 | } |
134 | 155 | public class CBGAPAN |
@@ -145,7 +166,16 @@ | ||
145 | 166 | |
146 | 167 | public override string ToString() |
147 | 168 | { |
148 | - return string.Format( "CBGAPAN{0}: BMP:{14}, 開始サイズ:{1}x{2}, 終了サイズ:{3}x{4}, 画像側開始位置:{5}x{6}, 画像側終了位置:{7}x{8}, 表示側開始位置:{9}x{10}, 表示側終了位置:{11}x{12}, 移動時間:{13}ct", new object[] { CDTX.tZZ( this.nBMP番号 ), this.sz開始サイズ.Width, this.sz開始サイズ.Height, this.sz終了サイズ.Width, this.sz終了サイズ.Height, this.pt画像側開始位置.X, this.pt画像側開始位置.Y, this.pt画像側終了位置.X, this.pt画像側終了位置.Y, this.pt表示側開始位置.X, this.pt表示側開始位置.Y, this.pt表示側終了位置.X, this.pt表示側終了位置.Y, this.n移動時間ct, CDTX.tZZ( this.nBMP番号 ) } ); | |
169 | + return string.Format( "CBGAPAN{0}: BMP:{14}, 開始サイズ:{1}x{2}, 終了サイズ:{3}x{4}, 画像側開始位置:{5}x{6}, 画像側終了位置:{7}x{8}, 表示側開始位置:{9}x{10}, 表示側終了位置:{11}x{12}, 移動時間:{13}ct", | |
170 | + CDTX.tZZ( this.nBMP番号 ), | |
171 | + this.sz開始サイズ.Width, this.sz開始サイズ.Height, | |
172 | + this.sz終了サイズ.Width, this.sz終了サイズ.Height, | |
173 | + this.pt画像側開始位置.X, this.pt画像側開始位置.Y, | |
174 | + this.pt画像側終了位置.X, this.pt画像側終了位置.Y, | |
175 | + this.pt表示側開始位置.X, this.pt表示側開始位置.Y, | |
176 | + this.pt表示側終了位置.X, this.pt表示側終了位置.Y, | |
177 | + this.n移動時間ct, | |
178 | + CDTX.tZZ( this.nBMP番号 ) ); | |
149 | 179 | } |
150 | 180 | } |
151 | 181 | public class CBMP : IDisposable |
@@ -172,36 +202,41 @@ | ||
172 | 202 | |
173 | 203 | public void OnDeviceCreated() |
174 | 204 | { |
175 | - string str; | |
176 | - string str2 = CDTXMania.DTX.PATH_WAV; | |
177 | - if( ( str2 != null ) && ( str2.Length > 0 ) ) | |
178 | - { | |
179 | - str = str2 + this.strファイル名; | |
180 | - } | |
205 | + #region [ strテクスチャファイル名 を作成。] | |
206 | + //----------------- | |
207 | + string strテクスチャファイル名; | |
208 | + if( !string.IsNullOrEmpty( CDTXMania.DTX.PATH_WAV ) ) | |
209 | + strテクスチャファイル名 = CDTXMania.DTX.PATH_WAV + this.strファイル名; | |
181 | 210 | else |
211 | + strテクスチャファイル名 = CDTXMania.DTX.strフォルダ名 + this.strファイル名; | |
212 | + //----------------- | |
213 | + #endregion | |
214 | + | |
215 | + if( !File.Exists( strテクスチャファイル名 ) ) | |
182 | 216 | { |
183 | - str = CDTXMania.DTX.strフォルダ名 + this.strファイル名; | |
217 | + Trace.TraceWarning( "ファイルが存在しません。({0})({1})", this.strコメント文, strテクスチャファイル名 ); | |
218 | + this.tx画像 = null; | |
219 | + return; | |
184 | 220 | } |
185 | - if( File.Exists( str ) ) | |
221 | + | |
222 | + // テクスチャを作成。 | |
223 | + | |
224 | + this.tx画像 = CDTXMania.tテクスチャの生成( strテクスチャファイル名, true ); | |
225 | + | |
226 | + if( this.tx画像 != null ) | |
186 | 227 | { |
187 | - this.tx画像 = CDTXMania.tテクスチャの生成( str, true ); | |
188 | - if( this.tx画像 != null ) | |
189 | - { | |
190 | - if( CDTXMania.ConfigIni.bLog作成解放ログ出力 ) | |
191 | - { | |
192 | - Trace.TraceInformation( "テクスチャを生成しました。({0})({1})({2}x{3})", new object[] { this.strコメント文, str, this.n幅, this.n高さ } ); | |
193 | - } | |
194 | - this.bUse = true; | |
195 | - } | |
196 | - else | |
197 | - { | |
198 | - Trace.TraceError( "テクスチャの生成に失敗しました。({0})({1})", new object[] { this.strコメント文, str } ); | |
199 | - this.tx画像 = null; | |
200 | - } | |
228 | + // 作成成功。 | |
229 | + | |
230 | + if( CDTXMania.ConfigIni.bLog作成解放ログ出力 ) | |
231 | + Trace.TraceInformation( "テクスチャを生成しました。({0})({1})({2}x{3})", this.strコメント文, strテクスチャファイル名, this.n幅, this.n高さ ); | |
232 | + | |
233 | + this.bUse = true; | |
201 | 234 | } |
202 | 235 | else |
203 | 236 | { |
204 | - Trace.TraceWarning( "ファイルが存在しません。({0})({1})", new object[] { this.strコメント文, str } ); | |
237 | + // 作成失敗。 | |
238 | + | |
239 | + Trace.TraceError( "テクスチャの生成に失敗しました。({0})({1})", this.strコメント文, strテクスチャファイル名 ); | |
205 | 240 | this.tx画像 = null; |
206 | 241 | } |
207 | 242 | } |
@@ -214,29 +249,29 @@ | ||
214 | 249 | //----------------- |
215 | 250 | public void Dispose() |
216 | 251 | { |
217 | - if( !this.bDisposed済み ) | |
252 | + if( this.bDisposed済み ) | |
253 | + return; | |
254 | + | |
255 | + if( this.tx画像 != null ) | |
218 | 256 | { |
219 | - if( this.tx画像 != null ) | |
220 | - { | |
221 | - string str; | |
222 | - string str2 = CDTXMania.DTX.PATH_WAV; | |
223 | - if( ( str2 != null ) && ( str2.Length > 0 ) ) | |
224 | - { | |
225 | - str = str2 + this.strファイル名; | |
226 | - } | |
227 | - else | |
228 | - { | |
229 | - str = CDTXMania.DTX.strフォルダ名 + this.strファイル名; | |
230 | - } | |
231 | - CDTXMania.tテクスチャの解放( ref this.tx画像 ); | |
232 | - if( CDTXMania.ConfigIni.bLog作成解放ログ出力 ) | |
233 | - { | |
234 | - Trace.TraceInformation( "テクスチャを解放しました。({0})({1})", new object[] { this.strコメント文, str } ); | |
235 | - } | |
236 | - } | |
237 | - this.bUse = false; | |
238 | - this.bDisposed済み = true; | |
257 | + #region [ strテクスチャファイル名 を作成。] | |
258 | + //----------------- | |
259 | + string strテクスチャファイル名; | |
260 | + if( !string.IsNullOrEmpty( CDTXMania.DTX.PATH_WAV ) ) | |
261 | + strテクスチャファイル名 = CDTXMania.DTX.PATH_WAV + this.strファイル名; | |
262 | + else | |
263 | + strテクスチャファイル名 = CDTXMania.DTX.strフォルダ名 + this.strファイル名; | |
264 | + //----------------- | |
265 | + #endregion | |
266 | + | |
267 | + CDTXMania.tテクスチャの解放( ref this.tx画像 ); | |
268 | + | |
269 | + if( CDTXMania.ConfigIni.bLog作成解放ログ出力 ) | |
270 | + Trace.TraceInformation( "テクスチャを解放しました。({0})({1})", this.strコメント文, strテクスチャファイル名 ); | |
239 | 271 | } |
272 | + this.bUse = false; | |
273 | + | |
274 | + this.bDisposed済み = true; | |
240 | 275 | } |
241 | 276 | //----------------- |
242 | 277 | #endregion |
@@ -271,36 +306,40 @@ | ||
271 | 306 | |
272 | 307 | public void OnDeviceCreated() |
273 | 308 | { |
274 | - string str; | |
275 | - string str2 = CDTXMania.DTX.PATH_WAV; | |
276 | - if( ( str2 != null ) && ( str2.Length > 0 ) ) | |
277 | - { | |
278 | - str = str2 + this.strファイル名; | |
279 | - } | |
309 | + #region [ strテクスチャファイル名 を作成。] | |
310 | + //----------------- | |
311 | + string strテクスチャファイル名; | |
312 | + if( !string.IsNullOrEmpty( CDTXMania.DTX.PATH_WAV ) ) | |
313 | + strテクスチャファイル名 = CDTXMania.DTX.PATH_WAV + this.strファイル名; | |
280 | 314 | else |
315 | + strテクスチャファイル名 = CDTXMania.DTX.strフォルダ名 + this.strファイル名; | |
316 | + //----------------- | |
317 | + #endregion | |
318 | + | |
319 | + if( !File.Exists( strテクスチャファイル名 ) ) | |
281 | 320 | { |
282 | - str = CDTXMania.DTX.strフォルダ名 + this.strファイル名; | |
321 | + Trace.TraceWarning( "ファイルが存在しません。({0})({1})", this.strコメント文, strテクスチャファイル名 ); | |
322 | + this.tx画像 = null; | |
323 | + return; | |
283 | 324 | } |
284 | - if( File.Exists( str ) ) | |
325 | + | |
326 | + // テクスチャを作成。 | |
327 | + | |
328 | + this.tx画像 = CDTXMania.tテクスチャの生成( strテクスチャファイル名 ); | |
329 | + | |
330 | + if( this.tx画像 != null ) | |
285 | 331 | { |
286 | - this.tx画像 = CDTXMania.tテクスチャの生成( str ); | |
287 | - if( this.tx画像 != null ) | |
288 | - { | |
289 | - if( CDTXMania.ConfigIni.bLog作成解放ログ出力 ) | |
290 | - { | |
291 | - Trace.TraceInformation( "テクスチャを生成しました。({0})({1})(Gr:{2}x{3})(Tx:{4}x{5})", new object[] { this.strコメント文, str, this.tx画像.sz画像サイズ.Width, this.tx画像.sz画像サイズ.Height, this.tx画像.szテクスチャサイズ.Width, this.tx画像.szテクスチャサイズ.Height } ); | |
292 | - } | |
293 | - this.bUse = true; | |
294 | - } | |
295 | - else | |
296 | - { | |
297 | - Trace.TraceError( "テクスチャの生成に失敗しました。({0})({1})", new object[] { this.strコメント文, str } ); | |
298 | - } | |
332 | + // 作成成功 | |
333 | + | |
334 | + if( CDTXMania.ConfigIni.bLog作成解放ログ出力 ) | |
335 | + Trace.TraceInformation( "テクスチャを生成しました。({0})({1})(Gr:{2}x{3})(Tx:{4}x{5})", this.strコメント文, strテクスチャファイル名, this.tx画像.sz画像サイズ.Width, this.tx画像.sz画像サイズ.Height, this.tx画像.szテクスチャサイズ.Width, this.tx画像.szテクスチャサイズ.Height ); | |
336 | + this.bUse = true; | |
299 | 337 | } |
300 | 338 | else |
301 | 339 | { |
302 | - Trace.TraceWarning( "ファイルが存在しません。({0})({1})", new object[] { this.strコメント文, str } ); | |
303 | - this.tx画像 = null; | |
340 | + // 作成失敗 | |
341 | + | |
342 | + Trace.TraceError( "テクスチャの生成に失敗しました。({0})({1})", this.strコメント文, strテクスチャファイル名 ); | |
304 | 343 | } |
305 | 344 | } |
306 | 345 | public override string ToString() |
@@ -312,29 +351,29 @@ | ||
312 | 351 | //----------------- |
313 | 352 | public void Dispose() |
314 | 353 | { |
315 | - if( !this.bDisposed済み ) | |
354 | + if( this.bDisposed済み ) | |
355 | + return; | |
356 | + | |
357 | + if( this.tx画像 != null ) | |
316 | 358 | { |
317 | - if( this.tx画像 != null ) | |
318 | - { | |
319 | - string str; | |
320 | - string str2 = CDTXMania.DTX.PATH_WAV; | |
321 | - if( ( str2 != null ) && ( str2.Length > 0 ) ) | |
322 | - { | |
323 | - str = str2 + this.strファイル名; | |
324 | - } | |
325 | - else | |
326 | - { | |
327 | - str = CDTXMania.DTX.strフォルダ名 + this.strファイル名; | |
328 | - } | |
329 | - CDTXMania.tテクスチャの解放( ref this.tx画像 ); | |
330 | - if( CDTXMania.ConfigIni.bLog作成解放ログ出力 ) | |
331 | - { | |
332 | - Trace.TraceInformation( "テクスチャを解放しました。({0})({1})", new object[] { this.strコメント文, str } ); | |
333 | - } | |
334 | - } | |
335 | - this.bUse = false; | |
336 | - this.bDisposed済み = true; | |
359 | + #region [ strテクスチャファイル名 を作成。] | |
360 | + //----------------- | |
361 | + string strテクスチャファイル名; | |
362 | + if( !string.IsNullOrEmpty( CDTXMania.DTX.PATH_WAV ) ) | |
363 | + strテクスチャファイル名 = CDTXMania.DTX.PATH_WAV + this.strファイル名; | |
364 | + else | |
365 | + strテクスチャファイル名 = CDTXMania.DTX.strフォルダ名 + this.strファイル名; | |
366 | + //----------------- | |
367 | + #endregion | |
368 | + | |
369 | + CDTXMania.tテクスチャの解放( ref this.tx画像 ); | |
370 | + | |
371 | + if( CDTXMania.ConfigIni.bLog作成解放ログ出力 ) | |
372 | + Trace.TraceInformation( "テクスチャを解放しました。({0})({1})", this.strコメント文, strテクスチャファイル名 ); | |
337 | 373 | } |
374 | + this.bUse = false; | |
375 | + | |
376 | + this.bDisposed済み = true; | |
338 | 377 | } |
339 | 378 | //----------------- |
340 | 379 | #endregion |
@@ -509,12 +548,14 @@ | ||
509 | 548 | } |
510 | 549 | } |
511 | 550 | public bool bIsAutoPlayed; // 2011.6.10 yyagi |
551 | + | |
512 | 552 | public CChip() |
513 | 553 | { |
514 | - this.nバーからの距離dot = new STDGBVALUE<int>(); | |
515 | - this.nバーからの距離dot.Drums = 0; | |
516 | - this.nバーからの距離dot.Guitar = 0; | |
517 | - this.nバーからの距離dot.Bass = 0; | |
554 | + this.nバーからの距離dot = new STDGBVALUE<int>() { | |
555 | + Drums = 0, | |
556 | + Guitar = 0, | |
557 | + Bass = 0, | |
558 | + }; | |
518 | 559 | } |
519 | 560 | public void t初期化() |
520 | 561 | { |
@@ -541,27 +582,27 @@ | ||
541 | 582 | string str = ""; |
542 | 583 | switch( this.nチャンネル番号 ) |
543 | 584 | { |
544 | - case 1: | |
585 | + case 0x01: | |
545 | 586 | str = "バックコーラス"; |
546 | 587 | break; |
547 | 588 | |
548 | - case 2: | |
589 | + case 0x02: | |
549 | 590 | str = "小節長変更"; |
550 | 591 | break; |
551 | 592 | |
552 | - case 3: | |
593 | + case 0x03: | |
553 | 594 | str = "BPM変更"; |
554 | 595 | break; |
555 | 596 | |
556 | - case 4: | |
597 | + case 0x04: | |
557 | 598 | str = "BMPレイヤ1"; |
558 | 599 | break; |
559 | 600 | |
560 | - case 7: | |
601 | + case 0x07: | |
561 | 602 | str = "BMPレイヤ2"; |
562 | 603 | break; |
563 | 604 | |
564 | - case 8: | |
605 | + case 0x08: | |
565 | 606 | str = "BPM変更(拡張)"; |
566 | 607 | break; |
567 | 608 |
@@ -577,7 +618,7 @@ | ||
577 | 618 | str = "Kick"; |
578 | 619 | break; |
579 | 620 | |
580 | - case 20: | |
621 | + case 0x14: | |
581 | 622 | str = "HiTom"; |
582 | 623 | break; |
583 | 624 |
@@ -641,7 +682,7 @@ | ||
641 | 682 | str = "ギター R G B"; |
642 | 683 | break; |
643 | 684 | |
644 | - case 40: | |
685 | + case 0x28: | |
645 | 686 | str = "ギターWailing"; |
646 | 687 | break; |
647 | 688 |
@@ -653,7 +694,7 @@ | ||
653 | 694 | str = "HHClose(不可視)"; |
654 | 695 | break; |
655 | 696 | |
656 | - case 50: | |
697 | + case 0x32: | |
657 | 698 | str = "Snare(不可視)"; |
658 | 699 | break; |
659 | 700 |
@@ -689,7 +730,7 @@ | ||
689 | 730 | str = "LeftCymbal(不可視)"; |
690 | 731 | break; |
691 | 732 | |
692 | - case 80: | |
733 | + case 0x50: | |
693 | 734 | str = "小節線"; |
694 | 735 | break; |
695 | 736 |
@@ -745,7 +786,7 @@ | ||
745 | 786 | str = "SE03"; |
746 | 787 | break; |
747 | 788 | |
748 | - case 100: | |
789 | + case 0x64: | |
749 | 790 | str = "SE04"; |
750 | 791 | break; |
751 | 792 |
@@ -801,7 +842,7 @@ | ||
801 | 842 | str = "SE17"; |
802 | 843 | break; |
803 | 844 | |
804 | - case 120: | |
845 | + case 0x78: | |
805 | 846 | str = "SE18"; |
806 | 847 | break; |
807 | 848 |
@@ -817,7 +858,7 @@ | ||
817 | 858 | str = "SE21"; |
818 | 859 | break; |
819 | 860 | |
820 | - case 130: | |
861 | + case 0x82: | |
821 | 862 | str = "SE22"; |
822 | 863 | break; |
823 | 864 |
@@ -861,7 +902,7 @@ | ||
861 | 902 | str = "SE32"; |
862 | 903 | break; |
863 | 904 | |
864 | - case 160: | |
905 | + case 0xa0: | |
865 | 906 | str = "ベースOPEN"; |
866 | 907 | break; |
867 | 908 |
@@ -913,7 +954,7 @@ | ||
913 | 954 | str = "Kick(空うち)"; |
914 | 955 | break; |
915 | 956 | |
916 | - case 180: | |
957 | + case 0xb4: | |
917 | 958 | str = "HiTom(空うち)"; |
918 | 959 | break; |
919 | 960 |
@@ -985,7 +1026,16 @@ | ||
985 | 1026 | str = "??"; |
986 | 1027 | break; |
987 | 1028 | } |
988 | - return string.Format( "CChip: 位置:{0:D4}.{1:D3}, 時刻{2:D6}, Ch:{3:X2}({4}), Pn:{5}({11})(内部{6}), Pd:{7}, Sz:{8}, UseWav:{9}, Auto:{10}", new object[] { this.n発声位置 / 384, this.n発声位置 % 384, this.n発声時刻ms, this.nチャンネル番号, str, this.n整数値, this.n整数値・内部番号, this.db実数値, this.dbチップサイズ倍率, this.bWAVを使うチャンネルである, this.b自動再生音チャンネルである, CDTX.tZZ( this.n整数値 ) } ); | |
1029 | + return string.Format( "CChip: 位置:{0:D4}.{1:D3}, 時刻{2:D6}, Ch:{3:X2}({4}), Pn:{5}({11})(内部{6}), Pd:{7}, Sz:{8}, UseWav:{9}, Auto:{10}", | |
1030 | + this.n発声位置 / 384, this.n発声位置 % 384, | |
1031 | + this.n発声時刻ms, | |
1032 | + this.nチャンネル番号, str, | |
1033 | + this.n整数値, this.n整数値・内部番号, | |
1034 | + this.db実数値, | |
1035 | + this.dbチップサイズ倍率, | |
1036 | + this.bWAVを使うチャンネルである, | |
1037 | + this.b自動再生音チャンネルである, | |
1038 | + CDTX.tZZ( this.n整数値 ) ); | |
989 | 1039 | } |
990 | 1040 | |
991 | 1041 | #region [ IComparable 実装 ] |
@@ -992,40 +1042,46 @@ | ||
992 | 1042 | //----------------- |
993 | 1043 | public int CompareTo( CDTX.CChip other ) |
994 | 1044 | { |
995 | - byte[] buffer = new byte[] { | |
996 | - 5, 5, 3, 3, 5, 5, 5, 5, 3, 5, 5, 5, 5, 5, 5, 5, | |
997 | - 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, | |
998 | - 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, | |
999 | - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1000 | - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1001 | - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1002 | - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1003 | - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1004 | - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1005 | - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1006 | - 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, | |
1007 | - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1008 | - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1009 | - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1010 | - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1011 | - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 | |
1012 | - }; | |
1045 | + byte[] n優先度 = new byte[] { | |
1046 | + 5, 5, 3, 3, 5, 5, 5, 5, 3, 5, 5, 5, 5, 5, 5, 5, | |
1047 | + 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, | |
1048 | + 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, | |
1049 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1050 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1051 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1052 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1053 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1054 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1055 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1056 | + 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, | |
1057 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1058 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1059 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1060 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1061 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
1062 | + }; | |
1063 | + | |
1064 | + | |
1065 | + // まずは位置で比較。 | |
1066 | + | |
1013 | 1067 | if( this.n発声位置 < other.n発声位置 ) |
1014 | - { | |
1015 | 1068 | return -1; |
1016 | - } | |
1069 | + | |
1017 | 1070 | if( this.n発声位置 > other.n発声位置 ) |
1018 | - { | |
1019 | 1071 | return 1; |
1020 | - } | |
1021 | - if( buffer[ this.nチャンネル番号 ] < buffer[ other.nチャンネル番号 ] ) | |
1022 | - { | |
1072 | + | |
1073 | + | |
1074 | + // 位置が同じなら優先度で比較。 | |
1075 | + | |
1076 | + if( n優先度[ this.nチャンネル番号 ] < n優先度[ other.nチャンネル番号 ] ) | |
1023 | 1077 | return -1; |
1024 | - } | |
1025 | - if( buffer[ this.nチャンネル番号 ] > buffer[ other.nチャンネル番号 ] ) | |
1026 | - { | |
1078 | + | |
1079 | + if( n優先度[ this.nチャンネル番号 ] > n優先度[ other.nチャンネル番号 ] ) | |
1027 | 1080 | return 1; |
1028 | - } | |
1081 | + | |
1082 | + | |
1083 | + // 位置も優先度も同じなら同じと返す。 | |
1084 | + | |
1029 | 1085 | return 0; |
1030 | 1086 | } |
1031 | 1087 | //----------------- |
@@ -1034,7 +1090,7 @@ | ||
1034 | 1090 | public class CWAV : IDisposable |
1035 | 1091 | { |
1036 | 1092 | public bool bBGMとして使う; |
1037 | - public List<int> listこのWAVを使用するチャンネル番号の集合 = new List<int>( 0x10 ); | |
1093 | + public List<int> listこのWAVを使用するチャンネル番号の集合 = new List<int>( 16 ); | |
1038 | 1094 | public int nチップサイズ = 100; |
1039 | 1095 | public int n位置; |
1040 | 1096 | public long[] n一時停止時刻 = new long[ 4 ]; |
@@ -1060,44 +1116,52 @@ | ||
1060 | 1116 | |
1061 | 1117 | public override string ToString() |
1062 | 1118 | { |
1063 | - StringBuilder builder = new StringBuilder( 0x80 ); | |
1119 | + var sb = new StringBuilder( 128 ); | |
1120 | + | |
1064 | 1121 | if( this.n表記上の番号 == this.n内部番号 ) |
1065 | 1122 | { |
1066 | - builder.Append( string.Format( "CWAV{0}: ", CDTX.tZZ( this.n表記上の番号 ) ) ); | |
1123 | + sb.Append( string.Format( "CWAV{0}: ", CDTX.tZZ( this.n表記上の番号 ) ) ); | |
1067 | 1124 | } |
1068 | 1125 | else |
1069 | 1126 | { |
1070 | - builder.Append( string.Format( "CWAV{0}(内部{1}): ", CDTX.tZZ( this.n表記上の番号 ), this.n内部番号 ) ); | |
1127 | + sb.Append( string.Format( "CWAV{0}(内部{1}): ", CDTX.tZZ( this.n表記上の番号 ), this.n内部番号 ) ); | |
1071 | 1128 | } |
1072 | - builder.Append( string.Format( "音量:{0}, 位置:{1}, サイズ:{2}, BGM:{3}, File:{4}, Comment:{5}", new object[] { this.n音量, this.n位置, this.nチップサイズ, this.bBGMとして使う ? 'Y' : 'N', this.strファイル名, this.strコメント文 } ) ); | |
1073 | - return builder.ToString(); | |
1129 | + sb.Append( string.Format( "音量:{0}, 位置:{1}, サイズ:{2}, BGM:{3}, File:{4}, Comment:{5}", this.n音量, this.n位置, this.nチップサイズ, this.bBGMとして使う ? 'Y' : 'N', this.strファイル名, this.strコメント文 ) ); | |
1130 | + | |
1131 | + return sb.ToString(); | |
1074 | 1132 | } |
1075 | 1133 | |
1076 | - #region [ IDisposable+α実装 ] | |
1134 | + #region [ Dispose-Finalize パターン実装 ] | |
1077 | 1135 | //----------------- |
1078 | 1136 | public void Dispose() |
1079 | 1137 | { |
1080 | 1138 | this.Dispose( true ); |
1139 | + GC.SuppressFinalize( this ); | |
1081 | 1140 | } |
1082 | - public void Dispose( bool bサウンドのDisposeも行う ) | |
1141 | + public void Dispose( bool bManagedリソースの解放も行う ) | |
1083 | 1142 | { |
1084 | - if( !this.bDisposed済み ) | |
1143 | + if( this.bDisposed済み ) | |
1144 | + return; | |
1145 | + | |
1146 | + if( bManagedリソースの解放も行う ) | |
1085 | 1147 | { |
1086 | 1148 | for( int i = 0; i < 4; i++ ) |
1087 | 1149 | { |
1088 | - if( bサウンドのDisposeも行う && ( this.rSound[ i ] != null ) ) | |
1089 | - { | |
1150 | + if( this.rSound[ i ] != null ) | |
1090 | 1151 | CDTXMania.Sound管理.tサウンドを破棄する( this.rSound[ i ] ); |
1091 | - } | |
1092 | 1152 | this.rSound[ i ] = null; |
1153 | + | |
1093 | 1154 | if( ( i == 0 ) && CDTXMania.ConfigIni.bLog作成解放ログ出力 ) |
1094 | - { | |
1095 | - Trace.TraceInformation( "サウンドを解放しました。({0})({1})", new object[] { this.strコメント文, this.strファイル名 } ); | |
1096 | - } | |
1155 | + Trace.TraceInformation( "サウンドを解放しました。({0})({1})", this.strコメント文, this.strファイル名 ); | |
1097 | 1156 | } |
1098 | - this.bDisposed済み = true; | |
1099 | 1157 | } |
1158 | + | |
1159 | + this.bDisposed済み = true; | |
1100 | 1160 | } |
1161 | + ~CWAV() | |
1162 | + { | |
1163 | + this.Dispose( false ); | |
1164 | + } | |
1101 | 1165 | //----------------- |
1102 | 1166 | #endregion |
1103 | 1167 |
@@ -1111,7 +1175,6 @@ | ||
1111 | 1175 | |
1112 | 1176 | // 構造体 |
1113 | 1177 | |
1114 | - [StructLayout( LayoutKind.Sequential )] | |
1115 | 1178 | public struct STLANEINT |
1116 | 1179 | { |
1117 | 1180 | public int HH; |
@@ -1124,8 +1187,17 @@ | ||
1124 | 1187 | public int HHO; |
1125 | 1188 | public int RD; |
1126 | 1189 | public int LC; |
1190 | + | |
1191 | + public int Drums | |
1192 | + { | |
1193 | + get | |
1194 | + { | |
1195 | + return this.HH + this.SD + this.BD + this.HT + this.LT + this.CY + this.FT + this.HHO + this.RD + this.LC; | |
1196 | + } | |
1197 | + } | |
1127 | 1198 | public int Guitar; |
1128 | 1199 | public int Bass; |
1200 | + | |
1129 | 1201 | public int this[ int index ] |
1130 | 1202 | { |
1131 | 1203 | get |
@@ -1229,16 +1301,7 @@ | ||
1229 | 1301 | throw new IndexOutOfRangeException(); |
1230 | 1302 | } |
1231 | 1303 | } |
1232 | - public int Drums | |
1233 | - { | |
1234 | - get | |
1235 | - { | |
1236 | - return this.HH + this.SD + this.BD + this.HT + this.LT + this.CY + this.FT + this.HHO + this.RD + this.LC; | |
1237 | - } | |
1238 | - } | |
1239 | 1304 | } |
1240 | - | |
1241 | - [StructLayout( LayoutKind.Sequential )] | |
1242 | 1305 | public struct STRESULT |
1243 | 1306 | { |
1244 | 1307 | public string SS; |
@@ -1248,6 +1311,7 @@ | ||
1248 | 1311 | public string C; |
1249 | 1312 | public string D; |
1250 | 1313 | public string E; |
1314 | + | |
1251 | 1315 | public string this[ int index ] |
1252 | 1316 | { |
1253 | 1317 | get |
@@ -1313,18 +1377,18 @@ | ||
1313 | 1377 | } |
1314 | 1378 | } |
1315 | 1379 | } |
1316 | - | |
1317 | - [StructLayout( LayoutKind.Sequential )] | |
1318 | 1380 | public struct STチップがある |
1319 | 1381 | { |
1320 | 1382 | public bool Drums; |
1321 | 1383 | public bool Guitar; |
1322 | 1384 | public bool Bass; |
1385 | + | |
1323 | 1386 | public bool HHOpen; |
1324 | 1387 | public bool Ride; |
1325 | 1388 | public bool LeftCymbal; |
1326 | 1389 | public bool OpenGuitar; |
1327 | 1390 | public bool OpenBass; |
1391 | + | |
1328 | 1392 | public bool this[ int index ] |
1329 | 1393 | { |
1330 | 1394 | get |
@@ -2141,7 +2205,7 @@ | ||
2141 | 2205 | cwav.rSound[ i ].n音量 = 100; |
2142 | 2206 | if( ( i == 0 ) && CDTXMania.ConfigIni.bLog作成解放ログ出力 ) |
2143 | 2207 | { |
2144 | - Trace.TraceInformation( "サウンドを作成しました。({3})({0})({1})({2}bytes)", new object[] { cwav.strコメント文, str, cwav.rSound[ i ].nサウンドバッファサイズ, cwav.rSound[ i ].bストリーム再生する ? "Stream" : "OnMemory" } ); | |
2208 | + Trace.TraceInformation( "サウンドを作成しました。({3})({0})({1})({2}bytes)", cwav.strコメント文, str, cwav.rSound[ i ].nサウンドバッファサイズ, cwav.rSound[ i ].bストリーム再生する ? "Stream" : "OnMemory" ); | |
2145 | 2209 | } |
2146 | 2210 | } |
2147 | 2211 | catch |
@@ -2149,7 +2213,7 @@ | ||
2149 | 2213 | cwav.rSound[ i ] = null; |
2150 | 2214 | if( i == 0 ) |
2151 | 2215 | { |
2152 | - Trace.TraceError( "サウンドの作成に失敗しました。({0})({1})", new object[] { cwav.strコメント文, str } ); | |
2216 | + Trace.TraceError( "サウンドの作成に失敗しました。({0})({1})", cwav.strコメント文, str ); | |
2153 | 2217 | } |
2154 | 2218 | } |
2155 | 2219 | if( ( cwav.rSound[ i ] != null ) && cwav.rSound[ i ].bストリーム再生する ) |
@@ -2185,7 +2249,7 @@ | ||
2185 | 2249 | } |
2186 | 2250 | catch( Exception exception ) |
2187 | 2251 | { |
2188 | - Trace.TraceError( "サウンドの生成に失敗しました。({0})({1})({2})", new object[] { exception.Message, cwav.strコメント文, str } ); | |
2252 | + Trace.TraceError( "サウンドの生成に失敗しました。({0})({1})({2})", exception.Message, cwav.strコメント文, str ); | |
2189 | 2253 | for( int j = 0; j < 4; j++ ) |
2190 | 2254 | { |
2191 | 2255 | cwav.rSound[ j ] = null; |
@@ -2196,28 +2260,14 @@ | ||
2196 | 2260 | } |
2197 | 2261 | public static string tZZ( int n ) |
2198 | 2262 | { |
2199 | - if( ( n < 0 ) || ( n >= 36 * 36) ) | |
2200 | - { | |
2201 | - return "!!"; | |
2202 | - } | |
2263 | + if( n < 0 || n >= 36 * 36 ) | |
2264 | + return "!!"; // オーバー/アンダーフロー。 | |
2265 | + | |
2266 | + // n を36進数2桁の文字列にして返す。 | |
2267 | + | |
2203 | 2268 | string str = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
2204 | 2269 | return new string( new char[] { str[ n / 36 ], str[ n % 36 ] } ); |
2205 | 2270 | } |
2206 | - | |
2207 | - /// <summary> | |
2208 | - /// ギターのレーンビットパターン | |
2209 | - /// </summary> | |
2210 | - public enum Eレーンビットパターン | |
2211 | - { | |
2212 | - OPEN = 0, | |
2213 | - xxB = 1, | |
2214 | - xGx = 2, | |
2215 | - xGB = 3, | |
2216 | - Rxx = 4, | |
2217 | - RxB = 5, | |
2218 | - RGx = 6, | |
2219 | - RGB = 7 | |
2220 | - }; | |
2221 | 2271 | public void tギターとベースのランダム化(E楽器パート part, Eランダムモード eRandom) |
2222 | 2272 | { |
2223 | 2273 | if( ( ( part == E楽器パート.GUITAR ) || ( part == E楽器パート.BASS ) ) && ( eRandom != Eランダムモード.OFF ) ) |
@@ -2912,7 +2962,7 @@ | ||
2912 | 2962 | catch( Exception exception ) |
2913 | 2963 | { |
2914 | 2964 | Trace.TraceError( exception.Message ); |
2915 | - Trace.TraceError( "DTXのハッシュの計算に失敗しました。({0})", new object[] { this.strファイル名の絶対パス } ); | |
2965 | + Trace.TraceError( "DTXのハッシュの計算に失敗しました。({0})", this.strファイル名の絶対パス ); | |
2916 | 2966 | } |
2917 | 2967 | if( buffer != null ) |
2918 | 2968 | { |
@@ -3139,15 +3189,19 @@ | ||
3139 | 3189 | |
3140 | 3190 | #region [ private ] |
3141 | 3191 | //----------------- |
3192 | + /// <summary> | |
3193 | + /// <para>GDAチャンネル番号に対応するDTXチャンネル番号。</para> | |
3194 | + /// </summary> | |
3142 | 3195 | [StructLayout( LayoutKind.Sequential )] |
3143 | - private struct STGDAPARAM // GDAチャンネル番号に対応するDTXチャンネル番号 | |
3196 | + private struct STGDAPARAM | |
3144 | 3197 | { |
3145 | - public string s; // GDAチャンネル番号 | |
3146 | - public int c; // DTXチャンネル番号 | |
3198 | + public string strGDAのチャンネル文字列; | |
3199 | + public int nDTXのチャンネル番号; | |
3147 | 3200 | |
3148 | - public STGDAPARAM(string _s, int _c) { // 2011.1.1 yyagi 構造体のコンストラクタ追加(初期化簡易化のため) | |
3149 | - s = _s; | |
3150 | - c = _c; | |
3201 | + public STGDAPARAM( string strGDAのチャンネル文字列, int nDTXのチャンネル番号 ) // 2011.1.1 yyagi 構造体のコンストラクタ追加(初期化簡易化のため) | |
3202 | + { | |
3203 | + this.strGDAのチャンネル文字列 = strGDAのチャンネル文字列; | |
3204 | + this.nDTXのチャンネル番号 = nDTXのチャンネル番号; | |
3151 | 3205 | } |
3152 | 3206 | } |
3153 | 3207 |
@@ -3171,61 +3225,71 @@ | ||
3171 | 3225 | |
3172 | 3226 | private bool t入力・コマンド文字列を抜き出す( ref CharEnumerator ce, ref StringBuilder sb文字列 ) |
3173 | 3227 | { |
3174 | - if( this.t入力・空白をスキップする( ref ce ) ) | |
3228 | + if( !this.t入力・空白をスキップする( ref ce ) ) | |
3229 | + return false; // 文字が尽きた | |
3230 | + | |
3231 | + #region [ コマンド終端文字(':')、半角空白、コメント開始文字(';')、改行のいずれかが出現するまでをコマンド文字列と見なし、sb文字列 にコピーする。] | |
3232 | + //----------------- | |
3233 | + while( ce.Current != ':' && ce.Current != ' ' && ce.Current != ';' && ce.Current != '\n' ) | |
3175 | 3234 | { |
3176 | - while( ( ( ce.Current != ':' ) && ( ce.Current != ' ' ) ) && ( ( ce.Current != ';' ) && ( ce.Current != '\n' ) ) ) | |
3177 | - { | |
3178 | - sb文字列.Append( ce.Current ); | |
3179 | - if( !ce.MoveNext() ) | |
3180 | - { | |
3181 | - return false; | |
3182 | - } | |
3183 | - } | |
3184 | - if( ce.Current == ':' ) | |
3185 | - { | |
3186 | - if( !ce.MoveNext() ) | |
3187 | - { | |
3188 | - return false; | |
3189 | - } | |
3190 | - if( !this.t入力・空白をスキップする( ref ce ) ) | |
3191 | - { | |
3192 | - return false; | |
3193 | - } | |
3194 | - } | |
3195 | - return true; | |
3235 | + sb文字列.Append( ce.Current ); | |
3236 | + | |
3237 | + if( !ce.MoveNext() ) | |
3238 | + return false; // 文字が尽きた | |
3196 | 3239 | } |
3197 | - return false; | |
3240 | + //----------------- | |
3241 | + #endregion | |
3242 | + | |
3243 | + #region [ コマンド終端文字(':')で終端したなら、その次から空白をスキップしておく。] | |
3244 | + //----------------- | |
3245 | + if( ce.Current == ':' ) | |
3246 | + { | |
3247 | + if( !ce.MoveNext() ) | |
3248 | + return false; // 文字が尽きた | |
3249 | + | |
3250 | + if( !this.t入力・空白をスキップする( ref ce ) ) | |
3251 | + return false; // 文字が尽きた | |
3252 | + } | |
3253 | + //----------------- | |
3254 | + #endregion | |
3255 | + | |
3256 | + return true; | |
3198 | 3257 | } |
3199 | 3258 | private bool t入力・コメントをスキップする( ref CharEnumerator ce ) |
3200 | 3259 | { |
3260 | + // 改行が現れるまでをコメントと見なしてスキップする。 | |
3261 | + | |
3201 | 3262 | while( ce.Current != '\n' ) |
3202 | 3263 | { |
3203 | 3264 | if( !ce.MoveNext() ) |
3204 | - { | |
3205 | - return false; | |
3206 | - } | |
3265 | + return false; // 文字が尽きた | |
3207 | 3266 | } |
3267 | + | |
3268 | + // 改行の次の文字へ移動した結果を返す。 | |
3269 | + | |
3208 | 3270 | return ce.MoveNext(); |
3209 | 3271 | } |
3210 | 3272 | private bool t入力・コメント文字列を抜き出す( ref CharEnumerator ce, ref StringBuilder sb文字列 ) |
3211 | 3273 | { |
3212 | - if( ce.Current != ';' ) | |
3213 | - { | |
3274 | + if( ce.Current != ';' ) // コメント開始文字(';')じゃなければ正常帰還。 | |
3214 | 3275 | return true; |
3215 | - } | |
3216 | - if( ce.MoveNext() ) | |
3276 | + | |
3277 | + if( !ce.MoveNext() ) // ';' の次で文字列が終わってたら終了帰還。 | |
3278 | + return false; | |
3279 | + | |
3280 | + #region [ ';' の次の文字から '\n' の1つ前までをコメント文字列と見なし、sb文字列にコピーする。] | |
3281 | + //----------------- | |
3282 | + while( ce.Current != '\n' ) | |
3217 | 3283 | { |
3218 | - while( ce.Current != '\n' ) | |
3219 | - { | |
3220 | - sb文字列.Append( ce.Current ); | |
3221 | - if( !ce.MoveNext() ) | |
3222 | - { | |
3223 | - return false; | |
3224 | - } | |
3225 | - } | |
3226 | - return true; | |
3284 | + sb文字列.Append( ce.Current ); | |
3285 | + | |
3286 | + if( !ce.MoveNext() ) | |
3287 | + return false; | |
3227 | 3288 | } |
3228 | - return false; | |
3289 | + //----------------- | |
3290 | + #endregion | |
3291 | + | |
3292 | + return true; | |
3229 | 3293 | } |
3230 | 3294 | private void t入力・パラメータ食い込みチェック( string strコマンド名, ref string strコマンド, ref string strパラメータ ) |
3231 | 3295 | { |
@@ -3237,158 +3301,185 @@ | ||
3237 | 3301 | } |
3238 | 3302 | private bool t入力・パラメータ文字列を抜き出す( ref CharEnumerator ce, ref StringBuilder sb文字列 ) |
3239 | 3303 | { |
3240 | - if( this.t入力・空白をスキップする( ref ce ) ) | |
3304 | + if( !this.t入力・空白をスキップする( ref ce ) ) | |
3305 | + return false; // 文字が尽きた | |
3306 | + | |
3307 | + #region [ 改行またはコメント開始文字(';')が出現するまでをパラメータ文字列と見なし、sb文字列 にコピーする。] | |
3308 | + //----------------- | |
3309 | + while( ce.Current != '\n' && ce.Current != ';' ) | |
3241 | 3310 | { |
3242 | - while( ( ce.Current != '\n' ) && ( ce.Current != ';' ) ) | |
3243 | - { | |
3244 | - sb文字列.Append( ce.Current ); | |
3245 | - if( !ce.MoveNext() ) | |
3246 | - { | |
3247 | - return false; | |
3248 | - } | |
3249 | - } | |
3250 | - return true; | |
3311 | + sb文字列.Append( ce.Current ); | |
3312 | + | |
3313 | + if( !ce.MoveNext() ) | |
3314 | + return false; | |
3251 | 3315 | } |
3252 | - return false; | |
3316 | + //----------------- | |
3317 | + #endregion | |
3318 | + | |
3319 | + return true; | |
3253 | 3320 | } |
3254 | 3321 | private bool t入力・空白と改行をスキップする( ref CharEnumerator ce ) |
3255 | 3322 | { |
3256 | - while( ( ce.Current == ' ' ) || ( ce.Current == '\n' ) ) | |
3323 | + // 空白と改行が続く間はこれらをスキップする。 | |
3324 | + | |
3325 | + while( ce.Current == ' ' || ce.Current == '\n' ) | |
3257 | 3326 | { |
3258 | 3327 | if( ce.Current == '\n' ) |
3259 | - { | |
3260 | - this.n現在の行数++; | |
3261 | - } | |
3328 | + this.n現在の行数++; // 改行文字では行番号が増える。 | |
3329 | + | |
3262 | 3330 | if( !ce.MoveNext() ) |
3263 | - { | |
3264 | - return false; | |
3265 | - } | |
3331 | + return false; // 文字が尽きた | |
3266 | 3332 | } |
3333 | + | |
3267 | 3334 | return true; |
3268 | 3335 | } |
3269 | 3336 | private bool t入力・空白をスキップする( ref CharEnumerator ce ) |
3270 | 3337 | { |
3338 | + // 空白が続く間はこれをスキップする。 | |
3339 | + | |
3271 | 3340 | while( ce.Current == ' ' ) |
3272 | 3341 | { |
3273 | 3342 | if( !ce.MoveNext() ) |
3274 | - { | |
3275 | - return false; | |
3276 | - } | |
3343 | + return false; // 文字が尽きた | |
3277 | 3344 | } |
3345 | + | |
3278 | 3346 | return true; |
3279 | 3347 | } |
3280 | 3348 | private void t入力・行解析( ref StringBuilder sbコマンド, ref StringBuilder sbパラメータ, ref StringBuilder sbコメント ) |
3281 | 3349 | { |
3282 | - string str = sbコマンド.ToString(); | |
3283 | - string str2 = sbパラメータ.ToString().Trim(); | |
3284 | - string str3 = sbコメント.ToString(); | |
3285 | - if( str.StartsWith( "IF", StringComparison.OrdinalIgnoreCase ) ) | |
3350 | + string strコマンド = sbコマンド.ToString(); | |
3351 | + string strパラメータ = sbパラメータ.ToString().Trim(); | |
3352 | + string strコメント = sbコメント.ToString(); | |
3353 | + | |
3354 | + // 行頭コマンドの処理 | |
3355 | + | |
3356 | + #region [ IF ] | |
3357 | + //----------------- | |
3358 | + if( strコマンド.StartsWith( "IF", StringComparison.OrdinalIgnoreCase ) ) | |
3286 | 3359 | { |
3287 | - this.t入力・パラメータ食い込みチェック( "IF", ref str, ref str2 ); | |
3288 | - if( this.bstackIFからENDIFをスキップする.Count == 0xff ) | |
3360 | + this.t入力・パラメータ食い込みチェック( "IF", ref strコマンド, ref strパラメータ ); | |
3361 | + | |
3362 | + if( this.bstackIFからENDIFをスキップする.Count == 255 ) | |
3289 | 3363 | { |
3290 | - Trace.TraceWarning( "#IF の入れ子の数が 255 を超えました。この #IF を無視します。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
3364 | + Trace.TraceWarning( "#IF の入れ子の数が 255 を超えました。この #IF を無視します。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
3291 | 3365 | } |
3292 | 3366 | else if( this.bstackIFからENDIFをスキップする.Peek() ) |
3293 | 3367 | { |
3294 | - this.bstackIFからENDIFをスキップする.Push( true ); | |
3368 | + this.bstackIFからENDIFをスキップする.Push( true ); // 親が true ならその入れ子も問答無用で true 。 | |
3295 | 3369 | } |
3296 | - else | |
3370 | + else // 親が false なら入れ子はパラメータと乱数を比較して結果を判断する。 | |
3297 | 3371 | { |
3298 | - int result = 0; | |
3299 | - if( !int.TryParse( str2, out result ) ) | |
3300 | - { | |
3301 | - result = 1; | |
3302 | - } | |
3303 | - this.bstackIFからENDIFをスキップする.Push( result != this.n現在の乱数 ); | |
3372 | + int n数値 = 0; | |
3373 | + | |
3374 | + if( !int.TryParse( strパラメータ, out n数値 ) ) | |
3375 | + n数値 = 1; | |
3376 | + | |
3377 | + this.bstackIFからENDIFをスキップする.Push( n数値 != this.n現在の乱数 ); // 乱数と数値が一致したら true 。 | |
3304 | 3378 | } |
3305 | 3379 | } |
3306 | - else if( str.StartsWith( "ENDIF", StringComparison.OrdinalIgnoreCase ) ) | |
3380 | + //----------------- | |
3381 | + #endregion | |
3382 | + #region [ ENDIF ] | |
3383 | + //----------------- | |
3384 | + else if( strコマンド.StartsWith( "ENDIF", StringComparison.OrdinalIgnoreCase ) ) | |
3307 | 3385 | { |
3308 | - this.t入力・パラメータ食い込みチェック( "ENDIF", ref str, ref str2 ); | |
3386 | + this.t入力・パラメータ食い込みチェック( "ENDIF", ref strコマンド, ref strパラメータ ); | |
3387 | + | |
3309 | 3388 | if( this.bstackIFからENDIFをスキップする.Count > 1 ) |
3310 | 3389 | { |
3311 | - this.bstackIFからENDIFをスキップする.Pop(); | |
3390 | + this.bstackIFからENDIFをスキップする.Pop(); // 入れ子を1つ脱出。 | |
3312 | 3391 | } |
3313 | 3392 | else |
3314 | 3393 | { |
3315 | - Trace.TraceWarning( "#ENDIF に対応する #IF がありません。この #ENDIF を無視します。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
3394 | + Trace.TraceWarning( "#ENDIF に対応する #IF がありません。この #ENDIF を無視します。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
3316 | 3395 | } |
3317 | 3396 | } |
3318 | - else if( !this.bstackIFからENDIFをスキップする.Peek() ) | |
3397 | + //----------------- | |
3398 | + #endregion | |
3399 | + | |
3400 | + else if( !this.bstackIFからENDIFをスキップする.Peek() ) // IF~ENDIF をスキップするなら以下はすべて無視。 | |
3319 | 3401 | { |
3320 | - if( str.StartsWith( "PATH_WAV", StringComparison.OrdinalIgnoreCase ) ) | |
3402 | + #region [ PATH_WAV ] | |
3403 | + //----------------- | |
3404 | + if( strコマンド.StartsWith( "PATH_WAV", StringComparison.OrdinalIgnoreCase ) ) | |
3321 | 3405 | { |
3322 | - this.t入力・パラメータ食い込みチェック( "PATH_WAV", ref str, ref str2 ); | |
3323 | - this.PATH_WAV = str2; | |
3406 | + this.t入力・パラメータ食い込みチェック( "PATH_WAV", ref strコマンド, ref strパラメータ ); | |
3407 | + this.PATH_WAV = strパラメータ; | |
3324 | 3408 | } |
3325 | - else if( str.StartsWith( "TITLE", StringComparison.OrdinalIgnoreCase ) ) | |
3409 | + //----------------- | |
3410 | + #endregion | |
3411 | + #region [ TITLE ] | |
3412 | + //----------------- | |
3413 | + else if( strコマンド.StartsWith( "TITLE", StringComparison.OrdinalIgnoreCase ) ) | |
3326 | 3414 | { |
3327 | - this.t入力・パラメータ食い込みチェック( "TITLE", ref str, ref str2 ); | |
3328 | - this.TITLE = str2; | |
3415 | + this.t入力・パラメータ食い込みチェック( "TITLE", ref strコマンド, ref strパラメータ ); | |
3416 | + this.TITLE = strパラメータ; | |
3329 | 3417 | } |
3330 | - else if( str.StartsWith( "ARTIST", StringComparison.OrdinalIgnoreCase ) ) | |
3418 | + //----------------- | |
3419 | + #endregion | |
3420 | + #region [ ARTIST ] | |
3421 | + //----------------- | |
3422 | + else if( strコマンド.StartsWith( "ARTIST", StringComparison.OrdinalIgnoreCase ) ) | |
3331 | 3423 | { |
3332 | - this.t入力・パラメータ食い込みチェック( "ARTIST", ref str, ref str2 ); | |
3333 | - this.ARTIST = str2; | |
3424 | + this.t入力・パラメータ食い込みチェック( "ARTIST", ref strコマンド, ref strパラメータ ); | |
3425 | + this.ARTIST = strパラメータ; | |
3334 | 3426 | } |
3335 | - else if( str.StartsWith( "COMMENT", StringComparison.OrdinalIgnoreCase ) ) | |
3427 | + //----------------- | |
3428 | + #endregion | |
3429 | + #region [ COMMENT ] | |
3430 | + //----------------- | |
3431 | + else if( strコマンド.StartsWith( "COMMENT", StringComparison.OrdinalIgnoreCase ) ) | |
3336 | 3432 | { |
3337 | - this.t入力・パラメータ食い込みチェック( "COMMENT", ref str, ref str2 ); | |
3338 | - this.COMMENT = str2; | |
3433 | + this.t入力・パラメータ食い込みチェック( "COMMENT", ref strコマンド, ref strパラメータ ); | |
3434 | + this.COMMENT = strパラメータ; | |
3339 | 3435 | } |
3340 | - else if( str.StartsWith( "DLEVEL", StringComparison.OrdinalIgnoreCase ) || str.StartsWith( "PLAYLEVEL", StringComparison.OrdinalIgnoreCase ) ) | |
3436 | + //----------------- | |
3437 | + #endregion | |
3438 | + #region [ DLEVEL, PLAYLEVEL ] | |
3439 | + //----------------- | |
3440 | + else if( | |
3441 | + strコマンド.StartsWith( "DLEVEL", StringComparison.OrdinalIgnoreCase ) || | |
3442 | + strコマンド.StartsWith( "PLAYLEVEL", StringComparison.OrdinalIgnoreCase ) ) | |
3341 | 3443 | { |
3444 | + this.t入力・パラメータ食い込みチェック( "DLEVEL", ref strコマンド, ref strパラメータ ); | |
3445 | + this.t入力・パラメータ食い込みチェック( "PLAYLEVEL", ref strコマンド, ref strパラメータ ); | |
3446 | + | |
3342 | 3447 | int dlevel; |
3343 | - this.t入力・パラメータ食い込みチェック( "DLEVEL", ref str, ref str2 ); | |
3344 | - this.t入力・パラメータ食い込みチェック( "PLAYLEVEL", ref str, ref str2 ); | |
3345 | - if( int.TryParse( str2, out dlevel ) ) | |
3448 | + if( int.TryParse( strパラメータ, out dlevel ) ) | |
3346 | 3449 | { |
3347 | - if( dlevel < 0 ) | |
3348 | - { | |
3349 | - dlevel = 0; | |
3350 | - } | |
3351 | - else if( dlevel > 100 ) | |
3352 | - { | |
3353 | - dlevel = 100; | |
3354 | - } | |
3355 | - this.LEVEL.Drums = dlevel; | |
3450 | + this.LEVEL.Drums = Math.Min( Math.Max( dlevel, 0 ), 100 ); // 0~100 に丸める | |
3356 | 3451 | } |
3357 | 3452 | } |
3358 | - else if( str.StartsWith( "GLEVEL", StringComparison.OrdinalIgnoreCase ) ) | |
3453 | + //----------------- | |
3454 | + #endregion | |
3455 | + #region [ GLEVEL ] | |
3456 | + //----------------- | |
3457 | + else if( strコマンド.StartsWith( "GLEVEL", StringComparison.OrdinalIgnoreCase ) ) | |
3359 | 3458 | { |
3459 | + this.t入力・パラメータ食い込みチェック( "GLEVEL", ref strコマンド, ref strパラメータ ); | |
3460 | + | |
3360 | 3461 | int glevel; |
3361 | - this.t入力・パラメータ食い込みチェック( "GLEVEL", ref str, ref str2 ); | |
3362 | - if( int.TryParse( str2, out glevel ) ) | |
3462 | + if( int.TryParse( strパラメータ, out glevel ) ) | |
3363 | 3463 | { |
3364 | - if( glevel < 0 ) | |
3365 | - { | |
3366 | - glevel = 0; | |
3367 | - } | |
3368 | - else if( glevel > 100 ) | |
3369 | - { | |
3370 | - glevel = 100; | |
3371 | - } | |
3372 | - this.LEVEL.Guitar = glevel; | |
3464 | + this.LEVEL.Guitar = Math.Min( Math.Max( glevel, 0 ), 100 ); // 0~100 に丸める | |
3373 | 3465 | } |
3374 | 3466 | } |
3375 | - else if( str.StartsWith( "BLEVEL", StringComparison.OrdinalIgnoreCase ) ) | |
3467 | + //----------------- | |
3468 | + #endregion | |
3469 | + #region [ BLEVEL ] | |
3470 | + //----------------- | |
3471 | + else if( strコマンド.StartsWith( "BLEVEL", StringComparison.OrdinalIgnoreCase ) ) | |
3376 | 3472 | { |
3473 | + this.t入力・パラメータ食い込みチェック( "BLEVEL", ref strコマンド, ref strパラメータ ); | |
3474 | + | |
3377 | 3475 | int blevel; |
3378 | - this.t入力・パラメータ食い込みチェック( "BLEVEL", ref str, ref str2 ); | |
3379 | - if( int.TryParse( str2, out blevel ) ) | |
3476 | + if( int.TryParse( strパラメータ, out blevel ) ) | |
3380 | 3477 | { |
3381 | - if( blevel < 0 ) | |
3382 | - { | |
3383 | - blevel = 0; | |
3384 | - } | |
3385 | - else if( blevel > 100 ) | |
3386 | - { | |
3387 | - blevel = 100; | |
3388 | - } | |
3389 | - this.LEVEL.Bass = blevel; | |
3478 | + this.LEVEL.Bass = Math.Min( Math.Max( blevel, 0 ), 100 ); // 0~100 に丸める | |
3390 | 3479 | } |
3391 | 3480 | } |
3481 | + //----------------- | |
3482 | + #endregion | |
3392 | 3483 | #if TEST_NOTEOFFMODE |
3393 | 3484 | else if (str.StartsWith("SUPRESSNOTEOFF_HIHAT", StringComparison.OrdinalIgnoreCase)) { |
3394 | 3485 | this.t入力・パラメータ食い込みチェック("SUPRESSNOTEOFF_HIHAT", ref str, ref str2); |
@@ -3403,712 +3494,1139 @@ | ||
3403 | 3494 | this.bBASS演奏で直前のBASSを消音する = !str2.ToLower().Equals("on"); |
3404 | 3495 | } |
3405 | 3496 | #endif |
3406 | - else if (str.StartsWith("GENRE", StringComparison.OrdinalIgnoreCase)) { | |
3407 | - this.t入力・パラメータ食い込みチェック("GENRE", ref str, ref str2); | |
3408 | - this.GENRE = str2; | |
3409 | - } else { | |
3410 | - if (str.StartsWith("HIDDENLEVEL", StringComparison.OrdinalIgnoreCase)) { | |
3411 | - this.t入力・パラメータ食い込みチェック("HIDDENLEVEL", ref str, ref str2); | |
3412 | - this.HIDDENLEVEL = str2.ToLower().Equals("on"); | |
3497 | + #region [ GENRE ] | |
3498 | + //----------------- | |
3499 | + else if( strコマンド.StartsWith( "GENRE", StringComparison.OrdinalIgnoreCase ) ) | |
3500 | + { | |
3501 | + this.t入力・パラメータ食い込みチェック( "GENRE", ref strコマンド, ref strパラメータ ); | |
3502 | + this.GENRE = strパラメータ; | |
3503 | + } | |
3504 | + //----------------- | |
3505 | + #endregion | |
3506 | + #region [ HIDDENLEVEL ] | |
3507 | + //----------------- | |
3508 | + else if( strコマンド.StartsWith( "HIDDENLEVEL", StringComparison.OrdinalIgnoreCase ) ) | |
3509 | + { | |
3510 | + this.t入力・パラメータ食い込みチェック( "HIDDENLEVEL", ref strコマンド, ref strパラメータ ); | |
3511 | + this.HIDDENLEVEL = strパラメータ.ToLower().Equals( "on" ); | |
3512 | + } | |
3513 | + //----------------- | |
3514 | + #endregion | |
3515 | + #region [ STAGEFILE ] | |
3516 | + //----------------- | |
3517 | + else if( strコマンド.StartsWith( "STAGEFILE", StringComparison.OrdinalIgnoreCase ) ) | |
3518 | + { | |
3519 | + this.t入力・パラメータ食い込みチェック( "STAGEFILE", ref strコマンド, ref strパラメータ ); | |
3520 | + this.STAGEFILE = strパラメータ; | |
3521 | + } | |
3522 | + //----------------- | |
3523 | + #endregion | |
3524 | + #region [ PREVIEW ] | |
3525 | + //----------------- | |
3526 | + else if( strコマンド.StartsWith( "PREVIEW", StringComparison.OrdinalIgnoreCase ) ) | |
3527 | + { | |
3528 | + this.t入力・パラメータ食い込みチェック( "PREVIEW", ref strコマンド, ref strパラメータ ); | |
3529 | + this.PREVIEW = strパラメータ; | |
3530 | + } | |
3531 | + //----------------- | |
3532 | + #endregion | |
3533 | + #region [ PREIMAGE ] | |
3534 | + //----------------- | |
3535 | + else if( strコマンド.StartsWith( "PREIMAGE", StringComparison.OrdinalIgnoreCase ) ) | |
3536 | + { | |
3537 | + this.t入力・パラメータ食い込みチェック( "PREIMAGE", ref strコマンド, ref strパラメータ ); | |
3538 | + this.PREIMAGE = strパラメータ; | |
3539 | + } | |
3540 | + //----------------- | |
3541 | + #endregion | |
3542 | + #region [ PREMOVIE ] | |
3543 | + //----------------- | |
3544 | + else if( strコマンド.StartsWith( "PREMOVIE", StringComparison.OrdinalIgnoreCase ) ) | |
3545 | + { | |
3546 | + this.t入力・パラメータ食い込みチェック( "PREMOVIE", ref strコマンド, ref strパラメータ ); | |
3547 | + this.PREMOVIE = strパラメータ; | |
3548 | + } | |
3549 | + //----------------- | |
3550 | + #endregion | |
3551 | + #region [ BACKGROUND_GR ] | |
3552 | + //----------------- | |
3553 | + else if( strコマンド.StartsWith( "BACKGROUND_GR", StringComparison.OrdinalIgnoreCase ) ) | |
3554 | + { | |
3555 | + this.t入力・パラメータ食い込みチェック( "BACKGROUND_GR", ref strコマンド, ref strパラメータ ); | |
3556 | + this.BACKGROUND_GR = strパラメータ; | |
3557 | + } | |
3558 | + //----------------- | |
3559 | + #endregion | |
3560 | + #region [ BACKGROU}ND, WALL ] | |
3561 | + //----------------- | |
3562 | + else if( | |
3563 | + strコマンド.StartsWith( "BACKGROUND", StringComparison.OrdinalIgnoreCase ) || | |
3564 | + strコマンド.StartsWith( "WALL", StringComparison.OrdinalIgnoreCase ) ) | |
3565 | + { | |
3566 | + this.t入力・パラメータ食い込みチェック( "BACKGROUND", ref strコマンド, ref strパラメータ ); | |
3567 | + this.t入力・パラメータ食い込みチェック( "WALL", ref strコマンド, ref strパラメータ ); | |
3568 | + this.BACKGROUND = strパラメータ; | |
3569 | + } | |
3570 | + //----------------- | |
3571 | + #endregion | |
3572 | + #region [ RANDOM ] | |
3573 | + //----------------- | |
3574 | + else if( strコマンド.StartsWith( "RANDOM", StringComparison.OrdinalIgnoreCase ) ) | |
3575 | + { | |
3576 | + this.t入力・パラメータ食い込みチェック( "RANDOM", ref strコマンド, ref strパラメータ ); | |
3577 | + | |
3578 | + int n数値 = 1; | |
3579 | + if( !int.TryParse( strパラメータ, out n数値 ) ) | |
3580 | + n数値 = 1; | |
3581 | + | |
3582 | + this.n現在の乱数 = CDTXMania.Random.Next( n数値 ) + 1; // 1~数値 までの乱数を生成。 | |
3583 | + } | |
3584 | + //----------------- | |
3585 | + #endregion | |
3586 | + #region [ SOUND_NOWLOADING ] | |
3587 | + //----------------- | |
3588 | + else if( strコマンド.StartsWith( "SOUND_NOWLOADING", StringComparison.OrdinalIgnoreCase ) ) | |
3589 | + { | |
3590 | + this.t入力・パラメータ食い込みチェック( "SOUND_NOWLOADING", ref strコマンド, ref strパラメータ ); | |
3591 | + this.SOUND_NOWLOADING = strパラメータ; | |
3592 | + } | |
3593 | + //----------------- | |
3594 | + #endregion | |
3595 | + | |
3596 | + else if( !this.bヘッダのみ ) // ヘッダのみの解析の場合、以下は無視。 | |
3597 | + { | |
3598 | + #region [ PANEL ] | |
3599 | + //----------------- | |
3600 | + if( strコマンド.StartsWith( "PANEL", StringComparison.OrdinalIgnoreCase ) ) | |
3601 | + { | |
3602 | + this.t入力・パラメータ食い込みチェック( "PANEL", ref strコマンド, ref strパラメータ ); | |
3603 | + | |
3604 | + int dummyResult; // #23885 2010.12.12 yyagi: not to confuse "#PANEL strings (panel)" and "#PANEL int (panpot of EL)" | |
3605 | + if( !int.TryParse( strパラメータ, out dummyResult ) ) | |
3606 | + { // 数値じゃないならPANELとみなす | |
3607 | + this.PANEL = strパラメータ; // | |
3608 | + goto EOL; // | |
3609 | + } // 数値ならPAN ELとみなす | |
3610 | + | |
3413 | 3611 | } |
3414 | - if (str.StartsWith("STAGEFILE", StringComparison.OrdinalIgnoreCase)) { | |
3415 | - this.t入力・パラメータ食い込みチェック("STAGEFILE", ref str, ref str2); | |
3416 | - this.STAGEFILE = str2; | |
3417 | - } else if (str.StartsWith("PREVIEW", StringComparison.OrdinalIgnoreCase)) { | |
3418 | - this.t入力・パラメータ食い込みチェック("PREVIEW", ref str, ref str2); | |
3419 | - this.PREVIEW = str2; | |
3420 | - } else if (str.StartsWith("PREIMAGE", StringComparison.OrdinalIgnoreCase)) { | |
3421 | - this.t入力・パラメータ食い込みチェック("PREIMAGE", ref str, ref str2); | |
3422 | - this.PREIMAGE = str2; | |
3423 | - } else if (str.StartsWith("PREMOVIE", StringComparison.OrdinalIgnoreCase)) { | |
3424 | - this.t入力・パラメータ食い込みチェック("PREMOVIE", ref str, ref str2); | |
3425 | - this.PREMOVIE = str2; | |
3426 | - } else if (str.StartsWith("BACKGROUND_GR", StringComparison.OrdinalIgnoreCase)) { | |
3427 | - this.t入力・パラメータ食い込みチェック("BACKGROUND_GR", ref str, ref str2); | |
3428 | - this.BACKGROUND_GR = str2; | |
3429 | - } else if (str.StartsWith("BACKGROUND", StringComparison.OrdinalIgnoreCase) || str.StartsWith("WALL", StringComparison.OrdinalIgnoreCase)) { | |
3430 | - this.t入力・パラメータ食い込みチェック("BACKGROUND", ref str, ref str2); | |
3431 | - this.t入力・パラメータ食い込みチェック("WALL", ref str, ref str2); | |
3432 | - this.BACKGROUND = str2; | |
3433 | - } else { | |
3434 | - if (str.StartsWith("RANDOM", StringComparison.OrdinalIgnoreCase)) { | |
3435 | - this.t入力・パラメータ食い込みチェック("RANDOM", ref str, ref str2); | |
3436 | - int num5 = 1; | |
3437 | - if (!int.TryParse(str2, out num5)) { | |
3438 | - num5 = 1; | |
3439 | - } | |
3440 | - this.n現在の乱数 = CDTXMania.Random.Next(num5) + 1; | |
3441 | - } | |
3442 | - if (str.StartsWith("SOUND_NOWLOADING", StringComparison.OrdinalIgnoreCase)) { | |
3443 | - this.t入力・パラメータ食い込みチェック("SOUND_NOWLOADING", ref str, ref str2); | |
3444 | - this.SOUND_NOWLOADING = str2; | |
3445 | - } else if (!this.bヘッダのみ) { | |
3446 | - if (str.StartsWith("PANEL", StringComparison.OrdinalIgnoreCase)) { | |
3447 | - this.t入力・パラメータ食い込みチェック("PANEL", ref str, ref str2); | |
3448 | - int dummyResult; // #23885 2010.12.12 yyagi: not to confuse "#PANEL strings (panel)" and "#PANEL int (panpot of EL)" | |
3449 | - if (!int.TryParse(str2, out dummyResult)) { // 数値じゃないならPANELとみなす | |
3450 | - this.PANEL = str2; // | |
3451 | - goto EOL; // | |
3452 | - } // 数値ならPAN ELとみなす | |
3612 | + //----------------- | |
3613 | + #endregion | |
3614 | + #region [ MIDIFILE ] | |
3615 | + //----------------- | |
3616 | + else if( strコマンド.StartsWith( "MIDIFILE", StringComparison.OrdinalIgnoreCase ) ) | |
3617 | + { | |
3618 | + this.t入力・パラメータ食い込みチェック( "MIDIFILE", ref strコマンド, ref strパラメータ ); | |
3619 | + this.MIDIFILE = strパラメータ; | |
3620 | + } | |
3621 | + //----------------- | |
3622 | + #endregion | |
3623 | + #region [ MIDINOTE ] | |
3624 | + //----------------- | |
3625 | + else if( strコマンド.StartsWith( "MIDINOTE", StringComparison.OrdinalIgnoreCase ) ) | |
3626 | + { | |
3627 | + this.t入力・パラメータ食い込みチェック( "MIDINOTE", ref strコマンド, ref strパラメータ ); | |
3628 | + this.MIDINOTE = strパラメータ.ToLower().Equals( "on" ); | |
3629 | + } | |
3630 | + //----------------- | |
3631 | + #endregion | |
3632 | + #region [ BLACKCOLORKEY ] | |
3633 | + //----------------- | |
3634 | + else if( strコマンド.StartsWith( "BLACKCOLORKEY", StringComparison.OrdinalIgnoreCase ) ) | |
3635 | + { | |
3636 | + this.t入力・パラメータ食い込みチェック( "BLACKCOLORKEY", ref strコマンド, ref strパラメータ ); | |
3637 | + this.BLACKCOLORKEY = strパラメータ.ToLower().Equals( "on" ); | |
3638 | + } | |
3639 | + //----------------- | |
3640 | + #endregion | |
3641 | + #region [ BASEBPM ] | |
3642 | + //----------------- | |
3643 | + else if( strコマンド.StartsWith( "BASEBPM", StringComparison.OrdinalIgnoreCase ) ) | |
3644 | + { | |
3645 | + this.t入力・パラメータ食い込みチェック( "BASEBPM", ref strコマンド, ref strパラメータ ); | |
3453 | 3646 | |
3454 | - } | |
3455 | - if (str.StartsWith("MIDIFILE", StringComparison.OrdinalIgnoreCase)) { | |
3456 | - this.t入力・パラメータ食い込みチェック("MIDIFILE", ref str, ref str2); | |
3457 | - this.MIDIFILE = str2; | |
3458 | - } else { | |
3459 | - if (str.StartsWith("MIDINOTE", StringComparison.OrdinalIgnoreCase)) { | |
3460 | - this.t入力・パラメータ食い込みチェック("MIDINOTE", ref str, ref str2); | |
3461 | - this.MIDINOTE = str2.ToLower().Equals("on"); | |
3462 | - } | |
3463 | - if (str.StartsWith("BLACKCOLORKEY", StringComparison.OrdinalIgnoreCase)) { | |
3464 | - this.t入力・パラメータ食い込みチェック("BLACKCOLORKEY", ref str, ref str2); | |
3465 | - this.BLACKCOLORKEY = str2.ToLower().Equals("on"); | |
3466 | - } | |
3467 | - if (str.StartsWith("BASEBPM", StringComparison.OrdinalIgnoreCase)) { | |
3468 | - this.t入力・パラメータ食い込みチェック("BASEBPM", ref str, ref str2); | |
3469 | - double basebpm = 0.0; | |
3470 | - //if( double.TryParse( str2, out num6 ) && ( num6 > 0.0 ) ) | |
3471 | - if (TryParse(str2, out basebpm) && basebpm > 0.0) // #23880 2010.12.30 yyagi: alternative TryParse to permit both '.' and ',' for decimal point | |
3472 | - { // #24204 2011.01.21 yyagi: Fix the condition correctly | |
3473 | - this.BASEBPM = basebpm; | |
3474 | - } | |
3475 | - } else if (str.StartsWith("SOUND_STAGEFAILED", StringComparison.OrdinalIgnoreCase)) { | |
3476 | - this.t入力・パラメータ食い込みチェック("SOUND_STAGEFAILED", ref str, ref str2); | |
3477 | - this.SOUND_STAGEFAILED = str2; | |
3478 | - } else if (str.StartsWith("SOUND_FULLCOMBO", StringComparison.OrdinalIgnoreCase)) { | |
3479 | - this.t入力・パラメータ食い込みチェック("SOUND_FULLCOMBO", ref str, ref str2); | |
3480 | - this.SOUND_FULLCOMBO = str2; | |
3481 | - } else if (str.StartsWith("SOUND_AUDIENCE", StringComparison.OrdinalIgnoreCase)) { | |
3482 | - this.t入力・パラメータ食い込みチェック("SOUND_AUDIENCE", ref str, ref str2); | |
3483 | - this.SOUND_AUDIENCE = str2; | |
3484 | - } else if (!this.t入力・行解析・WAVVOL_VOLUME(str, str2, str3) && | |
3485 | - !this.t入力・行解析・WAVPAN_PAN(str, str2, str3) && | |
3486 | - !this.t入力・行解析・WAV(str, str2, str3) && | |
3487 | - !this.t入力・行解析・BMPTEX(str, str2, str3) && | |
3488 | - !this.t入力・行解析・BMP(str, str2, str3) && | |
3489 | - !this.t入力・行解析・BGAPAN(str, str2, str3) && | |
3490 | - !this.t入力・行解析・BGA(str, str2, str3) && | |
3491 | - !this.t入力・行解析・AVIPAN(str, str2, str3) && | |
3492 | - !this.t入力・行解析・AVI_VIDEO(str, str2, str3) && | |
3493 | - !this.t入力・行解析・BPM_BPMzz(str, str2, str3) && | |
3494 | - !this.t入力・行解析・RESULTIMAGE(str, str2, str3) && | |
3495 | - !this.t入力・行解析・RESULTMOVIE(str, str2, str3) && | |
3496 | - !this.t入力・行解析・RESULTSOUND(str, str2, str3) && | |
3497 | - !this.t入力・行解析・SIZE(str, str2, str3)) { | |
3498 | - this.t入力・行解析・チップ配置(str, str2, str3); | |
3499 | - } | |
3500 | - } | |
3501 | - EOL: | |
3502 | - int xx = 0; // #23885 2010.12.12 yyagi: dummy line to exit parsing the line | |
3647 | + double basebpm = 0.0; | |
3648 | + //if( double.TryParse( str2, out num6 ) && ( num6 > 0.0 ) ) | |
3649 | + if( TryParse( strパラメータ, out basebpm ) && basebpm > 0.0 ) // #23880 2010.12.30 yyagi: alternative TryParse to permit both '.' and ',' for decimal point | |
3650 | + { // #24204 2011.01.21 yyagi: Fix the condition correctly | |
3651 | + this.BASEBPM = basebpm; | |
3503 | 3652 | } |
3504 | 3653 | } |
3654 | + //----------------- | |
3655 | + #endregion | |
3656 | + #region [ SOUND_STAGEFAILED ] | |
3657 | + //----------------- | |
3658 | + else if( strコマンド.StartsWith( "SOUND_STAGEFAILED", StringComparison.OrdinalIgnoreCase ) ) | |
3659 | + { | |
3660 | + this.t入力・パラメータ食い込みチェック( "SOUND_STAGEFAILED", ref strコマンド, ref strパラメータ ); | |
3661 | + this.SOUND_STAGEFAILED = strパラメータ; | |
3662 | + } | |
3663 | + //----------------- | |
3664 | + #endregion | |
3665 | + #region [ SOUND_FULLCOMBO ] | |
3666 | + //----------------- | |
3667 | + else if( strコマンド.StartsWith( "SOUND_FULLCOMBO", StringComparison.OrdinalIgnoreCase ) ) | |
3668 | + { | |
3669 | + this.t入力・パラメータ食い込みチェック( "SOUND_FULLCOMBO", ref strコマンド, ref strパラメータ ); | |
3670 | + this.SOUND_FULLCOMBO = strパラメータ; | |
3671 | + } | |
3672 | + //----------------- | |
3673 | + #endregion | |
3674 | + #region [ SOUND_AUDIENCE ] | |
3675 | + //----------------- | |
3676 | + else if( strコマンド.StartsWith( "SOUND_AUDIENCE", StringComparison.OrdinalIgnoreCase ) ) | |
3677 | + { | |
3678 | + this.t入力・パラメータ食い込みチェック( "SOUND_AUDIENCE", ref strコマンド, ref strパラメータ ); | |
3679 | + this.SOUND_AUDIENCE = strパラメータ; | |
3680 | + } | |
3681 | + //----------------- | |
3682 | + #endregion | |
3683 | + | |
3684 | + // オブジェクト記述コマンドの処理。 | |
3685 | + | |
3686 | + else if( !this.t入力・行解析・WAVVOL_VOLUME( strコマンド, strパラメータ, strコメント ) && | |
3687 | + !this.t入力・行解析・WAVPAN_PAN( strコマンド, strパラメータ, strコメント ) && | |
3688 | + !this.t入力・行解析・WAV( strコマンド, strパラメータ, strコメント ) && | |
3689 | + !this.t入力・行解析・BMPTEX( strコマンド, strパラメータ, strコメント ) && | |
3690 | + !this.t入力・行解析・BMP( strコマンド, strパラメータ, strコメント ) && | |
3691 | + !this.t入力・行解析・BGAPAN( strコマンド, strパラメータ, strコメント ) && | |
3692 | + !this.t入力・行解析・BGA( strコマンド, strパラメータ, strコメント ) && | |
3693 | + !this.t入力・行解析・AVIPAN( strコマンド, strパラメータ, strコメント ) && | |
3694 | + !this.t入力・行解析・AVI_VIDEO( strコマンド, strパラメータ, strコメント ) && | |
3695 | + !this.t入力・行解析・BPM_BPMzz( strコマンド, strパラメータ, strコメント ) && | |
3696 | + !this.t入力・行解析・RESULTIMAGE( strコマンド, strパラメータ, strコメント ) && | |
3697 | + !this.t入力・行解析・RESULTMOVIE( strコマンド, strパラメータ, strコメント ) && | |
3698 | + !this.t入力・行解析・RESULTSOUND( strコマンド, strパラメータ, strコメント ) && | |
3699 | + !this.t入力・行解析・SIZE( strコマンド, strパラメータ, strコメント ) ) | |
3700 | + { | |
3701 | + this.t入力・行解析・チップ配置( strコマンド, strパラメータ, strコメント ); | |
3702 | + } | |
3703 | + EOL: | |
3704 | + Debug.Assert( true ); // #23885 2010.12.12 yyagi: dummy line to exit parsing the line | |
3705 | + // 2011.8.17 from: "int xx=0;" から変更。毎回警告が出るので。 | |
3505 | 3706 | } |
3506 | 3707 | } |
3507 | 3708 | } |
3508 | 3709 | private bool t入力・行解析・AVI_VIDEO( string strコマンド, string strパラメータ, string strコメント ) |
3509 | 3710 | { |
3711 | + // (1) コマンドを処理。 | |
3712 | + | |
3713 | + #region [ "AVI" or "VIDEO" で始まらないコマンドは無効。] | |
3714 | + //----------------- | |
3510 | 3715 | if( strコマンド.StartsWith( "AVI", StringComparison.OrdinalIgnoreCase ) ) |
3511 | - { | |
3512 | - strコマンド = strコマンド.Substring( 3 ); | |
3513 | - } | |
3716 | + strコマンド = strコマンド.Substring( 3 ); // strコマンド から先頭の"AVI"文字を除去。 | |
3717 | + | |
3514 | 3718 | else if( strコマンド.StartsWith( "VIDEO", StringComparison.OrdinalIgnoreCase ) ) |
3515 | - { | |
3516 | - strコマンド = strコマンド.Substring( 5 ); | |
3517 | - } | |
3719 | + strコマンド = strコマンド.Substring( 5 ); // strコマンド から先頭の"VIDEO"文字を除去。 | |
3720 | + | |
3518 | 3721 | else |
3519 | - { | |
3520 | 3722 | return false; |
3521 | - } | |
3723 | + //----------------- | |
3724 | + #endregion | |
3725 | + | |
3726 | + // (2) パラメータを処理。 | |
3727 | + | |
3522 | 3728 | if( strコマンド.Length < 2 ) |
3729 | + return false; // AVI番号 zz がないなら無効。 | |
3730 | + | |
3731 | + #region [ AVI番号 zz を取得する。] | |
3732 | + //----------------- | |
3733 | + int zz = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
3734 | + if( zz < 0 || zz >= 36 * 36 ) | |
3523 | 3735 | { |
3736 | + Trace.TraceError( "AVI(VIDEO)番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
3524 | 3737 | return false; |
3525 | 3738 | } |
3526 | - int key = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
3527 | - if( ( key < 0 ) || ( key >= 36 * 36 ) ) | |
3528 | - { | |
3529 | - Trace.TraceError( "AVI(VIDEO)番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
3530 | - return false; | |
3531 | - } | |
3532 | - CAVI cavi = new CAVI(); | |
3533 | - cavi.n番号 = key; | |
3534 | - cavi.strファイル名 = strパラメータ; | |
3535 | - cavi.strコメント文 = strコメント; | |
3536 | - if( this.listAVI.ContainsKey( key ) ) | |
3537 | - { | |
3538 | - this.listAVI.Remove( key ); | |
3539 | - } | |
3540 | - this.listAVI.Add( key, cavi ); | |
3739 | + //----------------- | |
3740 | + #endregion | |
3741 | + | |
3742 | + #region [ AVIリストに {zz, avi} の組を登録する。 ] | |
3743 | + //----------------- | |
3744 | + var avi = new CAVI() { | |
3745 | + n番号 = zz, | |
3746 | + strファイル名 = strパラメータ, | |
3747 | + strコメント文 = strコメント, | |
3748 | + }; | |
3749 | + | |
3750 | + if( this.listAVI.ContainsKey( zz ) ) // 既にリスト中に存在しているなら削除。後のものが有効。 | |
3751 | + this.listAVI.Remove( zz ); | |
3752 | + | |
3753 | + this.listAVI.Add( zz, avi ); | |
3754 | + //----------------- | |
3755 | + #endregion | |
3756 | + | |
3541 | 3757 | return true; |
3542 | 3758 | } |
3543 | 3759 | private bool t入力・行解析・AVIPAN( string strコマンド, string strパラメータ, string strコメント ) |
3544 | 3760 | { |
3545 | - if( strコマンド.StartsWith( "AVIPAN", StringComparison.OrdinalIgnoreCase ) ) | |
3546 | - { | |
3547 | - strコマンド = strコマンド.Substring( 6 ); | |
3548 | - } | |
3549 | - else | |
3550 | - { | |
3761 | + // (1) コマンドを処理。 | |
3762 | + | |
3763 | + #region [ "AVIPAN" で始まらないコマンドは無効。] | |
3764 | + //----------------- | |
3765 | + if( !strコマンド.StartsWith( "AVIPAN", StringComparison.OrdinalIgnoreCase ) ) | |
3551 | 3766 | return false; |
3552 | - } | |
3767 | + | |
3768 | + strコマンド = strコマンド.Substring( 6 ); // strコマンド から先頭の"AVIPAN"文字を除去。 | |
3769 | + //----------------- | |
3770 | + #endregion | |
3771 | + | |
3772 | + // (2) パラメータを処理。 | |
3773 | + | |
3553 | 3774 | if( strコマンド.Length < 2 ) |
3775 | + return false; // AVIPAN番号 zz がないなら無効。 | |
3776 | + | |
3777 | + #region [ AVIPAN番号 zz を取得する。] | |
3778 | + //----------------- | |
3779 | + int zz = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
3780 | + if( zz < 0 || zz >= 36 * 36 ) | |
3554 | 3781 | { |
3782 | + Trace.TraceError( "AVIPAN番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
3555 | 3783 | return false; |
3556 | 3784 | } |
3557 | - int key = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
3558 | - if( ( key < 0 ) || ( key >= 36 * 36 ) ) | |
3785 | + //----------------- | |
3786 | + #endregion | |
3787 | + | |
3788 | + var avipan = new CAVIPAN() { | |
3789 | + n番号 = zz, | |
3790 | + }; | |
3791 | + | |
3792 | + // パラメータ引数(14個)を取得し、avipan に登録していく。 | |
3793 | + | |
3794 | + string[] strParams = strパラメータ.Split( new char[] { ' ', ',', '(', ')', '[', ']', 'x', '|' }, StringSplitOptions.RemoveEmptyEntries ); | |
3795 | + | |
3796 | + #region [ パラメータ引数は全14個ないと無効。] | |
3797 | + //----------------- | |
3798 | + if( strParams.Length < 14 ) | |
3559 | 3799 | { |
3560 | - Trace.TraceError( "AVIPAN番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
3800 | + Trace.TraceError( "AVIPAN: 引数が足りません。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
3561 | 3801 | return false; |
3562 | 3802 | } |
3563 | - CAVIPAN cavipan = new CAVIPAN(); | |
3564 | - cavipan.n番号 = key; | |
3565 | - string[] strArray = strパラメータ.Split( new char[] { ' ', ',', '(', ')', '[', ']', 'x', '|' }, StringSplitOptions.RemoveEmptyEntries ); | |
3566 | - if( strArray.Length < 14 ) | |
3803 | + //----------------- | |
3804 | + #endregion | |
3805 | + | |
3806 | + int i = 0; | |
3807 | + int n値 = 0; | |
3808 | + | |
3809 | + #region [ 1. AVI番号 ] | |
3810 | + //----------------- | |
3811 | + if( string.IsNullOrEmpty( strParams[ i ] ) || strParams[ i ].Length > 2 ) | |
3567 | 3812 | { |
3568 | - Trace.TraceError( "AVIPAN: 引数が足りません。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
3813 | + Trace.TraceError( "AVIPAN: {2}番目の数(AVI番号)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3569 | 3814 | return false; |
3570 | 3815 | } |
3571 | - int index = 0; | |
3572 | - int result = 0; | |
3573 | - if( ( strArray[ index ].Length == 0 ) || ( strArray[ index ].Length > 2 ) ) | |
3816 | + avipan.nAVI番号 = C変換.n36進数2桁の文字列を数値に変換して返す( strParams[ i ] ); | |
3817 | + if( avipan.nAVI番号 < 1 || avipan.nAVI番号 >= 36 * 36 ) | |
3574 | 3818 | { |
3575 | - Trace.TraceError( "AVIPAN: {2}番目の数(AVI番号)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3819 | + Trace.TraceError( "AVIPAN: {2}番目の数(AVI番号)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3576 | 3820 | return false; |
3577 | 3821 | } |
3578 | - cavipan.nAVI番号 = C変換.n36進数2桁の文字列を数値に変換して返す( strArray[ index ] ); | |
3579 | - if( ( cavipan.nAVI番号 < 1 ) || ( cavipan.nAVI番号 >= 36 * 36 ) ) | |
3822 | + i++; | |
3823 | + //----------------- | |
3824 | + #endregion | |
3825 | + #region [ 2. 開始転送サイズ・幅 ] | |
3826 | + //----------------- | |
3827 | + n値 = 0; | |
3828 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3580 | 3829 | { |
3581 | - Trace.TraceError( "AVIPAN: {2}番目の数(AVI番号)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3830 | + Trace.TraceError( "AVIPAN: {2}番目の引数(開始転送サイズ・幅)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3582 | 3831 | return false; |
3583 | 3832 | } |
3584 | - index++; | |
3585 | - result = 0; | |
3586 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
3833 | + avipan.sz開始サイズ.Width = n値; | |
3834 | + i++; | |
3835 | + //----------------- | |
3836 | + #endregion | |
3837 | + #region [ 3. 転送サイズ・高さ ] | |
3838 | + //----------------- | |
3839 | + n値 = 0; | |
3840 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3587 | 3841 | { |
3588 | - Trace.TraceError( "AVIPAN: {2}番目の引数(開始転送サイズ・幅)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3842 | + Trace.TraceError( "AVIPAN: {2}番目の引数(開始転送サイズ・高さ)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3589 | 3843 | return false; |
3590 | 3844 | } |
3591 | - cavipan.sz開始サイズ.Width = result; | |
3592 | - index++; | |
3593 | - result = 0; | |
3594 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
3845 | + avipan.sz開始サイズ.Height = n値; | |
3846 | + i++; | |
3847 | + //----------------- | |
3848 | + #endregion | |
3849 | + #region [ 4. 終了転送サイズ・幅 ] | |
3850 | + //----------------- | |
3851 | + n値 = 0; | |
3852 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3595 | 3853 | { |
3596 | - Trace.TraceError( "AVIPAN: {2}番目の引数(開始転送サイズ・高さ)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3854 | + Trace.TraceError( "AVIPAN: {2}番目の引数(終了転送サイズ・幅)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3597 | 3855 | return false; |
3598 | 3856 | } |
3599 | - cavipan.sz開始サイズ.Height = result; | |
3600 | - index++; | |
3601 | - result = 0; | |
3602 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
3857 | + avipan.sz終了サイズ.Width = n値; | |
3858 | + i++; | |
3859 | + //----------------- | |
3860 | + #endregion | |
3861 | + #region [ 5. 終了転送サイズ・高さ ] | |
3862 | + //----------------- | |
3863 | + n値 = 0; | |
3864 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3603 | 3865 | { |
3604 | - Trace.TraceError( "AVIPAN: {2}番目の引数(終了転送サイズ・幅)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3866 | + Trace.TraceError( "AVIPAN: {2}番目の引数(終了転送サイズ・高さ)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3605 | 3867 | return false; |
3606 | 3868 | } |
3607 | - cavipan.sz終了サイズ.Width = result; | |
3608 | - index++; | |
3609 | - result = 0; | |
3610 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
3869 | + avipan.sz終了サイズ.Height = n値; | |
3870 | + i++; | |
3871 | + //----------------- | |
3872 | + #endregion | |
3873 | + #region [ 6. 動画側開始位置・X ] | |
3874 | + //----------------- | |
3875 | + n値 = 0; | |
3876 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3611 | 3877 | { |
3612 | - Trace.TraceError( "AVIPAN: {2}番目の引数(終了転送サイズ・幅)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3878 | + Trace.TraceError( "AVIPAN: {2}番目の引数(動画側開始位置・X)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3613 | 3879 | return false; |
3614 | 3880 | } |
3615 | - cavipan.sz終了サイズ.Height = result; | |
3616 | - index++; | |
3617 | - result = 0; | |
3618 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
3881 | + avipan.pt動画側開始位置.X = n値; | |
3882 | + i++; | |
3883 | + //----------------- | |
3884 | + #endregion | |
3885 | + #region [ 7. 動画側開始位置・Y ] | |
3886 | + //----------------- | |
3887 | + n値 = 0; | |
3888 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3619 | 3889 | { |
3620 | - Trace.TraceError( "AVIPAN: {2}番目の引数(画像側開始位置・X)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3890 | + Trace.TraceError( "AVIPAN: {2}番目の引数(動画側開始位置・Y)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3621 | 3891 | return false; |
3622 | 3892 | } |
3623 | - cavipan.pt動画側開始位置.X = result; | |
3624 | - index++; | |
3625 | - result = 0; | |
3626 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
3893 | + avipan.pt動画側開始位置.Y = n値; | |
3894 | + i++; | |
3895 | + //----------------- | |
3896 | + #endregion | |
3897 | + #region [ 8. 動画側終了位置・X ] | |
3898 | + //----------------- | |
3899 | + n値 = 0; | |
3900 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3627 | 3901 | { |
3628 | - Trace.TraceError( "AVIPAN: {2}番目の引数(画像側開始位置・Y)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3902 | + Trace.TraceError( "AVIPAN: {2}番目の引数(動画側終了位置・X)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3629 | 3903 | return false; |
3630 | 3904 | } |
3631 | - cavipan.pt動画側開始位置.Y = result; | |
3632 | - index++; | |
3633 | - result = 0; | |
3634 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
3905 | + avipan.pt動画側終了位置.X = n値; | |
3906 | + i++; | |
3907 | + //----------------- | |
3908 | + #endregion | |
3909 | + #region [ 9. 動画側終了位置・Y ] | |
3910 | + //----------------- | |
3911 | + n値 = 0; | |
3912 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3635 | 3913 | { |
3636 | - Trace.TraceError( "AVIPAN: {2}番目の引数(画像側終了位置・X)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3914 | + Trace.TraceError( "AVIPAN: {2}番目の引数(動画側終了位置・Y)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3637 | 3915 | return false; |
3638 | 3916 | } |
3639 | - cavipan.pt動画側終了位置.X = result; | |
3640 | - index++; | |
3641 | - result = 0; | |
3642 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
3917 | + avipan.pt動画側終了位置.Y = n値; | |
3918 | + i++; | |
3919 | + //----------------- | |
3920 | + #endregion | |
3921 | + #region [ 10.表示側開始位置・X ] | |
3922 | + //----------------- | |
3923 | + n値 = 0; | |
3924 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3643 | 3925 | { |
3644 | - Trace.TraceError( "AVIPAN: {2}番目の引数(画像側終了位置・Y)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3926 | + Trace.TraceError( "AVIPAN: {2}番目の引数(表示側開始位置・X)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3645 | 3927 | return false; |
3646 | 3928 | } |
3647 | - cavipan.pt動画側終了位置.Y = result; | |
3648 | - index++; | |
3649 | - result = 0; | |
3650 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
3929 | + avipan.pt表示側開始位置.X = n値; | |
3930 | + i++; | |
3931 | + //----------------- | |
3932 | + #endregion | |
3933 | + #region [ 11.表示側開始位置・Y ] | |
3934 | + //----------------- | |
3935 | + n値 = 0; | |
3936 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3651 | 3937 | { |
3652 | - Trace.TraceError( "AVIPAN: {2}番目の引数(表示側開始位置・X)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3938 | + Trace.TraceError( "AVIPAN: {2}番目の引数(表示側開始位置・Y)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3653 | 3939 | return false; |
3654 | 3940 | } |
3655 | - cavipan.pt表示側開始位置.X = result; | |
3656 | - index++; | |
3657 | - result = 0; | |
3658 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
3941 | + avipan.pt表示側開始位置.Y = n値; | |
3942 | + i++; | |
3943 | + //----------------- | |
3944 | + #endregion | |
3945 | + #region [ 12.表示側終了位置・X ] | |
3946 | + //----------------- | |
3947 | + n値 = 0; | |
3948 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3659 | 3949 | { |
3660 | - Trace.TraceError( "AVIPAN: {2}番目の引数(表示側開始位置・Y)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3950 | + Trace.TraceError( "AVIPAN: {2}番目の引数(表示側終了位置・X)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3661 | 3951 | return false; |
3662 | 3952 | } |
3663 | - cavipan.pt表示側開始位置.Y = result; | |
3664 | - index++; | |
3665 | - result = 0; | |
3666 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
3953 | + avipan.pt表示側終了位置.X = n値; | |
3954 | + i++; | |
3955 | + //----------------- | |
3956 | + #endregion | |
3957 | + #region [ 13.表示側終了位置・Y ] | |
3958 | + //----------------- | |
3959 | + n値 = 0; | |
3960 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3667 | 3961 | { |
3668 | - Trace.TraceError( "AVIPAN: {2}番目の引数(表示側終了位置・X)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3962 | + Trace.TraceError( "AVIPAN: {2}番目の引数(表示側終了位置・Y)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3669 | 3963 | return false; |
3670 | 3964 | } |
3671 | - cavipan.pt表示側終了位置.X = result; | |
3672 | - index++; | |
3673 | - result = 0; | |
3674 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
3965 | + avipan.pt表示側終了位置.Y = n値; | |
3966 | + i++; | |
3967 | + //----------------- | |
3968 | + #endregion | |
3969 | + #region [ 14.移動時間 ] | |
3970 | + //----------------- | |
3971 | + n値 = 0; | |
3972 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3675 | 3973 | { |
3676 | - Trace.TraceError( "AVIPAN: {2}番目の引数(表示側終了位置・Y)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3974 | + Trace.TraceError( "AVIPAN: {2}番目の引数(移動時間)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3677 | 3975 | return false; |
3678 | 3976 | } |
3679 | - cavipan.pt表示側終了位置.Y = result; | |
3680 | - index++; | |
3681 | - result = 0; | |
3682 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
3683 | - { | |
3684 | - Trace.TraceError( "AVIPAN: {2}番目の引数(移動時間)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3685 | - return false; | |
3686 | - } | |
3687 | - if( result < 0 ) | |
3688 | - { | |
3689 | - result = 0; | |
3690 | - } | |
3691 | - cavipan.n移動時間ct = result; | |
3692 | - index++; | |
3693 | - if( this.listAVIPAN.ContainsKey( key ) ) | |
3694 | - { | |
3695 | - this.listAVIPAN.Remove( key ); | |
3696 | - } | |
3697 | - this.listAVIPAN.Add( key, cavipan ); | |
3977 | + | |
3978 | + if( n値 < 0 ) | |
3979 | + n値 = 0; | |
3980 | + | |
3981 | + avipan.n移動時間ct = n値; | |
3982 | + i++; | |
3983 | + //----------------- | |
3984 | + #endregion | |
3985 | + | |
3986 | + #region [ AVIPANリストに {zz, avipan} の組を登録する。] | |
3987 | + //----------------- | |
3988 | + if( this.listAVIPAN.ContainsKey( zz ) ) // 既にリスト中に存在しているなら削除。後のものが有効。 | |
3989 | + this.listAVIPAN.Remove( zz ); | |
3990 | + | |
3991 | + this.listAVIPAN.Add( zz, avipan ); | |
3992 | + //----------------- | |
3993 | + #endregion | |
3994 | + | |
3698 | 3995 | return true; |
3699 | 3996 | } |
3700 | 3997 | private bool t入力・行解析・BGA( string strコマンド, string strパラメータ, string strコメント ) |
3701 | 3998 | { |
3702 | - if( strコマンド.StartsWith( "BGA", StringComparison.OrdinalIgnoreCase ) ) | |
3703 | - { | |
3704 | - strコマンド = strコマンド.Substring( 3 ); | |
3705 | - } | |
3706 | - else | |
3707 | - { | |
3999 | + // (1) コマンドを処理。 | |
4000 | + | |
4001 | + #region [ "BGA" で始まらないコマンドは無効。] | |
4002 | + //----------------- | |
4003 | + if( !strコマンド.StartsWith( "BGA", StringComparison.OrdinalIgnoreCase ) ) | |
3708 | 4004 | return false; |
3709 | - } | |
4005 | + | |
4006 | + strコマンド = strコマンド.Substring( 3 ); // strコマンド から先頭の"BGA"文字を除去。 | |
4007 | + //----------------- | |
4008 | + #endregion | |
4009 | + | |
4010 | + // (2) パラメータを処理。 | |
4011 | + | |
3710 | 4012 | if( strコマンド.Length < 2 ) |
4013 | + return false; // BGA番号 zz がないなら無効。 | |
4014 | + | |
4015 | + #region [ BGA番号 zz を取得する。] | |
4016 | + //----------------- | |
4017 | + int zz = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
4018 | + if( zz < 0 || zz >= 36 * 36 ) | |
3711 | 4019 | { |
4020 | + Trace.TraceError( "BGA番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
3712 | 4021 | return false; |
3713 | 4022 | } |
3714 | - int key = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
3715 | - if( ( key < 0 ) || ( key >= 36 * 36 ) ) | |
4023 | + //----------------- | |
4024 | + #endregion | |
4025 | + | |
4026 | + var bga = new CBGA() { | |
4027 | + n番号 = zz, | |
4028 | + }; | |
4029 | + | |
4030 | + // パラメータ引数(7個)を取得し、bga に登録していく。 | |
4031 | + | |
4032 | + string[] strParams = strパラメータ.Split( new char[] { ' ', ',', '(', ')', '[', ']', 'x', '|' }, StringSplitOptions.RemoveEmptyEntries ); | |
4033 | + | |
4034 | + #region [ パラメータ引数は全7個ないと無効。] | |
4035 | + //----------------- | |
4036 | + if( strParams.Length < 7 ) | |
3716 | 4037 | { |
3717 | - Trace.TraceError( "BGA番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
4038 | + Trace.TraceError( "BGA: 引数が足りません。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
3718 | 4039 | return false; |
3719 | 4040 | } |
3720 | - CBGA cbga = new CBGA(); | |
3721 | - cbga.n番号 = key; | |
3722 | - string[] strArray = strパラメータ.Split( new char[] { ' ', ',', '(', ')', '[', ']', 'x', '|' }, StringSplitOptions.RemoveEmptyEntries ); | |
3723 | - if( strArray.Length < 7 ) | |
4041 | + //----------------- | |
4042 | + #endregion | |
4043 | + | |
4044 | + int i = 0; | |
4045 | + int n値 = 0; | |
4046 | + | |
4047 | + #region [ 1.BMP番号 ] | |
4048 | + //----------------- | |
4049 | + if( string.IsNullOrEmpty( strParams[ i ] ) || strParams[ i ].Length > 2 ) | |
3724 | 4050 | { |
3725 | - Trace.TraceError( "BGA: 引数が足りません。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
4051 | + Trace.TraceError( "BGA: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3726 | 4052 | return false; |
3727 | 4053 | } |
3728 | - int index = 0; | |
3729 | - int result = 0; | |
3730 | - if( ( strArray[ index ].Length == 0 ) || ( strArray[ index ].Length > 2 ) ) | |
4054 | + bga.nBMP番号 = C変換.n36進数2桁の文字列を数値に変換して返す( strParams[ i ] ); | |
4055 | + if( bga.nBMP番号 < 1 || bga.nBMP番号 >= 36 * 36 ) | |
3731 | 4056 | { |
3732 | - Trace.TraceError( "BGA: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4057 | + Trace.TraceError( "BGA: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3733 | 4058 | return false; |
3734 | 4059 | } |
3735 | - cbga.nBMP番号 = C変換.n36進数2桁の文字列を数値に変換して返す( strArray[ index ] ); | |
3736 | - if( ( cbga.nBMP番号 < 1 ) || ( cbga.nBMP番号 >= 36 * 36 ) ) | |
4060 | + i++; | |
4061 | + //----------------- | |
4062 | + #endregion | |
4063 | + #region [ 2.画像側位置1・X ] | |
4064 | + //----------------- | |
4065 | + n値 = 0; | |
4066 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3737 | 4067 | { |
3738 | - Trace.TraceError( "BGAPAN: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4068 | + Trace.TraceError( "BGA: {2}番目の引数(画像側位置1・X)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3739 | 4069 | return false; |
3740 | 4070 | } |
3741 | - index++; | |
3742 | - result = 0; | |
3743 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4071 | + bga.pt画像側左上座標.X = n値; | |
4072 | + i++; | |
4073 | + //----------------- | |
4074 | + #endregion | |
4075 | + #region [ 3.画像側位置1・Y ] | |
4076 | + //----------------- | |
4077 | + n値 = 0; | |
4078 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3744 | 4079 | { |
3745 | - Trace.TraceError( "BGA: {2}番目の引数(画像側位置1・X)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4080 | + Trace.TraceError( "BGA: {2}番目の引数(画像側位置1・Y)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3746 | 4081 | return false; |
3747 | 4082 | } |
3748 | - cbga.pt画像側左上座標.X = result; | |
3749 | - index++; | |
3750 | - result = 0; | |
3751 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4083 | + bga.pt画像側左上座標.Y = n値; | |
4084 | + i++; | |
4085 | + //----------------- | |
4086 | + #endregion | |
4087 | + #region [ 4.画像側位置2・X ] | |
4088 | + //----------------- | |
4089 | + n値 = 0; | |
4090 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3752 | 4091 | { |
3753 | - Trace.TraceError( "BGA: {2}番目の引数(画像側位置1・Y)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4092 | + Trace.TraceError( "BGA: {2}番目の引数(画像側位置2・X)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3754 | 4093 | return false; |
3755 | 4094 | } |
3756 | - cbga.pt画像側左上座標.Y = result; | |
3757 | - index++; | |
3758 | - result = 0; | |
3759 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4095 | + bga.pt画像側右下座標.X = n値; | |
4096 | + i++; | |
4097 | + //----------------- | |
4098 | + #endregion | |
4099 | + #region [ 5.画像側位置2・Y ] | |
4100 | + //----------------- | |
4101 | + n値 = 0; | |
4102 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3760 | 4103 | { |
3761 | - Trace.TraceError( "BGA: {2}番目の引数(画像側座標2・X)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4104 | + Trace.TraceError( "BGA: {2}番目の引数(画像側座標2・Y)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3762 | 4105 | return false; |
3763 | 4106 | } |
3764 | - cbga.pt画像側右下座標.X = result; | |
3765 | - index++; | |
3766 | - result = 0; | |
3767 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4107 | + bga.pt画像側右下座標.Y = n値; | |
4108 | + i++; | |
4109 | + //----------------- | |
4110 | + #endregion | |
4111 | + #region [ 6.表示位置・X ] | |
4112 | + //----------------- | |
4113 | + n値 = 0; | |
4114 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3768 | 4115 | { |
3769 | - Trace.TraceError( "BGA: {2}番目の引数(画像側座標2・Y)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4116 | + Trace.TraceError( "BGA: {2}番目の引数(表示位置・X)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3770 | 4117 | return false; |
3771 | 4118 | } |
3772 | - cbga.pt画像側右下座標.Y = result; | |
3773 | - index++; | |
3774 | - result = 0; | |
3775 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4119 | + bga.pt表示座標.X = n値; | |
4120 | + i++; | |
4121 | + //----------------- | |
4122 | + #endregion | |
4123 | + #region [ 7.表示位置・Y ] | |
4124 | + //----------------- | |
4125 | + n値 = 0; | |
4126 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3776 | 4127 | { |
3777 | - Trace.TraceError( "BGA: {2}番目の引数(表示位置・X)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4128 | + Trace.TraceError( "BGA: {2}番目の引数(表示位置・Y)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3778 | 4129 | return false; |
3779 | 4130 | } |
3780 | - cbga.pt表示座標.X = result; | |
3781 | - index++; | |
3782 | - result = 0; | |
3783 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4131 | + bga.pt表示座標.Y = n値; | |
4132 | + i++; | |
4133 | + //----------------- | |
4134 | + #endregion | |
4135 | + | |
4136 | + #region [ 画像側座標の正規化とクリッピング。] | |
4137 | + //----------------- | |
4138 | + if( bga.pt画像側左上座標.X > bga.pt画像側右下座標.X ) | |
3784 | 4139 | { |
3785 | - Trace.TraceError( "BGA: {2}番目の引数(表示位置・Y)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3786 | - return false; | |
4140 | + n値 = bga.pt画像側左上座標.X; | |
4141 | + bga.pt画像側左上座標.X = bga.pt画像側右下座標.X; | |
4142 | + bga.pt画像側右下座標.X = n値; | |
3787 | 4143 | } |
3788 | - cbga.pt表示座標.Y = result; | |
3789 | - index++; | |
3790 | - if( cbga.pt画像側左上座標.X > cbga.pt画像側右下座標.X ) | |
4144 | + if( bga.pt画像側左上座標.Y > bga.pt画像側右下座標.Y ) | |
3791 | 4145 | { |
3792 | - result = cbga.pt画像側左上座標.X; | |
3793 | - cbga.pt画像側左上座標.X = cbga.pt画像側右下座標.X; | |
3794 | - cbga.pt画像側右下座標.X = result; | |
4146 | + n値 = bga.pt画像側左上座標.Y; | |
4147 | + bga.pt画像側左上座標.Y = bga.pt画像側右下座標.Y; | |
4148 | + bga.pt画像側右下座標.Y = n値; | |
3795 | 4149 | } |
3796 | - if( cbga.pt画像側左上座標.Y > cbga.pt画像側右下座標.Y ) | |
3797 | - { | |
3798 | - result = cbga.pt画像側左上座標.Y; | |
3799 | - cbga.pt画像側左上座標.Y = cbga.pt画像側右下座標.Y; | |
3800 | - cbga.pt画像側右下座標.Y = result; | |
3801 | - } | |
3802 | - if( this.listBGA.ContainsKey( key ) ) | |
3803 | - { | |
3804 | - this.listBGA.Remove( key ); | |
3805 | - } | |
3806 | - this.listBGA.Add( key, cbga ); | |
4150 | + //----------------- | |
4151 | + #endregion | |
4152 | + #region [ BGAリストに {zz, bga} の組を登録する。] | |
4153 | + //----------------- | |
4154 | + if( this.listBGA.ContainsKey( zz ) ) // 既にリスト中に存在しているなら削除。後のものが有効。 | |
4155 | + this.listBGA.Remove( zz ); | |
4156 | + | |
4157 | + this.listBGA.Add( zz, bga ); | |
4158 | + //----------------- | |
4159 | + #endregion | |
4160 | + | |
3807 | 4161 | return true; |
3808 | 4162 | } |
3809 | 4163 | private bool t入力・行解析・BGAPAN( string strコマンド, string strパラメータ, string strコメント ) |
3810 | 4164 | { |
3811 | - if( strコマンド.StartsWith( "BGAPAN", StringComparison.OrdinalIgnoreCase ) ) | |
3812 | - { | |
3813 | - strコマンド = strコマンド.Substring( 6 ); | |
3814 | - } | |
3815 | - else | |
3816 | - { | |
4165 | + // (1) コマンドを処理。 | |
4166 | + | |
4167 | + #region [ "BGAPAN" で始まらないコマンドは無効。] | |
4168 | + //----------------- | |
4169 | + if( !strコマンド.StartsWith( "BGAPAN", StringComparison.OrdinalIgnoreCase ) ) | |
3817 | 4170 | return false; |
3818 | - } | |
4171 | + | |
4172 | + strコマンド = strコマンド.Substring( 6 ); // strコマンド から先頭の"BGAPAN"文字を除去。 | |
4173 | + //----------------- | |
4174 | + #endregion | |
4175 | + | |
4176 | + // (2) パラメータを処理。 | |
4177 | + | |
3819 | 4178 | if( strコマンド.Length < 2 ) |
4179 | + return false; // BGAPAN番号 zz がないなら無効。 | |
4180 | + | |
4181 | + #region [ BGAPAN番号 zz を取得する。] | |
4182 | + //----------------- | |
4183 | + int zz = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
4184 | + if( zz < 0 || zz >= 36 * 36 ) | |
3820 | 4185 | { |
4186 | + Trace.TraceError( "BGAPAN番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
3821 | 4187 | return false; |
3822 | 4188 | } |
3823 | - int key = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
3824 | - if( ( key < 0 ) || ( key >= 36 * 36 ) ) | |
4189 | + //----------------- | |
4190 | + #endregion | |
4191 | + | |
4192 | + var bgapan = new CBGAPAN() { | |
4193 | + n番号 = zz, | |
4194 | + }; | |
4195 | + | |
4196 | + // パラメータ引数(14個)を取得し、bgapan に登録していく。 | |
4197 | + | |
4198 | + string[] strParams = strパラメータ.Split( new char[] { ' ', ',', '(', ')', '[', ']', 'x', '|' }, StringSplitOptions.RemoveEmptyEntries ); | |
4199 | + | |
4200 | + #region [ パラメータ引数は全14個ないと無効。] | |
4201 | + //----------------- | |
4202 | + if( strParams.Length < 14 ) | |
3825 | 4203 | { |
3826 | - Trace.TraceError( "BGAPAN番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
4204 | + Trace.TraceError( "BGAPAN: 引数が足りません。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
3827 | 4205 | return false; |
3828 | 4206 | } |
3829 | - CBGAPAN cbgapan = new CBGAPAN(); | |
3830 | - cbgapan.n番号 = key; | |
3831 | - string[] strArray = strパラメータ.Split( new char[] { ' ', ',', '(', ')', '[', ']', 'x', '|' }, StringSplitOptions.RemoveEmptyEntries ); | |
3832 | - if( strArray.Length < 14 ) | |
4207 | + //----------------- | |
4208 | + #endregion | |
4209 | + | |
4210 | + int i = 0; | |
4211 | + int n値 = 0; | |
4212 | + | |
4213 | + #region [ 1. BMP番号 ] | |
4214 | + //----------------- | |
4215 | + if( string.IsNullOrEmpty( strParams[ i ] ) || strParams[ i ].Length > 2 ) | |
3833 | 4216 | { |
3834 | - Trace.TraceError( "BGAPAN: 引数が足りません。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
4217 | + Trace.TraceError( "BGAPAN: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3835 | 4218 | return false; |
3836 | 4219 | } |
3837 | - int index = 0; | |
3838 | - int result = 0; | |
3839 | - if( ( strArray[ index ].Length == 0 ) || ( strArray[ index ].Length > 2 ) ) | |
4220 | + bgapan.nBMP番号 = C変換.n36進数2桁の文字列を数値に変換して返す( strParams[ i ] ); | |
4221 | + if( bgapan.nBMP番号 < 1 || bgapan.nBMP番号 >= 36 * 36 ) | |
3840 | 4222 | { |
3841 | - Trace.TraceError( "BGAPAN: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4223 | + Trace.TraceError( "BGAPAN: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3842 | 4224 | return false; |
3843 | 4225 | } |
3844 | - cbgapan.nBMP番号 = C変換.n36進数2桁の文字列を数値に変換して返す( strArray[ index ] ); | |
3845 | - if( ( cbgapan.nBMP番号 < 1 ) || ( cbgapan.nBMP番号 >= 36 * 36 ) ) | |
4226 | + i++; | |
4227 | + //----------------- | |
4228 | + #endregion | |
4229 | + #region [ 2. 開始転送サイズ・幅 ] | |
4230 | + //----------------- | |
4231 | + n値 = 0; | |
4232 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3846 | 4233 | { |
3847 | - Trace.TraceError( "BGAPAN: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4234 | + Trace.TraceError( "BGAPAN: {2}番目の引数(開始転送サイズ・幅)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3848 | 4235 | return false; |
3849 | 4236 | } |
3850 | - index++; | |
3851 | - result = 0; | |
3852 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4237 | + bgapan.sz開始サイズ.Width = n値; | |
4238 | + i++; | |
4239 | + //----------------- | |
4240 | + #endregion | |
4241 | + #region [ 3. 開始転送サイズ・高さ ] | |
4242 | + //----------------- | |
4243 | + n値 = 0; | |
4244 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3853 | 4245 | { |
3854 | - Trace.TraceError( "BGAPAN: {2}番目の引数(開始転送サイズ・幅)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4246 | + Trace.TraceError( "BGAPAN: {2}番目の引数(開始転送サイズ・高さ)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3855 | 4247 | return false; |
3856 | 4248 | } |
3857 | - cbgapan.sz開始サイズ.Width = result; | |
3858 | - index++; | |
3859 | - result = 0; | |
3860 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4249 | + bgapan.sz開始サイズ.Height = n値; | |
4250 | + i++; | |
4251 | + //----------------- | |
4252 | + #endregion | |
4253 | + #region [ 4. 終了転送サイズ・幅 ] | |
4254 | + //----------------- | |
4255 | + n値 = 0; | |
4256 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3861 | 4257 | { |
3862 | - Trace.TraceError( "BGAPAN: {2}番目の引数(開始転送サイズ・高さ)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4258 | + Trace.TraceError( "BGAPAN: {2}番目の引数(終了転送サイズ・幅)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3863 | 4259 | return false; |
3864 | 4260 | } |
3865 | - cbgapan.sz開始サイズ.Height = result; | |
3866 | - index++; | |
3867 | - result = 0; | |
3868 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4261 | + bgapan.sz終了サイズ.Width = n値; | |
4262 | + i++; | |
4263 | + //----------------- | |
4264 | + #endregion | |
4265 | + #region [ 5. 終了転送サイズ・高さ ] | |
4266 | + //----------------- | |
4267 | + n値 = 0; | |
4268 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3869 | 4269 | { |
3870 | - Trace.TraceError( "BGAPAN: {2}番目の引数(終了転送サイズ・幅)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4270 | + Trace.TraceError( "BGAPAN: {2}番目の引数(終了転送サイズ・高さ)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3871 | 4271 | return false; |
3872 | 4272 | } |
3873 | - cbgapan.sz終了サイズ.Width = result; | |
3874 | - index++; | |
3875 | - result = 0; | |
3876 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4273 | + bgapan.sz終了サイズ.Height = n値; | |
4274 | + i++; | |
4275 | + //----------------- | |
4276 | + #endregion | |
4277 | + #region [ 6. 画像側開始位置・X ] | |
4278 | + //----------------- | |
4279 | + n値 = 0; | |
4280 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3877 | 4281 | { |
3878 | - Trace.TraceError( "BGAPAN: {2}番目の引数(終了転送サイズ・幅)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4282 | + Trace.TraceError( "BGAPAN: {2}番目の引数(画像側開始位置・X)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3879 | 4283 | return false; |
3880 | 4284 | } |
3881 | - cbgapan.sz終了サイズ.Height = result; | |
3882 | - index++; | |
3883 | - result = 0; | |
3884 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4285 | + bgapan.pt画像側開始位置.X = n値; | |
4286 | + i++; | |
4287 | + //----------------- | |
4288 | + #endregion | |
4289 | + #region [ 7. 画像側開始位置・Y ] | |
4290 | + //----------------- | |
4291 | + n値 = 0; | |
4292 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3885 | 4293 | { |
3886 | - Trace.TraceError( "BGAPAN: {2}番目の引数(画像側開始位置・X)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4294 | + Trace.TraceError( "BGAPAN: {2}番目の引数(画像側開始位置・Y)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3887 | 4295 | return false; |
3888 | 4296 | } |
3889 | - cbgapan.pt画像側開始位置.X = result; | |
3890 | - index++; | |
3891 | - result = 0; | |
3892 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4297 | + bgapan.pt画像側開始位置.Y = n値; | |
4298 | + i++; | |
4299 | + //----------------- | |
4300 | + #endregion | |
4301 | + #region [ 8. 画像側終了位置・X ] | |
4302 | + //----------------- | |
4303 | + n値 = 0; | |
4304 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3893 | 4305 | { |
3894 | - Trace.TraceError( "BGAPAN: {2}番目の引数(画像側開始位置・Y)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4306 | + Trace.TraceError( "BGAPAN: {2}番目の引数(画像側終了位置・X)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3895 | 4307 | return false; |
3896 | 4308 | } |
3897 | - cbgapan.pt画像側開始位置.Y = result; | |
3898 | - index++; | |
3899 | - result = 0; | |
3900 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4309 | + bgapan.pt画像側終了位置.X = n値; | |
4310 | + i++; | |
4311 | + //----------------- | |
4312 | + #endregion | |
4313 | + #region [ 9. 画像側終了位置・Y ] | |
4314 | + //----------------- | |
4315 | + n値 = 0; | |
4316 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3901 | 4317 | { |
3902 | - Trace.TraceError( "BGAPAN: {2}番目の引数(画像側終了位置・X)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4318 | + Trace.TraceError( "BGAPAN: {2}番目の引数(画像側終了位置・Y)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3903 | 4319 | return false; |
3904 | 4320 | } |
3905 | - cbgapan.pt画像側終了位置.X = result; | |
3906 | - index++; | |
3907 | - result = 0; | |
3908 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4321 | + bgapan.pt画像側終了位置.Y = n値; | |
4322 | + i++; | |
4323 | + //----------------- | |
4324 | + #endregion | |
4325 | + #region [ 10.表示側開始位置・X ] | |
4326 | + //----------------- | |
4327 | + n値 = 0; | |
4328 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3909 | 4329 | { |
3910 | - Trace.TraceError( "BGAPAN: {2}番目の引数(画像側終了位置・Y)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4330 | + Trace.TraceError( "BGAPAN: {2}番目の引数(表示側開始位置・X)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3911 | 4331 | return false; |
3912 | 4332 | } |
3913 | - cbgapan.pt画像側終了位置.Y = result; | |
3914 | - index++; | |
3915 | - result = 0; | |
3916 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4333 | + bgapan.pt表示側開始位置.X = n値; | |
4334 | + i++; | |
4335 | + //----------------- | |
4336 | + #endregion | |
4337 | + #region [ 11.表示側開始位置・Y ] | |
4338 | + //----------------- | |
4339 | + n値 = 0; | |
4340 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3917 | 4341 | { |
3918 | - Trace.TraceError( "BGAPAN: {2}番目の引数(表示側開始位置・X)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4342 | + Trace.TraceError( "BGAPAN: {2}番目の引数(表示側開始位置・Y)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3919 | 4343 | return false; |
3920 | 4344 | } |
3921 | - cbgapan.pt表示側開始位置.X = result; | |
3922 | - index++; | |
3923 | - result = 0; | |
3924 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4345 | + bgapan.pt表示側開始位置.Y = n値; | |
4346 | + i++; | |
4347 | + //----------------- | |
4348 | + #endregion | |
4349 | + #region [ 12.表示側終了位置・X ] | |
4350 | + //----------------- | |
4351 | + n値 = 0; | |
4352 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3925 | 4353 | { |
3926 | - Trace.TraceError( "BGAPAN: {2}番目の引数(表示側開始位置・Y)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4354 | + Trace.TraceError( "BGAPAN: {2}番目の引数(表示側終了位置・X)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3927 | 4355 | return false; |
3928 | 4356 | } |
3929 | - cbgapan.pt表示側開始位置.Y = result; | |
3930 | - index++; | |
3931 | - result = 0; | |
3932 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4357 | + bgapan.pt表示側終了位置.X = n値; | |
4358 | + i++; | |
4359 | + //----------------- | |
4360 | + #endregion | |
4361 | + #region [ 13.表示側終了位置・Y ] | |
4362 | + //----------------- | |
4363 | + n値 = 0; | |
4364 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3933 | 4365 | { |
3934 | - Trace.TraceError( "BGAPAN: {2}番目の引数(表示側終了位置・X)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4366 | + Trace.TraceError( "BGAPAN: {2}番目の引数(表示側終了位置・Y)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3935 | 4367 | return false; |
3936 | 4368 | } |
3937 | - cbgapan.pt表示側終了位置.X = result; | |
3938 | - index++; | |
3939 | - result = 0; | |
3940 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
4369 | + bgapan.pt表示側終了位置.Y = n値; | |
4370 | + i++; | |
4371 | + //----------------- | |
4372 | + #endregion | |
4373 | + #region [ 14.移動時間 ] | |
4374 | + //----------------- | |
4375 | + n値 = 0; | |
4376 | + if( !int.TryParse( strParams[ i ], out n値 ) ) | |
3941 | 4377 | { |
3942 | - Trace.TraceError( "BGAPAN: {2}番目の引数(表示側終了位置・Y)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
4378 | + Trace.TraceError( "BGAPAN: {2}番目の引数(移動時間)が異常です。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数, i + 1 ); | |
3943 | 4379 | return false; |
3944 | 4380 | } |
3945 | - cbgapan.pt表示側終了位置.Y = result; | |
3946 | - index++; | |
3947 | - result = 0; | |
3948 | - if( !int.TryParse( strArray[ index ], out result ) ) | |
3949 | - { | |
3950 | - Trace.TraceError( "BGAPAN: {2}番目の引数(移動時間)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } ); | |
3951 | - return false; | |
3952 | - } | |
3953 | - if( result < 0 ) | |
3954 | - { | |
3955 | - result = 0; | |
3956 | - } | |
3957 | - cbgapan.n移動時間ct = result; | |
3958 | - index++; | |
3959 | - if( this.listBGAPAN.ContainsKey( key ) ) | |
3960 | - { | |
3961 | - this.listBGAPAN.Remove( key ); | |
3962 | - } | |
3963 | - this.listBGAPAN.Add( key, cbgapan ); | |
4381 | + | |
4382 | + if( n値 < 0 ) | |
4383 | + n値 = 0; | |
4384 | + | |
4385 | + bgapan.n移動時間ct = n値; | |
4386 | + i++; | |
4387 | + //----------------- | |
4388 | + #endregion | |
4389 | + | |
4390 | + #region [ BGAPANリストに {zz, bgapan} の組を登録する。] | |
4391 | + //----------------- | |
4392 | + if( this.listBGAPAN.ContainsKey( zz ) ) // 既にリスト中に存在しているなら削除。後のものが有効。 | |
4393 | + this.listBGAPAN.Remove( zz ); | |
4394 | + | |
4395 | + this.listBGAPAN.Add( zz, bgapan ); | |
4396 | + //----------------- | |
4397 | + #endregion | |
4398 | + | |
3964 | 4399 | return true; |
3965 | 4400 | } |
3966 | 4401 | private bool t入力・行解析・BMP( string strコマンド, string strパラメータ, string strコメント ) |
3967 | 4402 | { |
3968 | - if( strコマンド.StartsWith( "BMP", StringComparison.OrdinalIgnoreCase ) ) | |
3969 | - { | |
3970 | - strコマンド = strコマンド.Substring( 3 ); | |
3971 | - } | |
3972 | - else | |
3973 | - { | |
4403 | + // (1) コマンドを処理。 | |
4404 | + | |
4405 | + #region [ "BMP" で始まらないコマンドは無効。] | |
4406 | + //----------------- | |
4407 | + if( !strコマンド.StartsWith( "BMP", StringComparison.OrdinalIgnoreCase ) ) | |
3974 | 4408 | return false; |
3975 | - } | |
3976 | - int key = 0; | |
4409 | + | |
4410 | + strコマンド = strコマンド.Substring( 3 ); // strコマンド から先頭の"BMP"文字を除去。 | |
4411 | + //----------------- | |
4412 | + #endregion | |
4413 | + | |
4414 | + // (2) パラメータを処理。 | |
4415 | + | |
4416 | + int zz = 0; | |
4417 | + | |
4418 | + #region [ BMP番号 zz を取得する。] | |
4419 | + //----------------- | |
3977 | 4420 | if( strコマンド.Length < 2 ) |
3978 | 4421 | { |
3979 | - key = 0; | |
4422 | + #region [ (A) "#BMP:" の場合 → zz = 00 ] | |
4423 | + //----------------- | |
4424 | + zz = 0; | |
4425 | + //----------------- | |
4426 | + #endregion | |
3980 | 4427 | } |
3981 | 4428 | else |
3982 | 4429 | { |
3983 | - key = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
3984 | - if( ( key < 0 ) || ( key >= 36 * 36 ) ) | |
4430 | + #region [ (B) "#BMPzz:" の場合 → zz = 00 ~ ZZ ] | |
4431 | + //----------------- | |
4432 | + zz = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
4433 | + if( zz < 0 || zz >= 36 * 36 ) | |
3985 | 4434 | { |
3986 | - Trace.TraceError( "BMP番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
4435 | + Trace.TraceError( "BMP番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
3987 | 4436 | return false; |
3988 | 4437 | } |
4438 | + //----------------- | |
4439 | + #endregion | |
3989 | 4440 | } |
3990 | - CBMP cbmp = new CBMP(); | |
3991 | - cbmp.n番号 = key; | |
3992 | - cbmp.strファイル名 = strパラメータ; | |
3993 | - cbmp.strコメント文 = strコメント; | |
3994 | - if( this.listBMP.ContainsKey( key ) ) | |
3995 | - { | |
3996 | - this.listBMP.Remove( key ); | |
3997 | - } | |
3998 | - this.listBMP.Add( key, cbmp ); | |
4441 | + //----------------- | |
4442 | + #endregion | |
4443 | + | |
4444 | + | |
4445 | + var bmp = new CBMP() { | |
4446 | + n番号 = zz, | |
4447 | + strファイル名 = strパラメータ, | |
4448 | + strコメント文 = strコメント, | |
4449 | + }; | |
4450 | + | |
4451 | + #region [ BMPリストに {zz, bmp} の組を登録。] | |
4452 | + //----------------- | |
4453 | + if( this.listBMP.ContainsKey( zz ) ) // 既にリスト中に存在しているなら削除。後のものが有効。 | |
4454 | + this.listBMP.Remove( zz ); | |
4455 | + | |
4456 | + this.listBMP.Add( zz, bmp ); | |
4457 | + //----------------- | |
4458 | + #endregion | |
4459 | + | |
3999 | 4460 | return true; |
4000 | 4461 | } |
4001 | 4462 | private bool t入力・行解析・BMPTEX( string strコマンド, string strパラメータ, string strコメント ) |
4002 | 4463 | { |
4003 | - if( strコマンド.StartsWith( "BMPTEX", StringComparison.OrdinalIgnoreCase ) ) | |
4004 | - { | |
4005 | - strコマンド = strコマンド.Substring( 6 ); | |
4006 | - } | |
4007 | - else | |
4008 | - { | |
4464 | + // (1) コマンドを処理。 | |
4465 | + | |
4466 | + #region [ "BMPTEX" で始まらないコマンドは無効。] | |
4467 | + //----------------- | |
4468 | + if( !strコマンド.StartsWith( "BMPTEX", StringComparison.OrdinalIgnoreCase ) ) | |
4009 | 4469 | return false; |
4010 | - } | |
4470 | + | |
4471 | + strコマンド = strコマンド.Substring( 6 ); // strコマンド から先頭の"BMPTEX"文字を除去。 | |
4472 | + //----------------- | |
4473 | + #endregion | |
4474 | + | |
4475 | + // (2) パラメータを処理。 | |
4476 | + | |
4011 | 4477 | if( strコマンド.Length < 2 ) |
4478 | + return false; // BMPTEX番号 zz がないなら無効。 | |
4479 | + | |
4480 | + #region [ BMPTEX番号 zz を取得する。] | |
4481 | + //----------------- | |
4482 | + int zz = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
4483 | + if( zz < 0 || zz >= 36 * 36 ) | |
4012 | 4484 | { |
4485 | + Trace.TraceError( "BMPTEX番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
4013 | 4486 | return false; |
4014 | 4487 | } |
4015 | - int key = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
4016 | - if( ( key < 0 ) || ( key >= 36 * 36 ) ) | |
4017 | - { | |
4018 | - Trace.TraceError( "BMPTEX番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
4019 | - return false; | |
4020 | - } | |
4021 | - CBMPTEX cbmptex = new CBMPTEX(); | |
4022 | - cbmptex.n番号 = key; | |
4023 | - cbmptex.strファイル名 = strパラメータ; | |
4024 | - cbmptex.strコメント文 = strコメント; | |
4025 | - if( this.listBMPTEX.ContainsKey( key ) ) | |
4026 | - { | |
4027 | - this.listBMPTEX.Remove( key ); | |
4028 | - } | |
4029 | - this.listBMPTEX.Add( key, cbmptex ); | |
4488 | + //----------------- | |
4489 | + #endregion | |
4490 | + | |
4491 | + var bmptex = new CBMPTEX() { | |
4492 | + n番号 = zz, | |
4493 | + strファイル名 = strパラメータ, | |
4494 | + strコメント文 = strコメント, | |
4495 | + }; | |
4496 | + | |
4497 | + #region [ BMPTEXリストに {zz, bmptex} の組を登録する。] | |
4498 | + //----------------- | |
4499 | + if( this.listBMPTEX.ContainsKey( zz ) ) // 既にリスト中に存在しているなら削除。後のものが有効。 | |
4500 | + this.listBMPTEX.Remove( zz ); | |
4501 | + | |
4502 | + this.listBMPTEX.Add( zz, bmptex ); | |
4503 | + //----------------- | |
4504 | + #endregion | |
4505 | + | |
4030 | 4506 | return true; |
4031 | 4507 | } |
4032 | 4508 | private bool t入力・行解析・BPM_BPMzz( string strコマンド, string strパラメータ, string strコメント ) |
4033 | 4509 | { |
4034 | - if( strコマンド.StartsWith( "BPM", StringComparison.OrdinalIgnoreCase ) ) | |
4035 | - { | |
4036 | - strコマンド = strコマンド.Substring( 3 ); | |
4037 | - } | |
4038 | - else | |
4039 | - { | |
4510 | + // (1) コマンドを処理。 | |
4511 | + | |
4512 | + #region [ "BPM" で始まらないコマンドは無効。] | |
4513 | + //----------------- | |
4514 | + if( !strコマンド.StartsWith( "BPM", StringComparison.OrdinalIgnoreCase ) ) | |
4040 | 4515 | return false; |
4041 | - } | |
4042 | - int index = 0; | |
4516 | + | |
4517 | + strコマンド = strコマンド.Substring( 3 ); // strコマンド から先頭の"BPM"文字を除去。 | |
4518 | + //----------------- | |
4519 | + #endregion | |
4520 | + | |
4521 | + // (2) パラメータを処理。 | |
4522 | + | |
4523 | + int zz = 0; | |
4524 | + | |
4525 | + #region [ BPM番号 zz を取得する。] | |
4526 | + //----------------- | |
4043 | 4527 | if( strコマンド.Length < 2 ) |
4044 | 4528 | { |
4045 | - index = 0; | |
4529 | + #region [ (A) "#BPM:" の場合 → zz = 00 ] | |
4530 | + //----------------- | |
4531 | + zz = 0; | |
4532 | + //----------------- | |
4533 | + #endregion | |
4046 | 4534 | } |
4047 | 4535 | else |
4048 | 4536 | { |
4049 | - index = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
4050 | - if( ( index < 0 ) || ( index >= 36 * 36 ) ) | |
4537 | + #region [ (B) "#BPMzz:" の場合 → zz = 00 ~ ZZ ] | |
4538 | + //----------------- | |
4539 | + zz = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
4540 | + if( zz < 0 || zz >= 36 * 36 ) | |
4051 | 4541 | { |
4052 | - Trace.TraceError( "BPM番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
4542 | + Trace.TraceError( "BPM番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
4053 | 4543 | return false; |
4054 | 4544 | } |
4545 | + //----------------- | |
4546 | + #endregion | |
4055 | 4547 | } |
4056 | - double result = 0.0; | |
4057 | -// if( !double.TryParse( strパラメータ, out result ) ) | |
4058 | - if ( !TryParse( strパラメータ, out result) ) // #23880 2010.12.30 yyagi: alternative TryParse to permit both '.' and ',' for decimal point | |
4059 | - { | |
4548 | + //----------------- | |
4549 | + #endregion | |
4550 | + | |
4551 | + double dbBPM = 0.0; | |
4552 | + | |
4553 | + #region [ BPM値を取得する。] | |
4554 | + //----------------- | |
4555 | + //if( !double.TryParse( strパラメータ, out result ) ) | |
4556 | + if( !TryParse( strパラメータ, out dbBPM ) ) // #23880 2010.12.30 yyagi: alternative TryParse to permit both '.' and ',' for decimal point | |
4060 | 4557 | return false; |
4061 | - } | |
4062 | - if( result <= 0.0 ) | |
4063 | - { | |
4558 | + | |
4559 | + if( dbBPM <= 0.0 ) | |
4064 | 4560 | return false; |
4065 | - } | |
4066 | - if( index == 0 ) | |
4561 | + //----------------- | |
4562 | + #endregion | |
4563 | + | |
4564 | + if( zz == 0 ) // "#BPM00:" と "#BPM:" は等価。 | |
4565 | + this.BPM = dbBPM; // この曲の代表 BPM に格納する。 | |
4566 | + | |
4567 | + #region [ BPMリストに {内部番号, zz, dbBPM} の組を登録。] | |
4568 | + //----------------- | |
4569 | + this.listBPM.Add( | |
4570 | + this.n内部番号BPM1to, | |
4571 | + new CBPM() { | |
4572 | + n内部番号 = this.n内部番号BPM1to, | |
4573 | + n表記上の番号 = zz, | |
4574 | + dbBPM値 = dbBPM, | |
4575 | + } ); | |
4576 | + //----------------- | |
4577 | + #endregion | |
4578 | + | |
4579 | + #region [ BPM番号が zz であるBPM未設定のBPMチップがあれば、そのサイズを変更する。無限管理に対応。] | |
4580 | + //----------------- | |
4581 | + if( this.n無限管理BPM[ zz ] == -zz ) // 初期状態では n無限管理BPM[zz] = -zz である。この場合、#BPMzz がまだ出現していないことを意味する。 | |
4067 | 4582 | { |
4068 | - this.BPM = result; | |
4069 | - } | |
4070 | - CBPM cbpm = new CBPM(); | |
4071 | - cbpm.n内部番号 = this.n内部番号BPM1to; | |
4072 | - cbpm.n表記上の番号 = index; | |
4073 | - cbpm.dbBPM値 = result; | |
4074 | - this.listBPM.Add( this.n内部番号BPM1to, cbpm ); | |
4075 | - if( this.n無限管理BPM[ index ] == -index ) | |
4076 | - { | |
4077 | - for( int i = 0; i < this.listChip.Count; i++ ) | |
4583 | + for( int i = 0; i < this.listChip.Count; i++ ) // これまでに出てきたチップのうち、該当する(BPM値が未設定の)BPMチップの値を変更する(仕組み上、必ず後方参照となる)。 | |
4078 | 4584 | { |
4079 | - CChip chip = this.listChip[ i ]; | |
4080 | - if( chip.bBPMチップである && ( chip.n整数値・内部番号 == -index ) ) | |
4081 | - { | |
4585 | + var chip = this.listChip[ i ]; | |
4586 | + | |
4587 | + if( chip.bBPMチップである && chip.n整数値・内部番号 == -zz ) // #BPMzz 行より前の行に出現した #BPMzz では、整数値・内部番号は -zz に初期化されている。 | |
4082 | 4588 | chip.n整数値・内部番号 = this.n内部番号BPM1to; |
4083 | - } | |
4084 | 4589 | } |
4085 | 4590 | } |
4086 | - this.n無限管理BPM[ index ] = this.n内部番号BPM1to; | |
4087 | - this.n内部番号BPM1to++; | |
4591 | + this.n無限管理BPM[ zz ] = this.n内部番号BPM1to; // 次にこの BPM番号 zz を使うBPMチップが現れたら、このBPM値が格納されることになる。 | |
4592 | + this.n内部番号BPM1to++; // 内部番号は単純増加連番。 | |
4593 | + //----------------- | |
4594 | + #endregion | |
4595 | + | |
4088 | 4596 | return true; |
4089 | 4597 | } |
4090 | 4598 | private bool t入力・行解析・RESULTIMAGE( string strコマンド, string strパラメータ, string strコメント ) |
4091 | 4599 | { |
4092 | - if( strコマンド.StartsWith( "RESULTIMAGE", StringComparison.OrdinalIgnoreCase ) ) | |
4093 | - { | |
4094 | - strコマンド = strコマンド.Substring( 11 ); | |
4095 | - } | |
4096 | - else | |
4097 | - { | |
4600 | + // (1) コマンドを処理。 | |
4601 | + | |
4602 | + #region [ "RESULTIMAGE" で始まらないコマンドは無効。] | |
4603 | + //----------------- | |
4604 | + if( !strコマンド.StartsWith( "RESULTIMAGE", StringComparison.OrdinalIgnoreCase ) ) | |
4098 | 4605 | return false; |
4099 | - } | |
4606 | + | |
4607 | + strコマンド = strコマンド.Substring( 11 ); // strコマンド から先頭の"RESULTIMAGE"文字を除去。 | |
4608 | + //----------------- | |
4609 | + #endregion | |
4610 | + | |
4611 | + // (2) パラメータを処理。 | |
4612 | + // コマンドには "#RESULTIMAGE:" と "#RESULTIMAGE_SS~E" の2種類があり、パラメータの処理はそれぞれ異なる。 | |
4613 | + | |
4100 | 4614 | if( strコマンド.Length < 2 ) |
4101 | 4615 | { |
4616 | + #region [ (A) ランク指定がない場合("#RESULTIMAGE:") → 優先順位が設定されていないすべてのランクで同じパラメータを使用する。] | |
4617 | + //----------------- | |
4102 | 4618 | for( int i = 0; i < 7; i++ ) |
4103 | 4619 | { |
4104 | 4620 | if( this.nRESULTIMAGE用優先順位[ i ] == 0 ) |
4105 | - { | |
4106 | 4621 | this.RESULTIMAGE[ i ] = strパラメータ.Trim(); |
4107 | - } | |
4108 | 4622 | } |
4623 | + //----------------- | |
4624 | + #endregion | |
4109 | 4625 | } |
4110 | 4626 | else |
4111 | 4627 | { |
4628 | + #region [ (B) ランク指定がある場合("#RESULTIMAGE_SS~E:") → 優先順位に従ってパラメータを記録する。] | |
4629 | + //----------------- | |
4112 | 4630 | switch( strコマンド.ToUpper() ) |
4113 | 4631 | { |
4114 | 4632 | case "_SS": |
@@ -4139,400 +4657,513 @@ | ||
4139 | 4657 | this.t入力・行解析・RESULTIMAGE・ファイルを設定する( 6, strパラメータ ); |
4140 | 4658 | break; |
4141 | 4659 | } |
4660 | + //----------------- | |
4661 | + #endregion | |
4142 | 4662 | } |
4663 | + | |
4143 | 4664 | return true; |
4144 | 4665 | } |
4145 | 4666 | private void t入力・行解析・RESULTIMAGE・ファイルを設定する( int nランク0to6, string strファイル名 ) |
4146 | 4667 | { |
4147 | - if( ( nランク0to6 >= 0 ) && ( nランク0to6 <= 6 ) ) | |
4668 | + if( nランク0to6 < 0 || nランク0to6 > 6 ) // 値域チェック。 | |
4669 | + return; | |
4670 | + | |
4671 | + // 指定されたランクから上位のすべてのランクについて、ファイル名を更新する。 | |
4672 | + | |
4673 | + for( int i = nランク0to6; i >= 0; i-- ) | |
4148 | 4674 | { |
4149 | - for( int i = nランク0to6; i >= 0; i-- ) | |
4675 | + int n優先順位 = 7 - nランク0to6; | |
4676 | + | |
4677 | + // 現状より優先順位の低い RESULTIMAGE[] に限り、ファイル名を更新できる。 | |
4678 | + //(例:#RESULTMOVIE_D が #RESULTIMAGE_A より後に出現しても、#RESULTIMAGE_A で指定されたファイル名を上書きすることはできない。しかしその逆は可能。) | |
4679 | + | |
4680 | + if( this.nRESULTIMAGE用優先順位[ i ] < n優先順位 ) | |
4150 | 4681 | { |
4151 | - if( this.nRESULTIMAGE用優先順位[ i ] < ( 7 - nランク0to6 ) ) | |
4152 | - { | |
4153 | - this.nRESULTIMAGE用優先順位[ i ] = 7 - nランク0to6; | |
4154 | - this.RESULTIMAGE[ i ] = strファイル名; | |
4155 | - } | |
4682 | + this.nRESULTIMAGE用優先順位[ i ] = n優先順位; | |
4683 | + this.RESULTIMAGE[ i ] = strファイル名; | |
4156 | 4684 | } |
4157 | 4685 | } |
4158 | 4686 | } |
4159 | 4687 | private bool t入力・行解析・RESULTMOVIE( string strコマンド, string strパラメータ, string strコメント ) |
4160 | 4688 | { |
4161 | - if( strコマンド.StartsWith( "RESULTMOVIE", StringComparison.OrdinalIgnoreCase ) ) | |
4162 | - { | |
4163 | - strコマンド = strコマンド.Substring( 11 ); | |
4164 | - } | |
4165 | - else | |
4166 | - { | |
4689 | + // (1) コマンドを処理。 | |
4690 | + | |
4691 | + #region [ "RESULTMOVIE" で始まらないコマンドは無効。] | |
4692 | + //----------------- | |
4693 | + if( !strコマンド.StartsWith( "RESULTMOVIE", StringComparison.OrdinalIgnoreCase ) ) | |
4167 | 4694 | return false; |
4168 | - } | |
4695 | + | |
4696 | + strコマンド = strコマンド.Substring( 11 ); // strコマンド から先頭の"RESULTMOVIE"文字を除去。 | |
4697 | + //----------------- | |
4698 | + #endregion | |
4699 | + | |
4700 | + // (2) パラメータを処理。 | |
4701 | + // コマンドには "#RESULTMOVIE:" と "#RESULTMOVIE_SS~E" の2種類があり、パラメータの処理はそれぞれ異なる。 | |
4702 | + | |
4169 | 4703 | if( strコマンド.Length < 2 ) |
4170 | 4704 | { |
4705 | + #region [ (A) ランク指定がない場合("#RESULTMOVIE:") → 優先順位が設定されていないすべてのランクで同じパラメータを使用する。] | |
4706 | + //----------------- | |
4171 | 4707 | for( int i = 0; i < 7; i++ ) |
4172 | 4708 | { |
4173 | 4709 | if( this.nRESULTMOVIE用優先順位[ i ] == 0 ) |
4174 | - { | |
4175 | 4710 | this.RESULTMOVIE[ i ] = strパラメータ.Trim(); |
4176 | - } | |
4177 | 4711 | } |
4712 | + //----------------- | |
4713 | + #endregion | |
4178 | 4714 | } |
4179 | 4715 | else |
4180 | 4716 | { |
4717 | + #region [ (B) ランク指定がある場合("#RESULTMOVIE_SS~E:") → 優先順位に従ってパラメータを記録する。] | |
4718 | + //----------------- | |
4181 | 4719 | switch( strコマンド.ToUpper() ) |
4182 | 4720 | { |
4183 | 4721 | case "_SS": |
4184 | 4722 | this.t入力・行解析・RESULTMOVIE・ファイルを設定する( 0, strパラメータ ); |
4185 | - goto Label_0142; | |
4723 | + break; | |
4186 | 4724 | |
4187 | 4725 | case "_S": |
4188 | 4726 | this.t入力・行解析・RESULTMOVIE・ファイルを設定する( 1, strパラメータ ); |
4189 | - goto Label_0142; | |
4727 | + break; | |
4190 | 4728 | |
4191 | 4729 | case "_A": |
4192 | 4730 | this.t入力・行解析・RESULTMOVIE・ファイルを設定する( 2, strパラメータ ); |
4193 | - goto Label_0142; | |
4731 | + break; | |
4194 | 4732 | |
4195 | 4733 | case "_B": |
4196 | 4734 | this.t入力・行解析・RESULTMOVIE・ファイルを設定する( 3, strパラメータ ); |
4197 | - goto Label_0142; | |
4735 | + break; | |
4198 | 4736 | |
4199 | 4737 | case "_C": |
4200 | 4738 | this.t入力・行解析・RESULTMOVIE・ファイルを設定する( 4, strパラメータ ); |
4201 | - goto Label_0142; | |
4739 | + break; | |
4202 | 4740 | |
4203 | 4741 | case "_D": |
4204 | 4742 | this.t入力・行解析・RESULTMOVIE・ファイルを設定する( 5, strパラメータ ); |
4205 | - goto Label_0142; | |
4743 | + break; | |
4206 | 4744 | |
4207 | 4745 | case "_E": |
4208 | 4746 | this.t入力・行解析・RESULTMOVIE・ファイルを設定する( 6, strパラメータ ); |
4209 | - goto Label_0142; | |
4747 | + break; | |
4210 | 4748 | } |
4749 | + //----------------- | |
4750 | + #endregion | |
4211 | 4751 | } |
4212 | - Label_0142: | |
4752 | + | |
4213 | 4753 | return true; |
4214 | 4754 | } |
4215 | 4755 | private void t入力・行解析・RESULTMOVIE・ファイルを設定する( int nランク0to6, string strファイル名 ) |
4216 | 4756 | { |
4217 | - if( ( nランク0to6 >= 0 ) && ( nランク0to6 <= 6 ) ) | |
4757 | + if( nランク0to6 < 0 || nランク0to6 > 6 ) // 値域チェック。 | |
4758 | + return; | |
4759 | + | |
4760 | + // 指定されたランクから上位のすべてのランクについて、ファイル名を更新する。 | |
4761 | + | |
4762 | + for( int i = nランク0to6; i >= 0; i-- ) | |
4218 | 4763 | { |
4219 | - for( int i = nランク0to6; i >= 0; i-- ) | |
4764 | + int n優先順位 = 7 - nランク0to6; | |
4765 | + | |
4766 | + // 現状より優先順位の低い RESULTMOVIE[] に限り、ファイル名を更新できる。 | |
4767 | + //(例:#RESULTMOVIE_D が #RESULTMOVIE_A より後に出現しても、#RESULTMOVIE_A で指定されたファイル名を上書きすることはできない。しかしその逆は可能。) | |
4768 | + | |
4769 | + if( this.nRESULTMOVIE用優先順位[ i ] < n優先順位 ) | |
4220 | 4770 | { |
4221 | - if( this.nRESULTMOVIE用優先順位[ i ] < ( 7 - nランク0to6 ) ) | |
4222 | - { | |
4223 | - this.nRESULTMOVIE用優先順位[ i ] = 7 - nランク0to6; | |
4224 | - this.RESULTMOVIE[ i ] = strファイル名; | |
4225 | - } | |
4771 | + this.nRESULTMOVIE用優先順位[ i ] = n優先順位; | |
4772 | + this.RESULTMOVIE[ i ] = strファイル名; | |
4226 | 4773 | } |
4227 | 4774 | } |
4228 | 4775 | } |
4229 | 4776 | private bool t入力・行解析・RESULTSOUND( string strコマンド, string strパラメータ, string strコメント ) |
4230 | 4777 | { |
4231 | - if( strコマンド.StartsWith( "RESULTSOUND", StringComparison.OrdinalIgnoreCase ) ) | |
4232 | - { | |
4233 | - strコマンド = strコマンド.Substring( 11 ); | |
4234 | - } | |
4235 | - else | |
4236 | - { | |
4778 | + // (1) コマンドを処理。 | |
4779 | + | |
4780 | + #region [ "RESULTSOUND" で始まらないコマンドは無効。] | |
4781 | + //----------------- | |
4782 | + if( !strコマンド.StartsWith( "RESULTSOUND", StringComparison.OrdinalIgnoreCase ) ) | |
4237 | 4783 | return false; |
4238 | - } | |
4784 | + | |
4785 | + strコマンド = strコマンド.Substring( 11 ); // strコマンド から先頭の"RESULTSOUND"文字を除去。 | |
4786 | + //----------------- | |
4787 | + #endregion | |
4788 | + | |
4789 | + // (2) パラメータを処理。 | |
4790 | + // コマンドには "#RESULTSOUND:" と "#RESULTSOUND_SS~E" の2種類があり、パラメータの処理はそれぞれ異なる。 | |
4791 | + | |
4239 | 4792 | if( strコマンド.Length < 2 ) |
4240 | 4793 | { |
4794 | + #region [ (A) ランク指定がない場合("#RESULTSOUND:") → 優先順位が設定されていないすべてのランクで同じパラメータを使用する。] | |
4795 | + //----------------- | |
4241 | 4796 | for( int i = 0; i < 7; i++ ) |
4242 | 4797 | { |
4243 | 4798 | if( this.nRESULTSOUND用優先順位[ i ] == 0 ) |
4244 | - { | |
4245 | 4799 | this.RESULTSOUND[ i ] = strパラメータ.Trim(); |
4246 | - } | |
4247 | 4800 | } |
4801 | + //----------------- | |
4802 | + #endregion | |
4248 | 4803 | } |
4249 | 4804 | else |
4250 | 4805 | { |
4806 | + #region [ (B) ランク指定がある場合("#RESULTSOUND_SS~E:") → 優先順位に従ってパラメータを記録する。] | |
4807 | + //----------------- | |
4251 | 4808 | switch( strコマンド.ToUpper() ) |
4252 | 4809 | { |
4253 | 4810 | case "_SS": |
4254 | 4811 | this.t入力・行解析・RESULTSOUND・ファイルを設定する( 0, strパラメータ ); |
4255 | - goto Label_0142; | |
4812 | + break; | |
4256 | 4813 | |
4257 | 4814 | case "_S": |
4258 | 4815 | this.t入力・行解析・RESULTSOUND・ファイルを設定する( 1, strパラメータ ); |
4259 | - goto Label_0142; | |
4816 | + break; | |
4260 | 4817 | |
4261 | 4818 | case "_A": |
4262 | 4819 | this.t入力・行解析・RESULTSOUND・ファイルを設定する( 2, strパラメータ ); |
4263 | - goto Label_0142; | |
4820 | + break; | |
4264 | 4821 | |
4265 | 4822 | case "_B": |
4266 | 4823 | this.t入力・行解析・RESULTSOUND・ファイルを設定する( 3, strパラメータ ); |
4267 | - goto Label_0142; | |
4824 | + break; | |
4268 | 4825 | |
4269 | 4826 | case "_C": |
4270 | 4827 | this.t入力・行解析・RESULTSOUND・ファイルを設定する( 4, strパラメータ ); |
4271 | - goto Label_0142; | |
4828 | + break; | |
4272 | 4829 | |
4273 | 4830 | case "_D": |
4274 | 4831 | this.t入力・行解析・RESULTSOUND・ファイルを設定する( 5, strパラメータ ); |
4275 | - goto Label_0142; | |
4832 | + break; | |
4276 | 4833 | |
4277 | 4834 | case "_E": |
4278 | 4835 | this.t入力・行解析・RESULTSOUND・ファイルを設定する( 6, strパラメータ ); |
4279 | - goto Label_0142; | |
4836 | + break; | |
4280 | 4837 | } |
4838 | + //----------------- | |
4839 | + #endregion | |
4281 | 4840 | } |
4282 | - Label_0142: | |
4841 | + | |
4283 | 4842 | return true; |
4284 | 4843 | } |
4285 | 4844 | private void t入力・行解析・RESULTSOUND・ファイルを設定する( int nランク0to6, string strファイル名 ) |
4286 | 4845 | { |
4287 | - if( ( nランク0to6 >= 0 ) && ( nランク0to6 <= 6 ) ) | |
4846 | + if( nランク0to6 < 0 || nランク0to6 > 6 ) // 値域チェック。 | |
4847 | + return; | |
4848 | + | |
4849 | + // 指定されたランクから上位のすべてのランクについて、ファイル名を更新する。 | |
4850 | + | |
4851 | + for( int i = nランク0to6; i >= 0; i-- ) | |
4288 | 4852 | { |
4289 | - for( int i = nランク0to6; i >= 0; i-- ) | |
4853 | + int n優先順位 = 7 - nランク0to6; | |
4854 | + | |
4855 | + // 現状より優先順位の低い RESULTSOUND[] に限り、ファイル名を更新できる。 | |
4856 | + //(例:#RESULTSOUND_D が #RESULTSOUND_A より後に出現しても、#RESULTSOUND_A で指定されたファイル名を上書きすることはできない。しかしその逆は可能。) | |
4857 | + | |
4858 | + if( this.nRESULTSOUND用優先順位[ i ] < n優先順位 ) | |
4290 | 4859 | { |
4291 | - if( this.nRESULTSOUND用優先順位[ i ] < ( 7 - nランク0to6 ) ) | |
4292 | - { | |
4293 | - this.nRESULTSOUND用優先順位[ i ] = 7 - nランク0to6; | |
4294 | - this.RESULTSOUND[ i ] = strファイル名; | |
4295 | - } | |
4860 | + this.nRESULTSOUND用優先順位[ i ] = n優先順位; | |
4861 | + this.RESULTSOUND[ i ] = strファイル名; | |
4296 | 4862 | } |
4297 | 4863 | } |
4298 | 4864 | } |
4299 | 4865 | private bool t入力・行解析・SIZE( string strコマンド, string strパラメータ, string strコメント ) |
4300 | 4866 | { |
4301 | - int num2; | |
4302 | - if( strコマンド.StartsWith( "SIZE", StringComparison.OrdinalIgnoreCase ) ) | |
4303 | - { | |
4304 | - strコマンド = strコマンド.Substring( 4 ); | |
4305 | - } | |
4306 | - else | |
4307 | - { | |
4867 | + // (1) コマンドを処理。 | |
4868 | + | |
4869 | + #region [ "SIZE" で始まらないコマンドや、その後ろに2文字(番号)が付随してないコマンドは無効。] | |
4870 | + //----------------- | |
4871 | + if( !strコマンド.StartsWith( "SIZE", StringComparison.OrdinalIgnoreCase ) ) | |
4308 | 4872 | return false; |
4309 | - } | |
4310 | - if( strコマンド.Length < 2 ) | |
4311 | - { | |
4873 | + | |
4874 | + strコマンド = strコマンド.Substring( 4 ); // strコマンド から先頭の"SIZE"文字を除去。 | |
4875 | + | |
4876 | + if( strコマンド.Length < 2 ) // サイズ番号の指定がない場合は無効。 | |
4312 | 4877 | return false; |
4313 | - } | |
4314 | - int index = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
4315 | - if( ( index < 0 ) || ( index >= 36 * 36 ) ) | |
4878 | + //----------------- | |
4879 | + #endregion | |
4880 | + | |
4881 | + #region [ nWAV番号(36進数2桁)を取得。] | |
4882 | + //----------------- | |
4883 | + int nWAV番号 = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
4884 | + | |
4885 | + if( nWAV番号 < 0 || nWAV番号 >= 36 * 36 ) | |
4316 | 4886 | { |
4317 | - Trace.TraceError( "SIZE番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
4887 | + Trace.TraceError( "SIZEのWAV番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
4318 | 4888 | return false; |
4319 | 4889 | } |
4320 | - if( int.TryParse( strパラメータ, out num2 ) ) | |
4890 | + //----------------- | |
4891 | + #endregion | |
4892 | + | |
4893 | + | |
4894 | + // (2) パラメータを処理。 | |
4895 | + | |
4896 | + #region [ nサイズ値 を取得する。値は 0~100 に収める。] | |
4897 | + //----------------- | |
4898 | + int nサイズ値; | |
4899 | + | |
4900 | + if( !int.TryParse( strパラメータ, out nサイズ値 ) ) | |
4901 | + return true; // int変換に失敗しても、この行自体の処理は終えたのでtrueを返す。 | |
4902 | + | |
4903 | + nサイズ値 = Math.Min( Math.Max( nサイズ値, 0 ), 100 ); // 0未満は0、100超えは100に強制変換。 | |
4904 | + //----------------- | |
4905 | + #endregion | |
4906 | + | |
4907 | + #region [ nWAV番号で示されるサイズ未設定のWAVチップがあれば、そのサイズを変更する。無限管理に対応。] | |
4908 | + //----------------- | |
4909 | + if( this.n無限管理SIZE[ nWAV番号 ] == -nWAV番号 ) // 初期状態では n無限管理SIZE[xx] = -xx である。この場合、#SIZExx がまだ出現していないことを意味する。 | |
4321 | 4910 | { |
4322 | - if( num2 < 0 ) | |
4911 | + foreach( CWAV wav in this.listWAV.Values ) // これまでに出てきたWAVチップのうち、該当する(サイズが未設定の)チップのサイズを変更する(仕組み上、必ず後方参照となる)。 | |
4323 | 4912 | { |
4324 | - num2 = 0; | |
4913 | + if( wav.nチップサイズ == -nWAV番号 ) // #SIZExx 行より前の行に出現した #WAVxx では、チップサイズは -xx に初期化されている。 | |
4914 | + wav.nチップサイズ = nサイズ値; | |
4325 | 4915 | } |
4326 | - else if( num2 > 100 ) | |
4327 | - { | |
4328 | - num2 = 100; | |
4329 | - } | |
4330 | - if( this.n無限管理SIZE[ index ] == -index ) | |
4331 | - { | |
4332 | - foreach( CWAV cwav in this.listWAV.Values ) | |
4333 | - { | |
4334 | - if( cwav.nチップサイズ == -index ) | |
4335 | - { | |
4336 | - cwav.nチップサイズ = num2; | |
4337 | - } | |
4338 | - } | |
4339 | - } | |
4340 | - this.n無限管理SIZE[ index ] = num2; | |
4341 | 4916 | } |
4917 | + this.n無限管理SIZE[ nWAV番号 ] = nサイズ値; // 次にこの nWAV番号を使うWAVチップが現れたら、負数の代わりに、このサイズ値が格納されることになる。 | |
4918 | + //----------------- | |
4919 | + #endregion | |
4920 | + | |
4342 | 4921 | return true; |
4343 | 4922 | } |
4344 | 4923 | private bool t入力・行解析・WAV( string strコマンド, string strパラメータ, string strコメント ) |
4345 | 4924 | { |
4346 | - if( strコマンド.StartsWith( "WAV", StringComparison.OrdinalIgnoreCase ) ) | |
4347 | - { | |
4348 | - strコマンド = strコマンド.Substring( 3 ); | |
4349 | - } | |
4350 | - else | |
4351 | - { | |
4925 | + // (1) コマンドを処理。 | |
4926 | + | |
4927 | + #region [ "WAV" で始まらないコマンドは無効。] | |
4928 | + //----------------- | |
4929 | + if( !strコマンド.StartsWith( "WAV", StringComparison.OrdinalIgnoreCase ) ) | |
4352 | 4930 | return false; |
4353 | - } | |
4931 | + | |
4932 | + strコマンド = strコマンド.Substring( 3 ); // strコマンド から先頭の"WAV"文字を除去。 | |
4933 | + //----------------- | |
4934 | + #endregion | |
4935 | + | |
4936 | + // (2) パラメータを処理。 | |
4937 | + | |
4354 | 4938 | if( strコマンド.Length < 2 ) |
4939 | + return false; // WAV番号 zz がないなら無効。 | |
4940 | + | |
4941 | + #region [ WAV番号 zz を取得する。] | |
4942 | + //----------------- | |
4943 | + int zz = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
4944 | + if( zz < 0 || zz >= 36 * 36 ) | |
4355 | 4945 | { |
4946 | + Trace.TraceError( "WAV番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
4356 | 4947 | return false; |
4357 | 4948 | } |
4358 | - int index = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
4359 | - if( ( index < 0 ) || ( index >= 36 * 36 ) ) | |
4949 | + //----------------- | |
4950 | + #endregion | |
4951 | + | |
4952 | + var wav = new CWAV() { | |
4953 | + n内部番号 = this.n内部番号WAV1to, | |
4954 | + n表記上の番号 = zz, | |
4955 | + nチップサイズ = this.n無限管理SIZE[ zz ], | |
4956 | + n位置 = this.n無限管理PAN[ zz ], | |
4957 | + n音量 = this.n無限管理VOL[ zz ], | |
4958 | + strファイル名 = strパラメータ, | |
4959 | + strコメント文 = strコメント, | |
4960 | + }; | |
4961 | + | |
4962 | + #region [ WAVリストに {内部番号, wav} の組を登録。] | |
4963 | + //----------------- | |
4964 | + this.listWAV.Add( this.n内部番号WAV1to, wav ); | |
4965 | + //----------------- | |
4966 | + #endregion | |
4967 | + | |
4968 | + #region [ WAV番号が zz である内部番号未設定のWAVチップがあれば、その内部番号を変更する。無限管理対応。] | |
4969 | + //----------------- | |
4970 | + if( this.n無限管理WAV[ zz ] == -zz ) // 初期状態では n無限管理WAV[zz] = -zz である。この場合、#WAVzz がまだ出現していないことを意味する。 | |
4360 | 4971 | { |
4361 | - Trace.TraceError( "WAV番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
4362 | - return false; | |
4363 | - } | |
4364 | - CWAV cwav = new CWAV(); | |
4365 | - cwav.n内部番号 = this.n内部番号WAV1to; | |
4366 | - cwav.n表記上の番号 = index; | |
4367 | - cwav.nチップサイズ = this.n無限管理SIZE[ index ]; | |
4368 | - cwav.n位置 = this.n無限管理PAN[ index ]; | |
4369 | - cwav.n音量 = this.n無限管理VOL[ index ]; | |
4370 | - cwav.strファイル名 = strパラメータ; | |
4371 | - cwav.strコメント文 = strコメント; | |
4372 | - this.listWAV.Add( this.n内部番号WAV1to, cwav ); | |
4373 | - if( this.n無限管理WAV[ index ] == -index ) | |
4374 | - { | |
4375 | - for( int i = 0; i < this.listChip.Count; i++ ) | |
4972 | + for( int i = 0; i < this.listChip.Count; i++ ) // これまでに出てきたチップのうち、該当する(内部番号が未設定の)WAVチップの値を変更する(仕組み上、必ず後方参照となる)。 | |
4376 | 4973 | { |
4377 | - CChip chip = this.listChip[ i ]; | |
4378 | - if( chip.bWAVを使うチャンネルである && ( chip.n整数値・内部番号 == -index ) ) | |
4379 | - { | |
4974 | + var chip = this.listChip[ i ]; | |
4975 | + | |
4976 | + if( chip.bWAVを使うチャンネルである && ( chip.n整数値・内部番号 == -zz ) ) // この #WAVzz 行より前の行に出現した #WAVzz では、整数値・内部番号は -zz に初期化されている。 | |
4380 | 4977 | chip.n整数値・内部番号 = this.n内部番号WAV1to; |
4381 | - } | |
4382 | 4978 | } |
4383 | 4979 | } |
4384 | - this.n無限管理WAV[ index ] = this.n内部番号WAV1to; | |
4385 | - this.n内部番号WAV1to++; | |
4980 | + this.n無限管理WAV[ zz ] = this.n内部番号WAV1to; // 次にこの WAV番号 zz を使うWAVチップが現れたら、この内部番号が格納されることになる。 | |
4981 | + this.n内部番号WAV1to++; // 内部番号は単純増加連番。 | |
4982 | + //----------------- | |
4983 | + #endregion | |
4984 | + | |
4386 | 4985 | return true; |
4387 | 4986 | } |
4388 | 4987 | private bool t入力・行解析・WAVPAN_PAN( string strコマンド, string strパラメータ, string strコメント ) |
4389 | 4988 | { |
4390 | - int num2; | |
4989 | + // (1) コマンドを処理。 | |
4990 | + | |
4991 | + #region [ "WAVPAN" or "PAN" で始まらないコマンドは無効。] | |
4992 | + //----------------- | |
4391 | 4993 | if( strコマンド.StartsWith( "WAVPAN", StringComparison.OrdinalIgnoreCase ) ) |
4392 | - { | |
4393 | - strコマンド = strコマンド.Substring(6); | |
4394 | - } | |
4994 | + strコマンド = strコマンド.Substring( 6 ); // strコマンド から先頭の"WAVPAN"文字を除去。 | |
4995 | + | |
4395 | 4996 | else if( strコマンド.StartsWith( "PAN", StringComparison.OrdinalIgnoreCase ) ) |
4396 | - { | |
4397 | - strコマンド = strコマンド.Substring(3); | |
4398 | - } | |
4997 | + strコマンド = strコマンド.Substring( 3 ); // strコマンド から先頭の"PAN"文字を除去。 | |
4998 | + | |
4399 | 4999 | else |
4400 | - { | |
4401 | 5000 | return false; |
4402 | - } | |
5001 | + //----------------- | |
5002 | + #endregion | |
5003 | + | |
5004 | + // (2) パラメータを処理。 | |
5005 | + | |
4403 | 5006 | if( strコマンド.Length < 2 ) |
5007 | + return false; // WAV番号 zz がないなら無効。 | |
5008 | + | |
5009 | + #region [ WAV番号 zz を取得する。] | |
5010 | + //----------------- | |
5011 | + int zz = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
5012 | + if( zz < 0 || zz >= 36 * 36 ) | |
4404 | 5013 | { |
5014 | + Trace.TraceError( "WAVPAN(PAN)のWAV番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
4405 | 5015 | return false; |
4406 | 5016 | } |
4407 | - int index = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
4408 | - if( ( index < 0 ) || ( index >= 36 * 36 ) ) | |
5017 | + //----------------- | |
5018 | + #endregion | |
5019 | + | |
5020 | + #region [ WAV番号 zz を持つWAVチップの位置を変更する。無限定義対応。] | |
5021 | + //----------------- | |
5022 | + int n位置; | |
5023 | + if( int.TryParse( strパラメータ, out n位置 ) ) | |
4409 | 5024 | { |
4410 | - Trace.TraceError( "WAV番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
4411 | - return false; | |
4412 | - } | |
4413 | - if( int.TryParse( strパラメータ, out num2 ) ) | |
4414 | - { | |
4415 | - if( num2 < -100 ) | |
5025 | + n位置 = Math.Min( Math.Max( n位置, -100 ), 100 ); // -100~+100 に丸める | |
5026 | + | |
5027 | + if( this.n無限管理PAN[ zz ] == ( -10000 - zz ) ) // 初期状態では n無限管理PAN[zz] = -10000 - zz である。この場合、#WAVPANzz, #PANzz がまだ出現していないことを意味する。 | |
4416 | 5028 | { |
4417 | - num2 = -100; | |
4418 | - } | |
4419 | - else if( num2 >= 100 ) | |
4420 | - { | |
4421 | - num2 = 100; | |
4422 | - } | |
4423 | - if( this.n無限管理PAN[ index ] == ( -10000 - index ) ) | |
4424 | - { | |
4425 | - foreach( CWAV cwav in this.listWAV.Values ) | |
5029 | + foreach( CWAV wav in this.listWAV.Values ) // これまでに出てきたチップのうち、該当する(位置が未設定の)WAVチップの値を変更する(仕組み上、必ず後方参照となる)。 | |
4426 | 5030 | { |
4427 | - if( cwav.n位置 == ( -10000 - index ) ) | |
4428 | - { | |
4429 | - cwav.n位置 = num2; | |
4430 | - } | |
5031 | + if( wav.n位置 == ( -10000 - zz ) ) // #WAVPANzz, #PANzz 行より前の行に出現した #WAVzz では、位置は -10000-zz に初期化されている。 | |
5032 | + wav.n位置 = n位置; | |
4431 | 5033 | } |
4432 | 5034 | } |
4433 | - this.n無限管理PAN[ index ] = num2; | |
5035 | + this.n無限管理PAN[ zz ] = n位置; // 次にこの WAV番号 zz を使うWAVチップが現れたら、この位置が格納されることになる。 | |
4434 | 5036 | } |
5037 | + //----------------- | |
5038 | + #endregion | |
5039 | + | |
4435 | 5040 | return true; |
4436 | 5041 | } |
4437 | 5042 | private bool t入力・行解析・WAVVOL_VOLUME( string strコマンド, string strパラメータ, string strコメント ) |
4438 | 5043 | { |
4439 | - int num2; | |
5044 | + // (1) コマンドを処理。 | |
5045 | + | |
5046 | + #region [ "WAVCOL" or "VOLUME" で始まらないコマンドは無効。] | |
5047 | + //----------------- | |
4440 | 5048 | if( strコマンド.StartsWith( "WAVVOL", StringComparison.OrdinalIgnoreCase ) ) |
4441 | - { | |
4442 | - strコマンド = strコマンド.Substring( 6 ); | |
4443 | - } | |
5049 | + strコマンド = strコマンド.Substring( 6 ); // strコマンド から先頭の"WAVVOL"文字を除去。 | |
5050 | + | |
4444 | 5051 | else if( strコマンド.StartsWith( "VOLUME", StringComparison.OrdinalIgnoreCase ) ) |
4445 | - { | |
4446 | - strコマンド = strコマンド.Substring( 6 ); | |
4447 | - } | |
5052 | + strコマンド = strコマンド.Substring( 6 ); // strコマンド から先頭の"VOLUME"文字を除去。 | |
5053 | + | |
4448 | 5054 | else |
4449 | - { | |
4450 | 5055 | return false; |
4451 | - } | |
5056 | + //----------------- | |
5057 | + #endregion | |
5058 | + | |
5059 | + // (2) パラメータを処理。 | |
5060 | + | |
4452 | 5061 | if( strコマンド.Length < 2 ) |
5062 | + return false; // WAV番号 zz がないなら無効。 | |
5063 | + | |
5064 | + #region [ WAV番号 zz を取得する。] | |
5065 | + //----------------- | |
5066 | + int zz = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
5067 | + if( zz < 0 || zz >= 36 * 36 ) | |
4453 | 5068 | { |
5069 | + Trace.TraceError( "WAV番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
4454 | 5070 | return false; |
4455 | 5071 | } |
4456 | - int index = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) ); | |
4457 | - if( ( index < 0 ) || ( index >= 36 * 36 ) ) | |
5072 | + //----------------- | |
5073 | + #endregion | |
5074 | + | |
5075 | + #region [ WAV番号 zz を持つWAVチップの音量を変更する。無限定義対応。] | |
5076 | + //----------------- | |
5077 | + int n音量; | |
5078 | + if( int.TryParse( strパラメータ, out n音量 ) ) | |
4458 | 5079 | { |
4459 | - Trace.TraceError( "WAV番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
4460 | - return false; | |
4461 | - } | |
4462 | - if( int.TryParse( strパラメータ, out num2 ) ) | |
4463 | - { | |
4464 | - if( num2 < 0 ) | |
5080 | + n音量 = Math.Min( Math.Max( n音量, 0 ), 100 ); // 0~100に丸める。 | |
5081 | + | |
5082 | + if( this.n無限管理VOL[ zz ] == -zz ) // 初期状態では n無限管理VOL[zz] = - zz である。この場合、#WAVVOLzz, #VOLUMEzz がまだ出現していないことを意味する。 | |
4465 | 5083 | { |
4466 | - num2 = 0; | |
4467 | - } | |
4468 | - else if( num2 >= 100 ) | |
4469 | - { | |
4470 | - num2 = 100; | |
4471 | - } | |
4472 | - if( this.n無限管理VOL[ index ] == -index ) | |
4473 | - { | |
4474 | - foreach( CWAV cwav in this.listWAV.Values ) | |
5084 | + foreach( CWAV wav in this.listWAV.Values ) // これまでに出てきたチップのうち、該当する(音量が未設定の)WAVチップの値を変更する(仕組み上、必ず後方参照となる)。 | |
4475 | 5085 | { |
4476 | - if( cwav.n音量 == -index ) | |
4477 | - { | |
4478 | - cwav.n音量 = num2; | |
4479 | - } | |
5086 | + if( wav.n音量 == -zz ) // #WAVVOLzz, #VOLUMEzz 行より前の行に出現した #WAVzz では、音量は -zz に初期化されている。 | |
5087 | + wav.n音量 = n音量; | |
4480 | 5088 | } |
4481 | 5089 | } |
4482 | - this.n無限管理VOL[ index ] = num2; | |
5090 | + this.n無限管理VOL[ zz ] = n音量; // 次にこの WAV番号 zz を使うWAVチップが現れたら、この音量が格納されることになる。 | |
4483 | 5091 | } |
5092 | + //----------------- | |
5093 | + #endregion | |
5094 | + | |
4484 | 5095 | return true; |
4485 | 5096 | } |
4486 | 5097 | private bool t入力・行解析・チップ配置( string strコマンド, string strパラメータ, string strコメント ) |
4487 | 5098 | { |
4488 | - if( strコマンド.Length != 5 ) | |
4489 | - { | |
5099 | + // (1) コマンドを処理。 | |
5100 | + | |
5101 | + if( strコマンド.Length != 5 ) // コマンドは必ず5文字であること。 | |
4490 | 5102 | return false; |
4491 | - } | |
4492 | - int num = C変換.n小節番号の文字列3桁を数値に変換して返す( strコマンド.Substring( 0, 3 ) ); | |
4493 | - if( num < 0 ) | |
4494 | - { | |
5103 | + | |
5104 | + #region [ n小節番号 を取得する。] | |
5105 | + //----------------- | |
5106 | + int n小節番号 = C変換.n小節番号の文字列3桁を数値に変換して返す( strコマンド.Substring( 0, 3 ) ); | |
5107 | + if( n小節番号 < 0 ) | |
4495 | 5108 | return false; |
4496 | - } | |
4497 | - num++; | |
4498 | - int c = -1; | |
4499 | - if( ( this.e種別 != E種別.GDA ) && ( this.e種別 != E種別.G2D ) ) | |
5109 | + | |
5110 | + n小節番号++; // 先頭に空の1小節を設ける。 | |
5111 | + //----------------- | |
5112 | + #endregion | |
5113 | + | |
5114 | + #region [ nチャンネル番号 を取得する。] | |
5115 | + //----------------- | |
5116 | + int nチャンネル番号 = -1; | |
5117 | + | |
5118 | + // ファイルフォーマットによって処理が異なる。 | |
5119 | + | |
5120 | + if( this.e種別 == E種別.GDA || this.e種別 == E種別.G2D ) | |
4500 | 5121 | { |
4501 | - c = C変換.n16進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 3, 2 ) ); | |
4502 | - if( c < 0 ) | |
5122 | + #region [ (A) GDA, G2D の場合:チャンネル文字列をDTXのチャンネル番号へ置き換える。] | |
5123 | + //----------------- | |
5124 | + string strチャンネル文字列 = strコマンド.Substring( 3, 2 ); | |
5125 | + | |
5126 | + foreach( STGDAPARAM param in this.stGDAParam ) | |
4503 | 5127 | { |
4504 | - return false; | |
5128 | + if( strチャンネル文字列.Equals( param.strGDAのチャンネル文字列, StringComparison.OrdinalIgnoreCase ) ) | |
5129 | + { | |
5130 | + nチャンネル番号 = param.nDTXのチャンネル番号; | |
5131 | + break; // 置き換え成功 | |
5132 | + } | |
4505 | 5133 | } |
5134 | + if( nチャンネル番号 < 0 ) | |
5135 | + return false; // 置き換え失敗 | |
5136 | + //----------------- | |
5137 | + #endregion | |
4506 | 5138 | } |
4507 | 5139 | else |
4508 | 5140 | { |
4509 | - string str = strコマンド.Substring( 3, 2 ); | |
4510 | - foreach( STGDAPARAM stgdaparam in this.stGDAParam ) | |
4511 | - { | |
4512 | - if( str.Equals( stgdaparam.s, StringComparison.OrdinalIgnoreCase ) ) | |
4513 | - { | |
4514 | - c = stgdaparam.c; | |
4515 | - break; | |
4516 | - } | |
4517 | - } | |
4518 | - if( c < 0 ) | |
4519 | - { | |
5141 | + #region [ (B) その他の場合:チャンネル番号は16進数2桁。] | |
5142 | + //----------------- | |
5143 | + nチャンネル番号 = C変換.n16進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 3, 2 ) ); | |
5144 | + | |
5145 | + if( nチャンネル番号 < 0 ) | |
4520 | 5146 | return false; |
4521 | - } | |
5147 | + //----------------- | |
5148 | + #endregion | |
4522 | 5149 | } |
4523 | - if( ( c >= 0x11 ) && ( c <= 0x1a ) ) | |
5150 | + //----------------- | |
5151 | + #endregion | |
5152 | + #region [ 取得したチャンネル番号で、this.bチップがある に該当があれば設定する。] | |
5153 | + //----------------- | |
5154 | + if( ( nチャンネル番号 >= 0x11 ) && ( nチャンネル番号 <= 0x1a ) ) | |
4524 | 5155 | { |
4525 | 5156 | this.bチップがある.Drums = true; |
4526 | 5157 | } |
4527 | - else if( ( c >= 0x20 ) && ( c <= 0x27 ) ) | |
5158 | + else if( ( nチャンネル番号 >= 0x20 ) && ( nチャンネル番号 <= 0x27 ) ) | |
4528 | 5159 | { |
4529 | 5160 | this.bチップがある.Guitar = true; |
4530 | 5161 | } |
4531 | - else if( ( c >= 0xA0 ) && ( c <= 0xa7 ) ) | |
5162 | + else if( ( nチャンネル番号 >= 0xA0 ) && ( nチャンネル番号 <= 0xa7 ) ) | |
4532 | 5163 | { |
4533 | 5164 | this.bチップがある.Bass = true; |
4534 | 5165 | } |
4535 | - switch( c ) | |
5166 | + switch( nチャンネル番号 ) | |
4536 | 5167 | { |
4537 | 5168 | case 0x18: |
4538 | 5169 | this.bチップがある.HHOpen = true; |
@@ -4553,104 +5184,167 @@ | ||
4553 | 5184 | case 0xA0: |
4554 | 5185 | this.bチップがある.OpenBass = true; |
4555 | 5186 | break; |
5187 | + } | |
5188 | + //----------------- | |
5189 | + #endregion | |
4556 | 5190 | |
4557 | - case 0x02: // 小節長変更 | |
4558 | - { | |
4559 | - double result = 0.0; | |
4560 | - //if( !double.TryParse( strパラメータ, out result ) ) | |
4561 | - if (!TryParse(strパラメータ, out result)) // #23880 2010.12.30 yyagi: alternative TryParse to permit both '.' and ',' for decimal point | |
4562 | - { | |
4563 | - Trace.TraceError( "小節長倍率に不正な値を指定しました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
4564 | - return false; | |
4565 | - } | |
4566 | - CChip item = new CChip(); | |
4567 | - item.n発声位置 = num * 384; | |
4568 | - item.nチャンネル番号 = c; | |
4569 | - item.db実数値 = result; | |
4570 | - this.listChip.Add( item ); | |
4571 | - return true; | |
4572 | - } | |
5191 | + | |
5192 | + // (2) Ch.02を処理。 | |
5193 | + | |
5194 | + #region [ 小節長変更(Ch.02)は他のチャンネルとはパラメータが特殊なので、先にとっとと終わらせる。 ] | |
5195 | + //----------------- | |
5196 | + if( nチャンネル番号 == 0x02 ) | |
5197 | + { | |
5198 | + // 小節長倍率を取得する。 | |
5199 | + | |
5200 | + double db小節長倍率 = 1.0; | |
5201 | + //if( !double.TryParse( strパラメータ, out result ) ) | |
5202 | + if( !this.TryParse( strパラメータ, out db小節長倍率 ) ) // #23880 2010.12.30 yyagi: alternative TryParse to permit both '.' and ',' for decimal point | |
5203 | + { | |
5204 | + Trace.TraceError( "小節長倍率に不正な値を指定しました。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
5205 | + return false; | |
5206 | + } | |
5207 | + | |
5208 | + // 小節長倍率チップを配置する。 | |
5209 | + | |
5210 | + this.listChip.Add( | |
5211 | + new CChip() { | |
5212 | + nチャンネル番号 = nチャンネル番号, | |
5213 | + db実数値 = db小節長倍率, | |
5214 | + n発声位置 = n小節番号 * 384, | |
5215 | + } ); | |
5216 | + | |
5217 | + return true; // 配置終了。 | |
4573 | 5218 | } |
4574 | - if( string.IsNullOrEmpty( strパラメータ ) ) | |
4575 | - { | |
5219 | + //----------------- | |
5220 | + #endregion | |
5221 | + | |
5222 | + | |
5223 | + // (3) パラメータを処理。 | |
5224 | + | |
5225 | + if( string.IsNullOrEmpty( strパラメータ ) ) // パラメータはnullまたは空文字列ではないこと。 | |
4576 | 5226 | return false; |
4577 | - } | |
4578 | - int num4 = 0; | |
4579 | - StringBuilder builder = new StringBuilder( strパラメータ.Length ); | |
4580 | - CharEnumerator enumerator = strパラメータ.GetEnumerator(); | |
4581 | - while( enumerator.MoveNext() ) | |
5227 | + | |
5228 | + #region [ strパラメータ にオブジェクト記述を格納し、その n文字数 をカウントする。] | |
5229 | + //----------------- | |
5230 | + int n文字数 = 0; | |
5231 | + | |
5232 | + var sb = new StringBuilder( strパラメータ.Length ); | |
5233 | + | |
5234 | + // strパラメータを先頭から1文字ずつ見ながら正規化(無効文字('_')を飛ばしたり不正な文字でエラーを出したり)し、sb へ格納する。 | |
5235 | + | |
5236 | + CharEnumerator ce = strパラメータ.GetEnumerator(); | |
5237 | + while( ce.MoveNext() ) | |
4582 | 5238 | { |
4583 | - if( enumerator.Current != '_' ) | |
5239 | + if( ce.Current == '_' ) // '_' は無視。 | |
5240 | + continue; | |
5241 | + | |
5242 | + if( C変換.str36進数文字.IndexOf( ce.Current ) < 0 ) // オブジェクト記述は36進数文字であること。 | |
4584 | 5243 | { |
4585 | - if( "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".IndexOf( enumerator.Current ) < 0 ) | |
4586 | - { | |
4587 | - Trace.TraceError( "不正なオブジェクト指定があります。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } ); | |
4588 | - return false; | |
4589 | - } | |
4590 | - builder.Append( enumerator.Current ); | |
4591 | - num4++; | |
5244 | + Trace.TraceError( "不正なオブジェクト指定があります。[{0}: {1}行]", this.strファイル名の絶対パス, this.n現在の行数 ); | |
5245 | + return false; | |
4592 | 5246 | } |
5247 | + | |
5248 | + sb.Append( ce.Current ); | |
5249 | + n文字数++; | |
4593 | 5250 | } |
4594 | - strパラメータ = builder.ToString(); | |
4595 | - if( ( num4 % 2 ) != 0 ) | |
5251 | + | |
5252 | + strパラメータ = sb.ToString(); // 正規化された文字列になりました。 | |
5253 | + | |
5254 | + if( ( n文字数 % 2 ) != 0 ) // パラメータの文字数が奇数の場合、最後の1文字を無視する。 | |
5255 | + n文字数--; | |
5256 | + //----------------- | |
5257 | + #endregion | |
5258 | + | |
5259 | + | |
5260 | + // (4) パラメータをオブジェクト数値に分解して配置する。 | |
5261 | + | |
5262 | + for( int i = 0; i < ( n文字数 / 2 ); i++ ) // 2文字で1オブジェクト数値 | |
4596 | 5263 | { |
4597 | - num4--; | |
4598 | - } | |
4599 | - for( int i = 0; i < ( num4 / 2 ); i++ ) | |
4600 | - { | |
4601 | - int index = 0; | |
4602 | - if( c == 3 ) | |
5264 | + #region [ nオブジェクト数値 を1つ取得する。'00' なら無視。] | |
5265 | + //----------------- | |
5266 | + int nオブジェクト数値 = 0; | |
5267 | + | |
5268 | + if( nチャンネル番号 == 0x03 ) | |
4603 | 5269 | { |
4604 | - index = C変換.n16進数2桁の文字列を数値に変換して返す( strパラメータ.Substring( i * 2, 2 ) ); | |
5270 | + // Ch.03 のみ 16進数2桁。 | |
5271 | + nオブジェクト数値 = C変換.n16進数2桁の文字列を数値に変換して返す( strパラメータ.Substring( i * 2, 2 ) ); | |
4605 | 5272 | } |
4606 | 5273 | else |
4607 | 5274 | { |
4608 | - index = C変換.n36進数2桁の文字列を数値に変換して返す( strパラメータ.Substring( i * 2, 2 ) ); | |
5275 | + // その他のチャンネルは36進数2桁。 | |
5276 | + nオブジェクト数値 = C変換.n36進数2桁の文字列を数値に変換して返す( strパラメータ.Substring( i * 2, 2 ) ); | |
4609 | 5277 | } |
4610 | - if( index != 0 ) | |
5278 | + | |
5279 | + if( nオブジェクト数値 == 0x00 ) | |
5280 | + continue; | |
5281 | + //----------------- | |
5282 | + #endregion | |
5283 | + | |
5284 | + // オブジェクト数値に対応するチップを生成。 | |
5285 | + | |
5286 | + var chip = new CChip(); | |
5287 | + | |
5288 | + chip.nチャンネル番号 = nチャンネル番号; | |
5289 | + chip.n発声位置 = ( n小節番号 * 384 ) + ( ( 384 * i ) / ( n文字数 / 2 ) ); | |
5290 | + chip.n整数値 = nオブジェクト数値; | |
5291 | + chip.n整数値・内部番号 = nオブジェクト数値; | |
5292 | + | |
5293 | + #region [ chip.e楽器パート = ... ] | |
5294 | + //----------------- | |
5295 | + if( ( nチャンネル番号 >= 0x11 ) && ( nチャンネル番号 <= 0x1A ) ) | |
4611 | 5296 | { |
4612 | - CChip chip2 = new CChip(); | |
4613 | - chip2.n発声位置 = ( num * 384 ) + ( ( 384 * i ) / ( num4 / 2 ) ); | |
4614 | - chip2.nチャンネル番号 = c; | |
4615 | - chip2.n整数値 = index; | |
4616 | - chip2.n整数値・内部番号 = index; | |
4617 | - if( ( c >= 0x11 ) && ( c <= 0x1a ) ) | |
5297 | + chip.e楽器パート = E楽器パート.DRUMS; | |
5298 | + } | |
5299 | + if( ( nチャンネル番号 >= 0x20 ) && ( nチャンネル番号 <= 0x27 ) ) | |
5300 | + { | |
5301 | + chip.e楽器パート = E楽器パート.GUITAR; | |
5302 | + } | |
5303 | + if( ( nチャンネル番号 >= 160 ) && ( nチャンネル番号 <= 0xA7 ) ) | |
5304 | + { | |
5305 | + chip.e楽器パート = E楽器パート.BASS; | |
5306 | + } | |
5307 | + //----------------- | |
5308 | + #endregion | |
5309 | + | |
5310 | + #region [ 無限定義への対応 → 内部番号の取得。] | |
5311 | + //----------------- | |
5312 | + if( chip.bWAVを使うチャンネルである ) | |
5313 | + { | |
5314 | + chip.n整数値・内部番号 = this.n無限管理WAV[ nオブジェクト数値 ]; // これが本当に一意なWAV番号となる。(無限定義の場合、chip.n整数値 は一意である保証がない。) | |
5315 | + } | |
5316 | + else if( chip.bBPMチップである ) | |
5317 | + { | |
5318 | + chip.n整数値・内部番号 = this.n無限管理BPM[ nオブジェクト数値 ]; // これが本当に一意なBPM番号となる。(同上。) | |
5319 | + } | |
5320 | + //----------------- | |
5321 | + #endregion | |
5322 | + | |
5323 | + #region [ フィルインON/OFFチャンネル(Ch.53)の場合、発声位置を少し前後にずらす。] | |
5324 | + //----------------- | |
5325 | + if( nチャンネル番号 == 0x53 ) | |
5326 | + { | |
5327 | + // ずらすのは、フィルインONチップと同じ位置にいるチップでも確実にフィルインが発動し、 | |
5328 | + // 同様に、フィルインOFFチップと同じ位置にいるチップでも確実にフィルインが終了するようにするため。 | |
5329 | + | |
5330 | + if( ( nオブジェクト数値 > 0 ) && ( nオブジェクト数値 != 2 ) ) | |
4618 | 5331 | { |
4619 | - chip2.e楽器パート = E楽器パート.DRUMS; | |
5332 | + chip.n発声位置 -= 32; // 384÷32=12 ということで、フィルインONチップは12分音符ほど前へ移動。 | |
4620 | 5333 | } |
4621 | - if( ( c >= 0x20 ) && ( c <= 0x27 ) ) | |
5334 | + else if( nオブジェクト数値 == 2 ) | |
4622 | 5335 | { |
4623 | - chip2.e楽器パート = E楽器パート.GUITAR; | |
5336 | + chip.n発声位置 += 32; // 同じく、フィルインOFFチップは12分音符ほど後ろへ移動。 | |
4624 | 5337 | } |
4625 | - if( ( c >= 160 ) && ( c <= 0xa7 ) ) | |
4626 | - { | |
4627 | - chip2.e楽器パート = E楽器パート.BASS; | |
4628 | - } | |
4629 | - if( chip2.bWAVを使うチャンネルである ) | |
4630 | - { | |
4631 | - chip2.n整数値・内部番号 = this.n無限管理WAV[ index ]; | |
4632 | - } | |
4633 | - else if( chip2.bBPMチップである ) | |
4634 | - { | |
4635 | - chip2.n整数値・内部番号 = this.n無限管理BPM[ index ]; | |
4636 | - } | |
4637 | - if( c == 0x53 ) | |
4638 | - { | |
4639 | - if( ( index > 0 ) && ( index != 2 ) ) | |
4640 | - { | |
4641 | - chip2.n発声位置 -= 0x20; | |
4642 | - } | |
4643 | - else if( index == 2 ) | |
4644 | - { | |
4645 | - chip2.n発声位置 += 0x20; | |
4646 | - } | |
4647 | - } | |
4648 | - this.listChip.Add( chip2 ); | |
4649 | 5338 | } |
5339 | + //----------------- | |
5340 | + #endregion | |
5341 | + | |
5342 | + // チップを配置。 | |
5343 | + | |
5344 | + this.listChip.Add( chip ); | |
4650 | 5345 | } |
4651 | 5346 | return true; |
4652 | 5347 | } |
4653 | - | |
4654 | 5348 | #region [#23880 2010.12.30 yyagi: コンマとスペースの両方を小数点として扱うTryParse] |
4655 | 5349 | /// <summary> |
4656 | 5350 | /// 小数点としてコンマとピリオドの両方を受け付けるTryParse() |
@@ -47,12 +47,12 @@ | ||
47 | 47 | this.Release(); |
48 | 48 | throw new Exception( "AVIFileGetStream failed." ); |
49 | 49 | } |
50 | - AVISTREAMINFO psi = new AVISTREAMINFO(); | |
51 | - AVIStreamInfo( this.aviStream, ref psi, Marshal.SizeOf( psi ) ); | |
52 | - this.dwレート = psi.dwRate; | |
53 | - this.dwスケール = psi.dwScale; | |
54 | - this.nフレーム幅 = psi.rcFrame.right - psi.rcFrame.left; | |
55 | - this.nフレーム高さ = psi.rcFrame.bottom - psi.rcFrame.top; | |
50 | + var info = new AVISTREAMINFO(); | |
51 | + AVIStreamInfo( this.aviStream, ref info, Marshal.SizeOf( info ) ); | |
52 | + this.dwレート = info.dwRate; | |
53 | + this.dwスケール = info.dwScale; | |
54 | + this.nフレーム幅 = info.rcFrame.right - info.rcFrame.left; | |
55 | + this.nフレーム高さ = info.rcFrame.bottom - info.rcFrame.top; | |
56 | 56 | try |
57 | 57 | { |
58 | 58 | this.frame = AVIStreamGetFrameOpen( this.aviStream, 0 ); |
@@ -79,9 +79,8 @@ | ||
79 | 79 | public Bitmap GetFrame( int no ) |
80 | 80 | { |
81 | 81 | if( this.aviStream == IntPtr.Zero ) |
82 | - { | |
83 | 82 | throw new InvalidOperationException(); |
84 | - } | |
83 | + | |
85 | 84 | return BitmapUtil.ToBitmap( AVIStreamGetFrame( this.frame, no ) ); |
86 | 85 | } |
87 | 86 | public int GetFrameNoFromTime( int time ) |
@@ -91,90 +90,95 @@ | ||
91 | 90 | public IntPtr GetFramePtr( int no ) |
92 | 91 | { |
93 | 92 | if( this.aviStream == IntPtr.Zero ) |
94 | - { | |
95 | 93 | throw new InvalidOperationException(); |
96 | - } | |
94 | + | |
97 | 95 | return AVIStreamGetFrame( this.frame, no ); |
98 | 96 | } |
99 | 97 | public int GetMaxFrameCount() |
100 | 98 | { |
101 | 99 | if( this.aviStream == IntPtr.Zero ) |
102 | - { | |
103 | 100 | throw new InvalidOperationException(); |
104 | - } | |
101 | + | |
105 | 102 | return AVIStreamLength( this.aviStream ); |
106 | 103 | } |
107 | 104 | |
108 | 105 | public unsafe void tBitmap24ToGraphicsStreamR5G6B5( BitmapUtil.BITMAPINFOHEADER* pBITMAPINFOHEADER, DataStream gs, int nWidth, int nHeight ) |
109 | 106 | { |
110 | - int num = pBITMAPINFOHEADER->biWidthビットマップの幅dot; | |
111 | - int num2 = pBITMAPINFOHEADER->biHeightビットマップの高さdot; | |
112 | - int num3 = ( num * 3 ) + ( ( 4 - ( ( num * 3 ) % 4 ) ) % 4 ); | |
113 | - ushort* numPtr = (ushort*) gs.DataPointer.ToPointer(); | |
114 | - byte* numPtr2 = (byte*) ( pBITMAPINFOHEADER + 1 ); | |
115 | - for( int i = 0; i < num2; i++ ) | |
107 | + int nBmpWidth = pBITMAPINFOHEADER->biWidthビットマップの幅dot; | |
108 | + int nBmpHeight = pBITMAPINFOHEADER->biHeightビットマップの高さdot; | |
109 | + int nBmpLineByte = ( nBmpWidth * 3 ) + ( ( 4 - ( ( nBmpWidth * 3 ) % 4 ) ) % 4 ); | |
110 | + | |
111 | + ushort* pTexture = (ushort*) gs.DataPointer.ToPointer(); | |
112 | + byte* pBitmap = (byte*) ( pBITMAPINFOHEADER + 1 ); | |
113 | + | |
114 | + for( int i = 0; i < nBmpHeight; i++ ) | |
116 | 115 | { |
117 | 116 | if( i >= nHeight ) |
117 | + break; | |
118 | + | |
119 | + for( int j = 0; j < nBmpWidth; j++ ) | |
118 | 120 | { |
119 | - return; | |
120 | - } | |
121 | - for( int j = 0; j < num; j++ ) | |
122 | - { | |
123 | 121 | if( j >= nWidth ) |
124 | - { | |
125 | 122 | break; |
126 | - } | |
127 | - ushort num6 = (ushort) ( ( ( numPtr2 + ( ( ( num2 - i ) - 1 ) * num3 ) )[ j * 3 ] >> 3 ) & 0x1f ); | |
128 | - ushort num5 = (ushort) ( ( ( ( numPtr2 + ( ( ( num2 - i ) - 1 ) * num3 ) ) + ( j * 3 ) )[ 1 ] >> 2 ) & 0x3f ); | |
129 | - ushort num4 = (ushort) ( ( ( ( numPtr2 + ( ( ( num2 - i ) - 1 ) * num3 ) ) + ( j * 3 ) )[ 2 ] >> 3 ) & 0x1f ); | |
130 | - ( numPtr + ( i * nWidth ) )[ j ] = (ushort) ( ( ( num4 << 11 ) | ( num5 << 5 ) ) | num6 ); | |
123 | + | |
124 | + ushort B = (ushort) ( ( *( ( pBitmap + ( ( ( nBmpHeight - i ) - 1 ) * nBmpLineByte ) ) + ( j * 3 ) + 0 ) >> 3 ) & 0x1f ); | |
125 | + ushort G = (ushort) ( ( *( ( pBitmap + ( ( ( nBmpHeight - i ) - 1 ) * nBmpLineByte ) ) + ( j * 3 ) + 1 ) >> 2 ) & 0x3f ); | |
126 | + ushort R = (ushort) ( ( *( ( pBitmap + ( ( ( nBmpHeight - i ) - 1 ) * nBmpLineByte ) ) + ( j * 3 ) + 2 ) >> 3 ) & 0x1f ); | |
127 | + *( pTexture + ( i * nWidth ) + j ) = (ushort) ( ( R << 11 ) | ( G << 5 ) | B ); | |
131 | 128 | } |
132 | 129 | } |
133 | 130 | } |
134 | 131 | public unsafe void tBitmap24ToGraphicsStreamX8R8G8B8( BitmapUtil.BITMAPINFOHEADER* pBITMAPINFOHEADER, DataStream ds, int nWidth, int nHeight ) |
135 | 132 | { |
136 | - int num = pBITMAPINFOHEADER->biWidthビットマップの幅dot; | |
137 | - int num2 = pBITMAPINFOHEADER->biHeightビットマップの高さdot; | |
138 | - int num3 = ( num * 3 ) + ( ( 4 - ( ( num * 3 ) % 4 ) ) % 4 ); | |
139 | - uint* numPtr = (uint*) ds.DataPointer.ToPointer(); | |
140 | - byte* numPtr2 = (byte*) ( pBITMAPINFOHEADER + 1 ); | |
141 | - for( int i = 0; i < num2; i++ ) | |
133 | + int nBmpWidth = pBITMAPINFOHEADER->biWidthビットマップの幅dot; | |
134 | + int nBmpHeight = pBITMAPINFOHEADER->biHeightビットマップの高さdot; | |
135 | + int nBmpLineByte = ( nBmpWidth * 3 ) + ( ( 4 - ( ( nBmpWidth * 3 ) % 4 ) ) % 4 ); | |
136 | + | |
137 | + uint* pTexture = (uint*) ds.DataPointer.ToPointer(); | |
138 | + byte* pBitmap = (byte*) ( pBITMAPINFOHEADER + 1 ); | |
139 | + | |
140 | + for( int i = 0; i < nBmpHeight; i++ ) | |
142 | 141 | { |
143 | 142 | if( i >= nHeight ) |
143 | + break; | |
144 | + | |
145 | + for( int j = 0; j < nBmpWidth; j++ ) | |
144 | 146 | { |
145 | - return; | |
146 | - } | |
147 | - for( int j = 0; j < num; j++ ) | |
148 | - { | |
149 | 147 | if( j >= nWidth ) |
150 | - { | |
151 | 148 | break; |
152 | - } | |
153 | - uint num6 = ( numPtr2 + ( ( ( num2 - i ) - 1 ) * num3 ) )[ j * 3 ]; | |
154 | - uint num5 = ( ( numPtr2 + ( ( ( num2 - i ) - 1 ) * num3 ) ) + ( j * 3 ) )[ 1 ]; | |
155 | - uint num4 = ( ( numPtr2 + ( ( ( num2 - i ) - 1 ) * num3 ) ) + ( j * 3 ) )[ 2 ]; | |
156 | - ( numPtr + ( i * nWidth ) )[ j ] = ( ( num4 << 0x10 ) | ( num5 << 8 ) ) | num6; | |
149 | + | |
150 | + uint B = *( ( pBitmap + ( ( ( nBmpHeight - i ) - 1 ) * nBmpLineByte ) ) + ( j * 3 ) + 0 ); | |
151 | + uint G = *( ( pBitmap + ( ( ( nBmpHeight - i ) - 1 ) * nBmpLineByte ) ) + ( j * 3 ) + 1 ); | |
152 | + uint R = *( ( pBitmap + ( ( ( nBmpHeight - i ) - 1 ) * nBmpLineByte ) ) + ( j * 3 ) + 2 ); | |
153 | + *( pTexture + ( i * nWidth ) + j ) = ( R << 16 ) | ( G << 8 ) | B; | |
157 | 154 | } |
158 | 155 | } |
159 | 156 | } |
160 | 157 | |
161 | - #region [ IDisposable+α 実装 ] | |
158 | + #region [ Dispose-Finalize パターン実装 ] | |
162 | 159 | //----------------- |
163 | 160 | public void Dispose() |
164 | 161 | { |
165 | 162 | this.Dispose( true ); |
163 | + GC.SuppressFinalize( this ); // 2011.8.19 from: 忘れてた。 | |
166 | 164 | } |
167 | 165 | protected void Dispose( bool disposeManagedObjects ) |
168 | 166 | { |
169 | - if( !this.bDispose完了済み ) | |
167 | + if( this.bDispose完了済み ) | |
168 | + return; | |
169 | + | |
170 | + if( disposeManagedObjects ) | |
170 | 171 | { |
171 | - if( this.frame != IntPtr.Zero ) | |
172 | - { | |
173 | - AVIStreamGetFrameClose( this.frame ); | |
174 | - } | |
175 | - this.Release(); | |
176 | - this.bDispose完了済み = true; | |
172 | + // (A) Managed リソースの解放 | |
177 | 173 | } |
174 | + | |
175 | + // (B) Unamanaged リソースの解放 | |
176 | + | |
177 | + if( this.frame != IntPtr.Zero ) | |
178 | + AVIStreamGetFrameClose( this.frame ); | |
179 | + | |
180 | + this.Release(); | |
181 | + this.bDispose完了済み = true; | |
178 | 182 | } |
179 | 183 | ~CAvi() |
180 | 184 | { |
@@ -281,7 +285,7 @@ | ||
281 | 285 | |
282 | 286 | private static uint mmioFOURCC( char c0, char c1, char c2, char c3 ) |
283 | 287 | { |
284 | - return ( ( ( ( (uint) c3 << 0x18 ) | ( (uint) c2 << 0x10 ) ) | ( (uint) c1 << 8 ) ) | (uint) c0 ); | |
288 | + return ( (uint) c3 << 0x18 ) | ( (uint) c2 << 0x10 ) | ( (uint) c1 << 0x08 ) | (uint) c0; | |
285 | 289 | } |
286 | 290 | private void Release() |
287 | 291 | { |
@@ -6,6 +6,12 @@ | ||
6 | 6 | { |
7 | 7 | public class C変換 |
8 | 8 | { |
9 | + // プロパティ | |
10 | + | |
11 | + public static readonly string str16進数文字 = "0123456789ABCDEFabcdef"; | |
12 | + public static readonly string str36進数文字 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; | |
13 | + | |
14 | + | |
9 | 15 | // メソッド |
10 | 16 | |
11 | 17 | public static bool bONorOFF( char c ) |
@@ -79,7 +85,7 @@ | ||
79 | 85 | if( num.Length < 2 ) |
80 | 86 | return -1; |
81 | 87 | |
82 | - int index = _16進数文字.IndexOf( num[ 0 ] ); | |
88 | + int index = str16進数文字.IndexOf( num[ 0 ] ); | |
83 | 89 | if( index < 0 ) |
84 | 90 | return -1; |
85 | 91 |
@@ -86,7 +92,7 @@ | ||
86 | 92 | if( index >= 16 ) |
87 | 93 | index -= 6; |
88 | 94 | |
89 | - int num3 = _16進数文字.IndexOf( num[ 1 ] ); | |
95 | + int num3 = str16進数文字.IndexOf( num[ 1 ] ); | |
90 | 96 | if( num3 < 0 ) |
91 | 97 | return -1; |
92 | 98 |
@@ -100,7 +106,7 @@ | ||
100 | 106 | if( num.Length < 2 ) |
101 | 107 | return -1; |
102 | 108 | |
103 | - int index = _36進数文字.IndexOf( num[ 0 ] ); | |
109 | + int index = str36進数文字.IndexOf( num[ 0 ] ); | |
104 | 110 | if( index < 0 ) |
105 | 111 | return -1; |
106 | 112 |
@@ -107,7 +113,7 @@ | ||
107 | 113 | if( index >= 0x24 ) |
108 | 114 | index -= 0x1a; |
109 | 115 | |
110 | - int num3 = _36進数文字.IndexOf( num[ 1 ] ); | |
116 | + int num3 = str36進数文字.IndexOf( num[ 1 ] ); | |
111 | 117 | if( num3 < 0 ) |
112 | 118 | return -1; |
113 | 119 |
@@ -120,7 +126,7 @@ | ||
120 | 126 | { |
121 | 127 | if( num.Length >= 3 ) |
122 | 128 | { |
123 | - int index = _36進数文字.IndexOf( num[ 0 ] ); | |
129 | + int index = str36進数文字.IndexOf( num[ 0 ] ); | |
124 | 130 | if( index < 0 ) |
125 | 131 | return -1; |
126 | 132 |
@@ -127,11 +133,11 @@ | ||
127 | 133 | if( index >= 0x24 ) |
128 | 134 | index -= 0x1a; |
129 | 135 | |
130 | - int num3 = _16進数文字.IndexOf( num[ 1 ] ); | |
136 | + int num3 = str16進数文字.IndexOf( num[ 1 ] ); | |
131 | 137 | if( ( num3 < 0 ) || ( num3 > 9 ) ) |
132 | 138 | return -1; |
133 | 139 | |
134 | - int num4 = _16進数文字.IndexOf( num[ 2 ] ); | |
140 | + int num4 = str16進数文字.IndexOf( num[ 2 ] ); | |
135 | 141 | if( ( num4 >= 0 ) && ( num4 <= 9 ) ) |
136 | 142 | return ( ( ( index * 100 ) + ( num3 * 10 ) ) + num4 ); |
137 | 143 | } |
@@ -146,9 +152,9 @@ | ||
146 | 152 | int num2 = num / 100; |
147 | 153 | int num3 = ( num % 100 ) / 10; |
148 | 154 | int num4 = ( num % 100 ) % 10; |
149 | - char ch = _36進数文字[ num2 ]; | |
150 | - char ch2 = _16進数文字[ num3 ]; | |
151 | - char ch3 = _16進数文字[ num4 ]; | |
155 | + char ch = str36進数文字[ num2 ]; | |
156 | + char ch2 = str16進数文字[ num3 ]; | |
157 | + char ch3 = str16進数文字[ num4 ]; | |
152 | 158 | return ( ch.ToString() + ch2.ToString() + ch3.ToString() ); |
153 | 159 | } |
154 | 160 | public static string str数値を16進数2桁に変換して返す( int num ) |
@@ -156,8 +162,8 @@ | ||
156 | 162 | if( ( num < 0 ) || ( num >= 0x100 ) ) |
157 | 163 | return "00"; |
158 | 164 | |
159 | - char ch = _16進数文字[ num / 0x10 ]; | |
160 | - char ch2 = _16進数文字[ num % 0x10 ]; | |
165 | + char ch = str16進数文字[ num / 0x10 ]; | |
166 | + char ch2 = str16進数文字[ num % 0x10 ]; | |
161 | 167 | return ( ch.ToString() + ch2.ToString() ); |
162 | 168 | } |
163 | 169 | public static string str数値を36進数2桁に変換して返す( int num ) |
@@ -165,14 +171,11 @@ | ||
165 | 171 | if( ( num < 0 ) || ( num >= 0x510 ) ) |
166 | 172 | return "00"; |
167 | 173 | |
168 | - char ch = _36進数文字[ num / 0x24 ]; | |
169 | - char ch2 = _36進数文字[ num % 0x24 ]; | |
174 | + char ch = str36進数文字[ num / 0x24 ]; | |
175 | + char ch2 = str36進数文字[ num % 0x24 ]; | |
170 | 176 | return ( ch.ToString() + ch2.ToString() ); |
171 | 177 | } |
172 | 178 | |
173 | - | |
174 | - // その他 | |
175 | - | |
176 | 179 | #region [ private ] |
177 | 180 | //----------------- |
178 | 181 |
@@ -180,9 +183,6 @@ | ||
180 | 183 | private C変換() |
181 | 184 | { |
182 | 185 | } |
183 | - | |
184 | - private static readonly string _16進数文字 = "0123456789ABCDEFabcdef"; | |
185 | - private static readonly string _36進数文字 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; | |
186 | 186 | //----------------- |
187 | 187 | #endregion |
188 | 188 | } |