コード例 #1
0
ファイル: Form1.cs プロジェクト: Tarendai/ntai
 public Form1()
 {
     this.VERSION = 12;
     this.currentselected = "";
     Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");
     this.InitializeComponent();
     this.mod = new CMod();
     this.buildtree = new CBuildtree(this);
     this.mod.f = this;
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Tarendai/ntai
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.taskActionsGroupBox.Enabled = false;
            try
            {
                //fix for multiple load problem
                this.mod = new CMod();
                this.buildtree = new CBuildtree(this);
                this.mod.f = this;
                this.universalkeywordsList.Items.Clear();
                this.unitkeywords.Items.Clear();
                this.Units.Items.Clear();
                this.currentbuildqueue.Items.Clear();

                string text1 = "";
                this.openFileDialog.ShowDialog();
                if (System.IO.File.Exists(this.openFileDialog.FileName))
                {
                    String[] path = openFileDialog.FileName.Split('\\');
                    configfile1 = path[path.Length-1];//this.openFileDialog.FileName;
                    Stream stream1 = this.openFileDialog.OpenFile();
                    StreamReader reader1 = new StreamReader(stream1);
                    text1 = reader1.ReadToEnd();
                    reader1.Close();
                    TdfParser parser1 = new TdfParser(text1);
                    string[] textArray1 = this.openFileDialog.FileName.Split(new char[] { '\\' });
                    string text2 = "";
                    for (int num1 = 0; num1 < textArray1.Length; num1++)
                    {
                        if ((num1 + 1) >= textArray1.Length)
                        {
                            break;
                        }
                        text2 = text2 + textArray1[num1] + "/";
                    }

                    String s = parser1.RootSection.GetStringValue("foobar", @"ntai\modconfig");
                    if(s.Equals("foobar")){
                        MessageBox.Show("If you're trying to open a config inside the /AI/NTai/configs/ folder then your choosing the wrong file. Please select the file in the /AI/NTai/ folder", "Access exception.");
                        return;
                    }
                    if (this.buildtree.Load(text2 + parser1.RootSection.GetStringValue(@"ntai\modconfig")))
                    {
                        configfile2 = parser1.RootSection.GetStringValue(@"ntai\modconfig");
                        this.mod.LoadMod(text2 + parser1.RootSection.GetStringValue(@"ntai\learndata"));
                        configfile3 = parser1.RootSection.GetStringValue(@"ntai\learndata");
                        this.mod.modname = parser1.RootSection.GetStringValue(@"ntai\modname");
                        this.modlabel.Text = this.mod.modname + " is loaded";
                        ArrayList list1 = this.buildtree.keywords.GetUniversalKeywords();
                        foreach (string text3 in list1)
                        {
                            this.universalkeywordsList.Items.Add(text3);
                        }
                        ArrayList list2 = new ArrayList();
                        foreach (string text4 in this.mod.units)
                        {
                            list2.Add(text4 + " - " + this.mod.human_names[text4] + " " + this.mod.descriptions[text4]);
                        }
                        this.buildtree.keywords.AddCollection(this.mod.units, EWordType.e_unitname);
                        foreach (string text5 in list2)
                        {
                            this.unitkeywords.Items.Add(text5);
                            this.Units.Items.Add(text5);
                        }
                        this.currentbuildqueue.Items.Clear();
                        foreach (string text6 in this.buildtree.tasklists.Keys)
                        {
                            this.currentbuildqueue.Items.Add(text6);
                        }
                    }
                    else
                    {
                        this.modlabel.Text = this.mod.modname + " FAILED to load";
                    }
                }
            }
            catch (UnauthorizedAccessException)
            {
                MessageBox.Show("If you're trying to open a config inside the /AI/NTai/configs/ folder then your choosing the wrong file. Please select the file in the /AI/NTai/ folder", "Access exception.");
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: peous/spring
 public Form1()
 {
     this.VERSION = 12;
     this.currentselected = "";
     Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");
     this.InitializeComponent();
     Assembly _assembly = Assembly.GetExecutingAssembly();
     StreamReader _textStreamReader = new StreamReader(_assembly.GetManifestResourceStream("NTaiToolkit.TextFile1.txt"));
     string helpText = _textStreamReader.ReadToEnd();
     this.richTextBox1.Text = helpText;
     this.mod = new CMod();
     this.buildtree = new CBuildtree(this);
     this.mod.f = this;
 }