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); } } }
private void button2_Click(object sender, EventArgs e) { this.openFileDialog1.Filter = "Fichier MP3 | *.mp3"; this.openFileDialog1.ShowDialog(); string path = this.openFileDialog1.FileName; if (path != string.Empty) { try { D2pFile file = new D2pFile(Path.GetDirectoryName(this.D2PFile.FilePath) + "/" + this.ContainerName); var data = File.ReadAllBytes(path); file.GetEntry(this.EntryName).ModifyEntry(data); file.Save(); MessageBox.Show("Le fichier a bien été modifié."); this.Close(); } catch { MessageBox.Show("Impossible de modifier le fichier."); } } }