Skip to content

Commit

Permalink
[HaCreator] QOL - selection of WZ file(s) to save during repacking of WZ
Browse files Browse the repository at this point in the history
  • Loading branch information
lastbattle committed May 23, 2023
1 parent 7fe95dd commit 4f7b37f
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 44 deletions.
77 changes: 41 additions & 36 deletions HaCreator/GUI/Repack.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 21 additions & 8 deletions HaCreator/GUI/Repack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,14 @@ public Repack()
{
InitializeComponent();

StringBuilder repackTxt = new StringBuilder("Files to repack:");
repackTxt.Append(Environment.NewLine);

foreach (WzFile wzf in Program.WzManager.WzFileList)
{
Program.WzManager.SetWzFileUpdated(wzf);

toRepack.Add(wzf);

repackTxt.Append(wzf.Name);
repackTxt.Append(Environment.NewLine);

checkedListBox_changedFiles.Items.Add(wzf.Name, CheckState.Checked);
}
infoLabel.Text = repackTxt.ToString();
}

/// <summary>
Expand Down Expand Up @@ -94,9 +89,13 @@ private void ShowErrorMessage(string data)
MessageBox.Show(data, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

/// <summary>
/// Change the repack state label
/// </summary>
/// <param name="state"></param>
private void ChangeRepackState(string state)
{
stateLabel.Text = state;
label_repackState.Text = state;
}

/// <summary>
Expand Down Expand Up @@ -192,6 +191,7 @@ private void RepackerThread()
{
ChangeRepackState("Saving XMLs...");
});

foreach (WzImage img in Program.WzManager.WzUpdatedImageList)
{
try
Expand All @@ -213,6 +213,19 @@ private void RepackerThread()
// Save WZ Files
foreach (WzFile wzf in toRepack)
{
// Check if this wz file is selected and can be saved
bool bCanSave = false;
foreach (string checkedItemName in checkedListBox_changedFiles.CheckedItems) { // no uncheckedItems list :(
if (checkedItemName == wzf.Name) {
bCanSave = true;
break;
}
}
if (!bCanSave)
continue;

// end

Invoke((Action)delegate
{
ChangeRepackState("Saving " + wzf.Name + "...");
Expand Down

1 comment on commit 4f7b37f

@lastbattle
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Untitled

Please sign in to comment.