82 lines
2.4 KiB
C#
82 lines
2.4 KiB
C#
using LibW4M;
|
|
using LibW4M.Data.WeaponFactory;
|
|
using LibXom;
|
|
using LibXom.Data;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace W4Gui
|
|
{
|
|
public partial class Main : Form
|
|
{
|
|
private const string defaultTitle = "Worms 4: Mayhem! (Save Editor)";
|
|
public Main()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void W4Gui_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void openToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
OpenFileDialog fd = new OpenFileDialog();
|
|
fd.Filter = "Worms 4: Mayhem Save File|*.xom";
|
|
fd.Title = "Open Worms 4 Save File";
|
|
if(fd.ShowDialog() == DialogResult.OK)
|
|
{
|
|
DataManager.SaveFile = new W4SaveFile(XomReader.ReadXomFile(fd.FileName));
|
|
|
|
this.mainTabControl.Enabled = true;
|
|
this.saveToolStripMenuItem.Enabled = true;
|
|
this.convertToolStripMenuItem.Enabled = true;
|
|
|
|
this.Text = defaultTitle + " [" + fd.FileName + "]";
|
|
|
|
DataManager.LoadAll();
|
|
}
|
|
}
|
|
|
|
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
SaveFileDialog fd = new SaveFileDialog();
|
|
fd.Filter = "Worms 4: Mayhem Save File|*.xom";
|
|
fd.Title = "Save Worms 4 Save File";
|
|
fd.FileName = "SaveGame.xom";
|
|
if (fd.ShowDialog() == DialogResult.OK)
|
|
{
|
|
this.mainTabControl.Enabled = false;
|
|
|
|
DataManager.SaveAll();
|
|
DataManager.SaveFile.Save(fd.FileName);
|
|
|
|
this.mainTabControl.Enabled = true;
|
|
}
|
|
}
|
|
|
|
private void extractAllXomContainersToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
FolderBrowserDialog fbd = new FolderBrowserDialog();
|
|
fbd.Description = "Select folder to extract XomContainers too.";
|
|
if(fbd.ShowDialog() == DialogResult.OK)
|
|
{
|
|
|
|
this.mainTabControl.Enabled = false;
|
|
|
|
DataManager.SaveFile.ExtractAllContainers(fbd.SelectedPath);
|
|
|
|
this.mainTabControl.Enabled = true;
|
|
}
|
|
}
|
|
}
|
|
}
|