Skip to content

Commit

Permalink
Fixed issues exporting selection of WzFile in DataTree to XML
Browse files Browse the repository at this point in the history
  • Loading branch information
eaxvac committed Jun 3, 2018
1 parent 3381b3b commit 2e04d7f
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions HaRepacker/GUI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,14 @@ private void encryptionBox_SelectedIndexChanged(object sender, EventArgs e)

private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
using (OpenFileDialog dialog = new OpenFileDialog() {
using (OpenFileDialog dialog = new OpenFileDialog()
{
Title = HaRepacker.Properties.Resources.SelectWz,
Filter = string.Format("{0}|*.wz",
HaRepacker.Properties.Resources.WzFilter),
Multiselect = true
}) {
})
{

if (dialog.ShowDialog() != DialogResult.OK)
return;
Expand Down Expand Up @@ -632,8 +634,14 @@ private void privateServerToolStripMenuItem_Click(object sender, EventArgs e)
List<WzImage> imgs = new List<WzImage>();
foreach (WzNode node in MainPanel.DataTree.SelectedNodes)
{
if (node.Tag is WzDirectory) dirs.Add((WzDirectory)node.Tag);
else if (node.Tag is WzImage) imgs.Add((WzImage)node.Tag);
if (node.Tag is WzDirectory)
dirs.Add((WzDirectory)node.Tag);
else if (node.Tag is WzImage)
imgs.Add((WzImage)node.Tag);
else if (node.Tag is WzFile)
{
dirs.Add(((WzFile)node.Tag).WzDirectory);
}
}
WzClassicXmlSerializer serializer = new WzClassicXmlSerializer(UserSettings.Indentation, UserSettings.LineBreakType, false);
threadDone = false;
Expand All @@ -660,6 +668,10 @@ private void classicToolStripMenuItem_Click(object sender, EventArgs e)
dirs.Add((WzDirectory)node.Tag);
else if (node.Tag is WzImage)
imgs.Add((WzImage)node.Tag);
else if (node.Tag is WzFile)
{
dirs.Add(((WzFile)node.Tag).WzDirectory);
}
}
WzClassicXmlSerializer serializer = new WzClassicXmlSerializer(UserSettings.Indentation, UserSettings.LineBreakType, true);
threadDone = false;
Expand All @@ -670,7 +682,8 @@ private void classicToolStripMenuItem_Click(object sender, EventArgs e)

private void newToolStripMenuItem1_Click(object sender, EventArgs e)
{
SaveFileDialog dialog = new SaveFileDialog() {
SaveFileDialog dialog = new SaveFileDialog()
{
Title = HaRepacker.Properties.Resources.SelectOutXml,
Filter = string.Format("{0}|*.xml", HaRepacker.Properties.Resources.XmlFilter)
};
Expand All @@ -680,8 +693,12 @@ private void newToolStripMenuItem1_Click(object sender, EventArgs e)

List<WzObject> objs = new List<WzObject>();
foreach (WzNode node in MainPanel.DataTree.SelectedNodes)
{
if (node.Tag is WzObject)
{
objs.Add((WzObject)node.Tag);
}
}
WzNewXmlSerializer serializer = new WzNewXmlSerializer(UserSettings.Indentation, UserSettings.LineBreakType);
threadDone = false;
runningThread = new Thread(new ParameterizedThreadStart(RunWzObjExtraction));
Expand Down Expand Up @@ -1027,7 +1044,7 @@ private void WzImporterThread(object param)
if (!successfullyParsedImage)
{
MessageBox.Show(
string.Format(HaRepacker.Properties.Resources.MainErrorImportingWzImageFile, file),
string.Format(HaRepacker.Properties.Resources.MainErrorImportingWzImageFile, file),
HaRepacker.Properties.Resources.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
continue;
}
Expand Down Expand Up @@ -1065,7 +1082,8 @@ private void iMGToolStripMenuItem2_Click(object sender, EventArgs e)
if (!(wzFile is WzFile))
return;

OpenFileDialog dialog = new OpenFileDialog() {
OpenFileDialog dialog = new OpenFileDialog()
{
Title = HaRepacker.Properties.Resources.SelectWzImg,
Filter = string.Format("{0}|*.img", HaRepacker.Properties.Resources.WzImgFilter),
Multiselect = true
Expand All @@ -1086,7 +1104,7 @@ private void iMGToolStripMenuItem2_Click(object sender, EventArgs e)

runningThread = new Thread(new ParameterizedThreadStart(WzImporterThread));
runningThread.Start(
new object[]
new object[]
{
deserializer, dialog.FileNames, MainPanel.DataTree.SelectedNode, iv
});
Expand Down

0 comments on commit 2e04d7f

Please sign in to comment.