Exemplo n.º 1
0
 private void saveIntoDLCToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (!IsFromDLC || inDLCFilename == null || inDLCFilename.Length == 0 || DLCPath == null || DLCPath.Length == 0)
         return;
     SaveFileDialog d = new SaveFileDialog();
     d.Filter = "*.sfar|*.sfar";
     if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         DLCDialog dlc = new DLCDialog();
         dlc.Init(d.FileName);
         dlc.Show();
         while (dlc != null && dlc.Result == null)
             Application.DoEvents();
         int result = (int)dlc.Result;
         if (result != -1)
         {
             DLCPackage p = dlc.dlc;
             string path = Path.GetDirectoryName(Application.ExecutablePath) + "\\exec\\data.pcc";
             pcc.altSaveToFile(path, true);
             byte[] buff = File.ReadAllBytes(path);
             p.ReplaceEntry(buff, dlc.Objects[result]);
             MessageBox.Show("Done.");
         }
         dlc.Close();
     }
 }
Exemplo n.º 2
0
 private void loadFromDLCToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OpenFileDialog d = new OpenFileDialog();
     d.Filter = "*.sfar|*.sfar";
     if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         DLCDialog dlc = new DLCDialog();
         dlc.Init(d.FileName);
         dlc.Show();
         while (dlc != null && dlc.Result == null)
             Application.DoEvents();
         int result = (int)dlc.Result;
         if (result != -1)
         {
             DLCPackage p = dlc.dlc;
             string path = Path.GetDirectoryName(Application.ExecutablePath) + "\\exec\\data.pcc";
             DLCPath = d.FileName;
             inDLCFilename = dlc.listBox1.Items[result].ToString();
             FileStream fs = new FileStream(path,FileMode.Create,FileAccess.Write);
             MemoryTributary mem = p.DecompressEntry(dlc.Objects[result]);
             fs.Write(mem.ToArray(), 0, (int)mem.Length);
             fs.Close();
             
             LoadFile(path, true);
         }
         dlc.Close();
         
     }
 }