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

Diff of /trunk/MorrowindCustomClothingSlotCreator/Form1.cs

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

revision 31 by william, Sat Jul 30 09:16:04 2011 UTC revision 32 by william, Sat Jul 30 09:59:11 2011 UTC
# Line 22  namespace MorrowindCustomClothingSlotCre Line 22  namespace MorrowindCustomClothingSlotCre
22          {          {
23              InitializeComponent();              InitializeComponent();
24              this.TES3PluginLoader = new TES3PluginLoader();              this.TES3PluginLoader = new TES3PluginLoader();
25    
26                foreach (int val in Enum.GetValues(typeof(ClothingTypes))) { comboClothingType.Items.Add(Enum.GetName(typeof(ClothingTypes), val)); }
27                for (int i = 1; i < 0x100; i++) { comboCustomClothingSlotIndex.Items.Add("0x" + i.ToString("X2")); }
28    
29          }          }
30    
31          public bool LoadPlugin(string pluginFile)          public bool LoadPlugin(string pluginFile)
# Line 64  namespace MorrowindCustomClothingSlotCre Line 68  namespace MorrowindCustomClothingSlotCre
68          private void lstClothingEntries_SelectedIndexChanged(object sender, EventArgs e)          private void lstClothingEntries_SelectedIndexChanged(object sender, EventArgs e)
69          {          {
70              ClothingEntry chosen_entry = null;              ClothingEntry chosen_entry = null;
71                editor_flow.Enabled = false;
72              foreach (KeyValuePair<string, ClothingEntry> entry in this.TES3PluginLoader.ClothingSection.ClothingEntries)              foreach (KeyValuePair<string, ClothingEntry> entry in this.TES3PluginLoader.ClothingSection.ClothingEntries)
73              {              {
74                  string key = lstClothingEntries.Items[lstClothingEntries.SelectedIndex].ToString();                  string key = lstClothingEntries.Items[lstClothingEntries.SelectedIndex].ToString();
75                  if (key == entry.Key) { chosen_entry = entry.Value; break; }                  if (key == entry.Key) { chosen_entry = entry.Value; break; }
76              }              }
77              if (chosen_entry == null) return;              if (chosen_entry == null) return;
78                this.PopulateEditorData(chosen_entry);
79            }
80    
81            private void PopulateEditorData(ClothingEntry entry)
82            {
83                if (entry == null) return;
84                editor_flow.Enabled = true;
85                txtClothingName.Text = entry.CLOT_NAME;
86    
87                int actual_type = entry.CLOT_CTDT_TYPE;
88                //int actual_type = 0x01020309;
89    
90                int type = (actual_type & 0x000000FF) >> 0;
91                int unknown2 = (actual_type & 0x0000FF00) >> 8;
92                int unknown1 = (actual_type & 0x00FF0000) >> 16;
93                int index = (int)(actual_type & 0xFF000000) >> 24;
94    
95                // Set the clothing type in the drop down
96                foreach (string item in comboClothingType.Items)
97                {
98                    string type_name = Enum.GetName(typeof(ClothingTypes), type);
99                    bool HaveUnknownType = false;
100                    foreach (int val in Enum.GetValues(typeof(ClothingTypes)))
101                    {
102                        if (type == val) { HaveUnknownType = false; break; }
103                        else { HaveUnknownType = true; }
104                    }
105                    if (HaveUnknownType) { comboClothingType.Text = "Unknown"; break; }
106                    if (item == type_name)
107                    {
108                        comboClothingType.SelectedIndex = comboClothingType.Items.IndexOf(item);
109                        comboClothingType.Text = item;
110                        break;
111                    }
112                }
113                foreach (string item_index in comboCustomClothingSlotIndex.Items)
114                {
115                    if (index == 0) { comboCustomClothingSlotIndex.Text = "Default"; break; }
116                    else if (item_index == string.Format("0x{0:X2}",index))
117                    {
118                        comboCustomClothingSlotIndex.SelectedIndex = comboCustomClothingSlotIndex.Items.IndexOf(item_index);
119                        comboCustomClothingSlotIndex.Text = item_index.ToString();
120                        break;
121                    }
122                }
123          }          }
124    
125            private void Form1_Shown(object sender, EventArgs e) { editor_flow.Enabled = false; }
126      }      }
127  }  }

Legend:
Removed from v.31  
changed lines
  Added in v.32

  ViewVC Help
Powered by ViewVC 1.1.22