Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string output = Environment.CurrentDirectory + @"\" + "Output";

            if (!Directory.Exists(output))
            {
                Directory.CreateDirectory(output);
            }

            this.openFileDialog1.ShowDialog();
            string path = this.openFileDialog1.FileName;

            D2pFile file = new D2pFile(path);

            var entry = file.GetEntry("music/20100.mp3");

            var frostBottom = File.ReadAllBytes(Environment.CurrentDirectory + "/test.mp3");

            entry.ModifyEntry(frostBottom);

            file.SaveAs(Environment.CurrentDirectory + "/test.d2p");

            return;

            file.ExtractAllFiles(output, true, false);

            output = output + "/SWF/";

            if (!Directory.Exists(output))
            {
                Directory.CreateDirectory(output);
            }

            foreach (var f in Directory.GetFiles(Environment.CurrentDirectory + @"\" + "Output"))
            {
                if (Path.GetExtension(f) == ".swl")
                {
                    SwlFile swl = new SwlFile(f);

                    swl.ExtractSwf(output);
                }
            }
        }
Exemple #2
0
        private static void ThreadStartingPoint(string filename, Point mousePosition)
        {
            SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());

            if (!File.Exists(filename))
            {
                return;
            }

            Window window;

            switch (Path.GetExtension(filename))
            {
            case ".d2p":
                window = new D2PEditor(new D2pFile(filename));
                break;

            case ".d2i":
                window = new D2IEditor(new D2IFile(filename));
                break;

            case ".d2o":
                window = new D2OEditor(filename);
                break;

            case ".d2os":
                window = new D2OEditor(filename);
                break;

            case ".meta":
                window = new MetaEditor(new MetaFile(filename));
                break;

            case ".dlm":
                window = new MapEditor(new DlmReader(filename, Settings.LoaderSettings.GenericMapDecryptionKey));
                break;

            case ".swl":
                var file    = new SwlFile(filename);
                var swfName = filename.Replace(".swl", ".swf");
                var swfFile = File.Create(swfName);

                swfFile.Write(file.SwfData, 0, file.SwfData.Length);

                swfFile.Dispose();
                file.Dispose();
                return;

            case ".swf":
                var swf = new SwfReader(filename);
                swf.ToSwl();
                swf.Dispose();
                return;

            default:
                return;
            }


            window.WindowStartupLocation = WindowStartupLocation.Manual;
            window.Left = mousePosition.X - window.Width / 2;
            window.Top  = mousePosition.Y - window.Height / 2;
            window.Show();
            System.Windows.Threading.Dispatcher.Run();
        }