コード例 #1
0
ファイル: Form1.cs プロジェクト: marcussacana/CatSceneEditor
        private void extractToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.Filter = "All Int Packgets|*.int";
            if (fd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            int    i      = 2;
            string OutDir = fd.FileName + "~\\";

            while (Directory.Exists(OutDir))
            {
                OutDir = fd.FileName + string.Format("~{0}\\", i++);
            }
            Directory.CreateDirectory(OutDir);

            Stream Reader = new StreamReader(fd.FileName).BaseStream;

            FileEntry[] Entries = Int.Open(Reader);

            foreach (FileEntry Entry in Entries)
            {
                Stream Output = new StreamWriter(OutDir + Entry.FileName).BaseStream;
                CopyStream(Entry.Content, Output);
                Entry.Content.Close();
                Output.Close();
            }

            Reader.Close();
        }