Exemplo n.º 1
0
        private void testFilterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog FD1 = new OpenFileDialog()
            {
                Multiselect = true,
                Filter      = "All SL2 Scripts|*.sl2",
                Title       = "Select Scripts to Test"
            };

            if (FD1.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            byte[] Ori = File.ReadAllBytes(FD1.FileName);

            SpriteTL TST = new SpriteTL(Ori);

            byte[] Edt = TST.Export(TST.Import());

            SpriteListEditor tst1 = new SpriteListEditor(Ori);
            SpriteListEditor tst2 = new SpriteListEditor(Edt);

            System.Diagnostics.Debug.Assert(tst1.Import() == tst2.Import());
            string Dir = AppDomain.CurrentDomain.BaseDirectory;

            File.WriteAllText(Dir + "f1.txt", tst1.Import().Replace("[", "[\n\r").Replace("]", "]\n\r"), System.Text.Encoding.UTF8);
            File.WriteAllText(Dir + "f2.txt", tst2.Import().Replace("[", "[\n\r").Replace("]", "]\n\r"), System.Text.Encoding.UTF8);
        }
Exemplo n.º 2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.Filter = "All SL2 files|*.sl2";
            if (fd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            byte[] file = File.ReadAllBytes(fd.FileName);
            Editor = new SpriteTL(file);
            listBox1.Items.Clear();
            foreach (string str in Editor.Import())
            {
                listBox1.Items.Add(str);
            }
        }