リビジョン | 40faa30b9e6c7c7870a588e47916c8c2ffcfb82f (tree) |
---|---|
日時 | 2015-01-30 04:00:17 |
作者 | nomeu <nomeu@nome...> |
コミッター | nomeu |
attribute names are case-sensitive.
@@ -11,7 +11,7 @@ namespace Tso2MqoGui | ||
11 | 11 | |
12 | 12 | static char[] param_delimiters = new char[] { ' ', '\t', '(', ')' }; |
13 | 13 | |
14 | - StreamReader sr; | |
14 | + StreamReader reader; | |
15 | 15 | MqoFile mqo; |
16 | 16 | MqoObject obj; |
17 | 17 |
@@ -21,9 +21,9 @@ namespace Tso2MqoGui | ||
21 | 21 | |
22 | 22 | public void Load(string path) |
23 | 23 | { |
24 | - using (FileStream fs = File.OpenRead(path)) | |
24 | + using (FileStream stream = File.OpenRead(path)) | |
25 | 25 | { |
26 | - sr = new StreamReader(fs, Encoding.Default); | |
26 | + reader = new StreamReader(stream, Encoding.Default); | |
27 | 27 | mqo = new MqoFile(); |
28 | 28 | ReadAll(); |
29 | 29 | } |
@@ -101,7 +101,7 @@ namespace Tso2MqoGui | ||
101 | 101 | { |
102 | 102 | for (int lineno = 1; ; ++lineno) |
103 | 103 | { |
104 | - string line = sr.ReadLine(); | |
104 | + string line = reader.ReadLine(); | |
105 | 105 | |
106 | 106 | if (line == null) |
107 | 107 | break; |
@@ -293,16 +293,15 @@ namespace Tso2MqoGui | ||
293 | 293 | for (int i = 1; i < tokens.Length; ++i) |
294 | 294 | { |
295 | 295 | string t = tokens[i]; |
296 | - string t2 = t.ToLower(); | |
297 | - | |
298 | - if (t2.StartsWith("shader(")) m.shader = int.Parse(SplitParam(t)[1]); | |
299 | - else if (t2.StartsWith("col(")) m.col = Color3.Parse(SplitParam(t), 1); | |
300 | - else if (t2.StartsWith("dif(")) m.dif = float.Parse(SplitParam(t)[1]); | |
301 | - else if (t2.StartsWith("amb(")) m.amb = float.Parse(SplitParam(t)[1]); | |
302 | - else if (t2.StartsWith("emi(")) m.emi = float.Parse(SplitParam(t)[1]); | |
303 | - else if (t2.StartsWith("spc(")) m.spc = float.Parse(SplitParam(t)[1]); | |
304 | - else if (t2.StartsWith("power(")) m.power = float.Parse(SplitParam(t)[1]); | |
305 | - else if (t2.StartsWith("tex(")) m.tex = t.Substring(3).Trim('(', ')', '"'); | |
296 | + | |
297 | + if (t.StartsWith("shader(")) m.shader = int.Parse(SplitParam(t)[1]); | |
298 | + else if (t.StartsWith("col(")) m.col = Color3.Parse(SplitParam(t), 1); | |
299 | + else if (t.StartsWith("dif(")) m.dif = float.Parse(SplitParam(t)[1]); | |
300 | + else if (t.StartsWith("amb(")) m.amb = float.Parse(SplitParam(t)[1]); | |
301 | + else if (t.StartsWith("emi(")) m.emi = float.Parse(SplitParam(t)[1]); | |
302 | + else if (t.StartsWith("spc(")) m.spc = float.Parse(SplitParam(t)[1]); | |
303 | + else if (t.StartsWith("power(")) m.power = float.Parse(SplitParam(t)[1]); | |
304 | + else if (t.StartsWith("tex(")) m.tex = t.Substring(3).Trim('(', ')', '"'); | |
306 | 305 | } |
307 | 306 | return true; |
308 | 307 | } |
@@ -389,7 +388,7 @@ namespace Tso2MqoGui | ||
389 | 388 | |
390 | 389 | for (int lineno = 1; ; ++lineno) |
391 | 390 | { |
392 | - string line = sr.ReadLine(); | |
391 | + string line = reader.ReadLine(); | |
393 | 392 | |
394 | 393 | if (line == null) |
395 | 394 | break; |
@@ -436,21 +435,20 @@ namespace Tso2MqoGui | ||
436 | 435 | for (int i = 1; i < tokens.Length; ++i) |
437 | 436 | { |
438 | 437 | string t = tokens[i]; |
439 | - string t2 = t.ToLower(); | |
440 | 438 | |
441 | - if (t2.StartsWith("v(")) | |
439 | + if (t.StartsWith("V(")) | |
442 | 440 | { |
443 | 441 | string[] t3 = SplitParam(t); |
444 | 442 | f.a = ushort.Parse(t3[1]); |
445 | 443 | f.b = ushort.Parse(t3[2]); |
446 | 444 | f.c = ushort.Parse(t3[3]); |
447 | 445 | } |
448 | - else if (t2.StartsWith("m(")) | |
446 | + else if (t.StartsWith("M(")) | |
449 | 447 | { |
450 | 448 | string[] t3 = SplitParam(t); |
451 | 449 | f.spec = ushort.Parse(t3[1]); |
452 | 450 | } |
453 | - else if (t2.StartsWith("uv(")) | |
451 | + else if (t.StartsWith("UV(")) | |
454 | 452 | { |
455 | 453 | string[] t3 = SplitParam(t); |
456 | 454 | f.ta = Point2.Parse(t3, 1); |
@@ -469,9 +467,8 @@ namespace Tso2MqoGui | ||
469 | 467 | for (int i = 1; i < tokens.Length; ++i) |
470 | 468 | { |
471 | 469 | string t = tokens[i]; |
472 | - string t2 = t.ToLower(); | |
473 | 470 | |
474 | - if (t2.StartsWith("v(")) | |
471 | + if (t.StartsWith("V(")) | |
475 | 472 | { |
476 | 473 | string[] t3 = SplitParam(t); |
477 | 474 | f.a = ushort.Parse(t3[1]); |
@@ -481,13 +478,13 @@ namespace Tso2MqoGui | ||
481 | 478 | f2.b = f.c; |
482 | 479 | f2.c = ushort.Parse(t3[4]); |
483 | 480 | } |
484 | - else if (t2.StartsWith("m(")) | |
481 | + else if (t.StartsWith("M(")) | |
485 | 482 | { |
486 | 483 | string[] t3 = SplitParam(t); |
487 | 484 | f.spec = ushort.Parse(t3[1]); |
488 | 485 | f2.spec = f.spec; |
489 | 486 | } |
490 | - else if (t2.StartsWith("uv(")) | |
487 | + else if (t.StartsWith("UV(")) | |
491 | 488 | { |
492 | 489 | string[] t3 = SplitParam(t); |
493 | 490 | f.ta = Point2.Parse(t3, 1); |