/[MorrowindCustomClothingSlotCreator]/trunk/MorrowindCustomClothingSlotCreator/Form1.cs
ViewVC logotype

Diff of /trunk/MorrowindCustomClothingSlotCreator/Form1.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/MorrowindCustomClothingSlotCreator/Form1.cs	2011/07/30 09:16:04	31
+++ trunk/MorrowindCustomClothingSlotCreator/Form1.cs	2011/07/30 09:59:11	32
@@ -22,6 +22,10 @@
         {
             InitializeComponent();
             this.TES3PluginLoader = new TES3PluginLoader();
+
+            foreach (int val in Enum.GetValues(typeof(ClothingTypes))) { comboClothingType.Items.Add(Enum.GetName(typeof(ClothingTypes), val)); }
+            for (int i = 1; i < 0x100; i++) { comboCustomClothingSlotIndex.Items.Add("0x" + i.ToString("X2")); }
+
         }
 
         public bool LoadPlugin(string pluginFile)
@@ -64,13 +68,60 @@
         private void lstClothingEntries_SelectedIndexChanged(object sender, EventArgs e)
         {
             ClothingEntry chosen_entry = null;
-
+            editor_flow.Enabled = false;
             foreach (KeyValuePair<string, ClothingEntry> entry in this.TES3PluginLoader.ClothingSection.ClothingEntries)
             {
                 string key = lstClothingEntries.Items[lstClothingEntries.SelectedIndex].ToString();
                 if (key == entry.Key) { chosen_entry = entry.Value; break; }
             }
             if (chosen_entry == null) return;
+            this.PopulateEditorData(chosen_entry);
+        }
+
+        private void PopulateEditorData(ClothingEntry entry)
+        {
+            if (entry == null) return;
+            editor_flow.Enabled = true;
+            txtClothingName.Text = entry.CLOT_NAME;
+
+            int actual_type = entry.CLOT_CTDT_TYPE;
+            //int actual_type = 0x01020309;
+
+            int type = (actual_type & 0x000000FF) >> 0;
+            int unknown2 = (actual_type & 0x0000FF00) >> 8;
+            int unknown1 = (actual_type & 0x00FF0000) >> 16;
+            int index = (int)(actual_type & 0xFF000000) >> 24;
+
+            // Set the clothing type in the drop down
+            foreach (string item in comboClothingType.Items)
+            {
+                string type_name = Enum.GetName(typeof(ClothingTypes), type);
+                bool HaveUnknownType = false;
+                foreach (int val in Enum.GetValues(typeof(ClothingTypes)))
+                {
+                    if (type == val) { HaveUnknownType = false; break; }
+                    else { HaveUnknownType = true; }
+                }
+                if (HaveUnknownType) { comboClothingType.Text = "Unknown"; break; }
+                if (item == type_name)
+                {
+                    comboClothingType.SelectedIndex = comboClothingType.Items.IndexOf(item);
+                    comboClothingType.Text = item;
+                    break;
+                }
+            }
+            foreach (string item_index in comboCustomClothingSlotIndex.Items)
+            {
+                if (index == 0) { comboCustomClothingSlotIndex.Text = "Default"; break; }
+                else if (item_index == string.Format("0x{0:X2}",index))
+                {
+                    comboCustomClothingSlotIndex.SelectedIndex = comboCustomClothingSlotIndex.Items.IndexOf(item_index);
+                    comboCustomClothingSlotIndex.Text = item_index.ToString();
+                    break;
+                }
+            }
         }
+
+        private void Form1_Shown(object sender, EventArgs e) { editor_flow.Enabled = false; }
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22