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

Contents of /trunk/MorrowindCustomClothingSlotCreator/Form1.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Sat Jul 30 09:16:04 2011 UTC (8 years, 5 months ago) by william
File size: 2841 byte(s)
*** use KeyValuePair<string,ClothingEntry> for working with clothingentry dictionary
*** implement selected clothing entry change in main form

1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Text;
7 using System.Windows.Forms;
8 using libTES3FileFormat;
9
10 namespace MorrowindCustomClothingSlotCreator
11 {
12
13 public partial class Form1 : Form
14 {
15 public static MorrowindPathHelper MorrowindData = new MorrowindPathHelper();
16 public static string MorrowindPath = MorrowindData.MorrowindInstallPath;
17 public static string MorrowindDataFilesPath = MorrowindPath + "\\Data Files\\";
18
19 private TES3PluginLoader TES3PluginLoader;
20
21 public Form1()
22 {
23 InitializeComponent();
24 this.TES3PluginLoader = new TES3PluginLoader();
25 }
26
27 public bool LoadPlugin(string pluginFile)
28 {
29 bool loaded = this.TES3PluginLoader.Load();
30
31 if (loaded)
32 {
33 foreach (KeyValuePair<string,ClothingEntry> entry in this.TES3PluginLoader.ClothingSection.ClothingEntries)
34 {
35 lstClothingEntries.Items.Add(entry.Key);
36 }
37 MessageBox.Show("Successfully Loaded Plugin: " + pluginFile, "Successfully Loaded File:", MessageBoxButtons.OK, MessageBoxIcon.Information);
38 }
39
40 return loaded;
41 }
42
43
44 private void mnuItemExit_Click(object sender, EventArgs e)
45 {
46 this.Close();
47 }
48
49 private void mnuItemOpenPlugin_Click(object sender, EventArgs e)
50 {
51 this.log.Clear();
52 PluginLoader.InitialDirectory = MorrowindDataFilesPath;
53 DialogResult result = PluginLoader.ShowDialog();
54 string PluginFile = PluginLoader.FileName;
55 if (result != DialogResult.OK) return;
56 //MessageBox.Show("Load Plugin: " + PluginLoader.FileName);
57 this.TES3PluginLoader = new TES3PluginLoader(PluginFile, this.log);
58 if (!this.LoadPlugin(PluginFile))
59 {
60 MessageBox.Show("Failed to Load Plugin: " + PluginFile + "\n\nReason: \n\n" + this.TES3PluginLoader.PluginLoadFailureReason, "Failed to Load File:", MessageBoxButtons.OK, MessageBoxIcon.Error);
61 }
62 }
63
64 private void lstClothingEntries_SelectedIndexChanged(object sender, EventArgs e)
65 {
66 ClothingEntry chosen_entry = null;
67
68 foreach (KeyValuePair<string, ClothingEntry> entry in this.TES3PluginLoader.ClothingSection.ClothingEntries)
69 {
70 string key = lstClothingEntries.Items[lstClothingEntries.SelectedIndex].ToString();
71 if (key == entry.Key) { chosen_entry = entry.Value; break; }
72 }
73 if (chosen_entry == null) return;
74 }
75 }
76 }

  ViewVC Help
Powered by ViewVC 1.1.22