Skip to content

Commit

Permalink
Merge pull request #148 from Lapig/master
Browse files Browse the repository at this point in the history
Fallback for wz saving and clipboard cleanup
  • Loading branch information
lastbattle authored Oct 3, 2021
2 parents 797ce07 + 0f50f96 commit fc1deef
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion HaCreator/HaCreator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@
<Version>2.0.0</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
<Version>13.0.1</Version>
</PackageReference>
<PackageReference Include="SharpDX">
<Version>4.2.0</Version>
Expand Down
1 change: 1 addition & 0 deletions HaRepacker/GUI/ContextMenuManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ public ContextMenuStrip CreateMenu(WzNode node, WzObject Tag)
else if (Tag is WzFile)
{
toolStripmenuItems.Add(AddDirsSubMenu);
toolStripmenuItems.Add(Rename);
toolStripmenuItems.Add(SaveFile);
toolStripmenuItems.Add(Unload);
toolStripmenuItems.Add(Reload);
Expand Down
6 changes: 6 additions & 0 deletions HaRepacker/GUI/Panels/MainPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,12 @@ public void DoCopy()
if (!Warning.Warn(Properties.Resources.MainConfirmCopy) || bPasteTaskActive)
return;

foreach (WzObject obj in clipboard)
{
//this causes minor weirdness with png's in copied nodes but otherwise memory is not free'd
obj.Dispose();
}

clipboard.Clear();

foreach (WzNode node in DataTree.SelectedNodes)
Expand Down
10 changes: 8 additions & 2 deletions HaRepacker/GUI/SaveForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,14 @@ private void SaveButton_Click(object sender, EventArgs e)
{
wzf.SaveToDisk(dialog.FileName + "$tmp", wzMapleVersionSelected);
wzNode.DeleteWzNode();
File.Delete(dialog.FileName);
File.Move(dialog.FileName + "$tmp", dialog.FileName);
try
{
File.Delete(dialog.FileName);
File.Move(dialog.FileName + "$tmp", dialog.FileName);
}catch(IOException ex)
{
MessageBox.Show("Handle error overwriting WZ file", HaRepacker.Properties.Resources.Error);
}
}
else
{
Expand Down

0 comments on commit fc1deef

Please sign in to comment.