OSDN Git Service

refactor. master
authornomeu <nomeu@nomeu.org>
Wed, 15 Jun 2016 02:56:18 +0000 (11:56 +0900)
committernomeu <nomeu@nomeu.org>
Wed, 15 Jun 2016 02:56:18 +0000 (11:56 +0900)
Form1.cs
MqoWriter.cs

index 29ad540..723ec3e 100644 (file)
--- a/Form1.cs
+++ b/Form1.cs
@@ -464,7 +464,7 @@ namespace Tso2MqoGui
             {
                 tabPage2.BackColor = Color.Tomato;
                 List<TSOMesh> meshes = new List<TSOMesh>();
-                Dictionary<string, Pair<TSOMaterial, int>> materialmap = new Dictionary<string, Pair<TSOMaterial, int>>();
+                Dictionary<string, KeyValuePair<TSOMaterial, int>> materialmap = new Dictionary<string, KeyValuePair<TSOMaterial, int>>();
                 Dictionary<string, TSOTex> textures = new Dictionary<string, TSOTex>();
                 TSOFile last = null;
 
@@ -495,8 +495,7 @@ namespace Tso2MqoGui
                         {
                             if (!materialmap.ContainsKey(mat.Name))
                             {
-                                Pair<TSOMaterial, int> value = new Pair<TSOMaterial, int>(mat, materialmap.Count);
-                                materialmap.Add(mat.Name, value);
+                                materialmap.Add(mat.Name, new KeyValuePair<TSOMaterial, int>(mat, materialmap.Count));
 
                                 if (!textures.ContainsKey(mat.ColorTex))
                                 {
@@ -524,14 +523,14 @@ namespace Tso2MqoGui
                     TSOMaterial[] mtllist = new TSOMaterial[materialmap.Count];
 
                     foreach (var i in materialmap.Values)
-                        mtllist[i.Second] = i.First;
+                        mtllist[i.Value] = i.Key;
 
                     foreach (TSOMesh mesh in meshes)
                     {
                         foreach (TSOSubMesh sub in mesh.sub_meshes)
                         {
                             TSOMaterial spec = mesh.file.materials[sub.spec];
-                            sub.spec = materialmap[spec.Name].Second;
+                            sub.spec = materialmap[spec.Name].Value;
                         }
                     }
 
index 05ed511..483b7e7 100644 (file)
@@ -6,22 +6,6 @@ using System.Xml;
 
 namespace Tso2MqoGui
 {
-    public class Pair<T, U>
-    {
-        public T First;
-        public U Second;
-
-        public Pair()
-        {
-        }
-
-        public Pair(T first, U second)
-        {
-            First = first;
-            Second = second;
-        }
-    }
-
     public class MqoWriter : IDisposable
     {
         public TextWriter tw;