示例#1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.Filter = "All Script Files|*.xbx; *.ks";
            if (fd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            FilterMode = fd.FileName.ToLower().EndsWith(".ks");
            byte[]   Script = File.ReadAllBytes(fd.FileName);
            string[] Strings;

            if (FilterMode)
            {
                Filter  = new KS(Script);
                Strings = Filter.Import();
            }
            else
            {
                Editor  = new XBX(Script);
                Strings = Editor.Import();
            }

            listBox1.Items.Clear();
            foreach (string str in Strings)
            {
                listBox1.Items.Add(str);
            }
        }