Skip to content

Commit

Permalink
Disable savegame destination boxes during writing
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianOzelRose committed Mar 30, 2024
1 parent 2e768e3 commit cf1c03d
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 44 deletions.
30 changes: 17 additions & 13 deletions TombExtract/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private void CreateBackup()
}
}

private void DisableButtons()
private void DisableControls()
{
btnExtractTR1.Enabled = false;
btnExtractTR2.Enabled = false;
Expand All @@ -86,6 +86,10 @@ private void DisableButtons()
cklSourceSavegamesTR2.Enabled = false;
cklSourceSavegamesTR3.Enabled = false;

lstDestinationSavegamesTR1.Enabled = false;
lstDestinationSavegamesTR2.Enabled = false;
lstDestinationSavegamesTR3.Enabled = false;

cmbConversionTR1.Enabled = false;
cmbConversionTR2.Enabled = false;
cmbConversionTR3.Enabled = false;
Expand Down Expand Up @@ -441,7 +445,7 @@ private void ExtractSavegamesTR1()
CreateBackup();
}

DisableButtons();
DisableControls();

progressForm = new ProgressForm();
progressForm.Owner = this;
Expand All @@ -451,9 +455,9 @@ private void ExtractSavegamesTR1()

TR1.WriteSavegamesToDestination(selectedSavegames, cklSourceSavegamesTR1, cklSourceSavegamesTR2, cklSourceSavegamesTR3,
btnExtractTR1, btnExtractTR2, btnExtractTR3, btnSelectAllTR1, btnSelectAllTR2, btnSelectAllTR3, btnBrowseSourceFile,
btnBrowseDestinationFile, chkBackupOnWrite, lstDestinationSavegamesTR1, tsmiBrowseSourceFile, tsmiBrowseDestinationFile,
slblStatus, tsmiExtract, cmbConversionTR1, cmbConversionTR2, cmbConversionTR3, btnManageSlotsTR1, btnManageSlotsTR2,
btnManageSlotsTR3, tsmiBackupDestinationFile);
btnBrowseDestinationFile, chkBackupOnWrite, lstDestinationSavegamesTR1, lstDestinationSavegamesTR2, lstDestinationSavegamesTR3,
tsmiBrowseSourceFile, tsmiBrowseDestinationFile, slblStatus, tsmiExtract, cmbConversionTR1, cmbConversionTR2, cmbConversionTR3,
btnManageSlotsTR1, btnManageSlotsTR2, btnManageSlotsTR3, tsmiBackupDestinationFile);
}

private void ExtractSavegamesTR2()
Expand Down Expand Up @@ -509,7 +513,7 @@ private void ExtractSavegamesTR2()
CreateBackup();
}

DisableButtons();
DisableControls();

progressForm = new ProgressForm();
progressForm.Owner = this;
Expand All @@ -519,9 +523,9 @@ private void ExtractSavegamesTR2()

TR2.WriteSavegamesToDestination(selectedSavegames, cklSourceSavegamesTR1, cklSourceSavegamesTR2, cklSourceSavegamesTR3,
btnExtractTR1, btnExtractTR2, btnExtractTR3, btnSelectAllTR1, btnSelectAllTR2, btnSelectAllTR3, btnBrowseSourceFile,
btnBrowseDestinationFile, chkBackupOnWrite, lstDestinationSavegamesTR2, tsmiBrowseSourceFile, tsmiBrowseDestinationFile,
slblStatus, tsmiExtract, cmbConversionTR1, cmbConversionTR2, cmbConversionTR3, btnManageSlotsTR1, btnManageSlotsTR2,
btnManageSlotsTR3, tsmiBackupDestinationFile);
btnBrowseDestinationFile, chkBackupOnWrite, lstDestinationSavegamesTR1, lstDestinationSavegamesTR2, lstDestinationSavegamesTR3,
tsmiBrowseSourceFile, tsmiBrowseDestinationFile, slblStatus, tsmiExtract, cmbConversionTR1, cmbConversionTR2, cmbConversionTR3,
btnManageSlotsTR1, btnManageSlotsTR2, btnManageSlotsTR3, tsmiBackupDestinationFile);
}

private void ExtractSavegamesTR3()
Expand Down Expand Up @@ -577,7 +581,7 @@ private void ExtractSavegamesTR3()
CreateBackup();
}

DisableButtons();
DisableControls();

progressForm = new ProgressForm();
progressForm.Owner = this;
Expand All @@ -587,9 +591,9 @@ private void ExtractSavegamesTR3()

TR3.WriteSavegamesToDestination(selectedSavegames, cklSourceSavegamesTR1, cklSourceSavegamesTR2, cklSourceSavegamesTR3,
btnExtractTR1, btnExtractTR2, btnExtractTR3, btnSelectAllTR1, btnSelectAllTR2, btnSelectAllTR3, btnBrowseSourceFile,
btnBrowseDestinationFile, chkBackupOnWrite, lstDestinationSavegamesTR3, tsmiBrowseSourceFile, tsmiBrowseDestinationFile,
slblStatus, tsmiExtract, cmbConversionTR1, cmbConversionTR2, cmbConversionTR3, btnManageSlotsTR1, btnManageSlotsTR2,
btnManageSlotsTR3, tsmiBackupDestinationFile);
btnBrowseDestinationFile, chkBackupOnWrite, lstDestinationSavegamesTR1, lstDestinationSavegamesTR2, lstDestinationSavegamesTR3,
tsmiBrowseSourceFile, tsmiBrowseDestinationFile, slblStatus, tsmiExtract, cmbConversionTR1, cmbConversionTR2, cmbConversionTR3,
btnManageSlotsTR1, btnManageSlotsTR2, btnManageSlotsTR3, tsmiBackupDestinationFile);
}

private void btnExtractTR1_Click(object sender, EventArgs e)
Expand Down
25 changes: 16 additions & 9 deletions TombExtract/TR1Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,10 @@ public void WriteSavegamesToDestination(List<Savegame> savegames, CheckedListBox
CheckedListBox cklSourceSavegamesTR2, CheckedListBox cklSourceSavegamesTR3, Button btnExtractTR1,
Button btnExtractTR2, Button btnExtractTR3, Button btnSelectAllTR1, Button btnSelectAllTR2, Button btnSelectAllTR3,
Button btnBrowseSourceFile, Button btnBrowseDestinationFile, CheckBox chkBackupOnWrite, ListBox lstDestinationSavegamesTR1,
ToolStripMenuItem tsmiBrowseSourceFile, ToolStripMenuItem tsmiBrowseDestinationFile, ToolStripStatusLabel slblStatus,
ToolStripMenuItem tsmiExtract, ComboBox cmbConversionTR1, ComboBox cmbConversionTR2, ComboBox cmbConversionTR3,
Button btnManageSlotsTR1, Button btnManageSlotsTR2, Button btnManageSlotsTR3, ToolStripMenuItem tsmiBackupDestinationFile)
ListBox lstDestinationSavegamesTR2, ListBox lstDestinationSavegamesTR3, ToolStripMenuItem tsmiBrowseSourceFile,
ToolStripMenuItem tsmiBrowseDestinationFile, ToolStripStatusLabel slblStatus, ToolStripMenuItem tsmiExtract,
ComboBox cmbConversionTR1, ComboBox cmbConversionTR2, ComboBox cmbConversionTR3, Button btnManageSlotsTR1,
Button btnManageSlotsTR2, Button btnManageSlotsTR3, ToolStripMenuItem tsmiBackupDestinationFile)
{
isWriting = true;

Expand Down Expand Up @@ -252,9 +253,10 @@ public void WriteSavegamesToDestination(List<Savegame> savegames, CheckedListBox

bgWorker.RunWorkerCompleted += (sender, e) => bgWorker_RunWorkerCompleted(sender, e, cklSourceSavegamesTR1, cklSourceSavegamesTR2,
cklSourceSavegamesTR3, btnExtractTR1, btnExtractTR2, btnExtractTR3, btnSelectAllTR1, btnSelectAllTR2, btnSelectAllTR3,
btnBrowseSourceFile, btnBrowseDestinationFile, chkBackupOnWrite, lstDestinationSavegamesTR1, tsmiBrowseSourceFile,
tsmiBrowseDestinationFile, slblStatus, tsmiExtract, cmbConversionTR1, cmbConversionTR2, cmbConversionTR3,
btnManageSlotsTR1, btnManageSlotsTR2, btnManageSlotsTR3, tsmiBackupDestinationFile);
btnBrowseSourceFile, btnBrowseDestinationFile, chkBackupOnWrite, lstDestinationSavegamesTR1, lstDestinationSavegamesTR2,
lstDestinationSavegamesTR3, tsmiBrowseSourceFile, tsmiBrowseDestinationFile, slblStatus, tsmiExtract,
cmbConversionTR1, cmbConversionTR2, cmbConversionTR3, btnManageSlotsTR1, btnManageSlotsTR2, btnManageSlotsTR3,
tsmiBackupDestinationFile);

bgWorker.ProgressChanged += UpdateProgressBar;

Expand All @@ -268,9 +270,10 @@ private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventA
CheckedListBox cklSourceSavegamesTR2, CheckedListBox cklSourceSavegamesTR3, Button btnExtractTR1, Button btnExtractTR2,
Button btnExtractTR3, Button btnSelectAllTR1, Button btnSelectAllTR2, Button btnSelectAllTR3,
Button btnBrowseSourceFile, Button btnBrowseDestinationFile, CheckBox chkBackupOnWrite, ListBox lstDestinationSavegamesTR1,
ToolStripMenuItem tsmiBrowseSourceFile, ToolStripMenuItem tsmiBrowseDestinationFile, ToolStripStatusLabel slblStatus,
ToolStripMenuItem tsmiExtract, ComboBox cmbConversionTR1, ComboBox cmbConversionTR2, ComboBox cmbConversionTR3,
Button btnManageSlotsTR1, Button btnManageSlotsTR2, Button btnManageSlotsTR3, ToolStripMenuItem tsmiBackupDestinationFile)
ListBox lstDestinationSavegamesTR2, ListBox lstDestinationSavegamesTR3, ToolStripMenuItem tsmiBrowseSourceFile,
ToolStripMenuItem tsmiBrowseDestinationFile, ToolStripStatusLabel slblStatus, ToolStripMenuItem tsmiExtract,
ComboBox cmbConversionTR1, ComboBox cmbConversionTR2, ComboBox cmbConversionTR3, Button btnManageSlotsTR1,
Button btnManageSlotsTR2, Button btnManageSlotsTR3, ToolStripMenuItem tsmiBackupDestinationFile)
{
progressForm.Close();

Expand Down Expand Up @@ -310,6 +313,10 @@ private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventA
cklSourceSavegamesTR2.Enabled = true;
cklSourceSavegamesTR3.Enabled = true;

lstDestinationSavegamesTR1.Enabled = true;
lstDestinationSavegamesTR2.Enabled = true;
lstDestinationSavegamesTR3.Enabled = true;

cmbConversionTR1.Enabled = true;
cmbConversionTR2.Enabled = true;
cmbConversionTR3.Enabled = true;
Expand Down
28 changes: 17 additions & 11 deletions TombExtract/TR2Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,11 @@ public int GetNumOverwrites(List<Savegame> savegames)
public void WriteSavegamesToDestination(List<Savegame> savegames, CheckedListBox cklSourceSavegamesTR1,
CheckedListBox cklSourceSavegamesTR2, CheckedListBox cklSourceSavegamesTR3, Button btnExtractTR1,
Button btnExtractTR2, Button btnExtractTR3, Button btnSelectAllTR1, Button btnSelectAllTR2, Button btnSelectAllTR3,
Button btnBrowseSourceFile, Button btnBrowseDestinationFile, CheckBox chkBackupOnWrite, ListBox lstDestinationSavegamesTR2,
ToolStripMenuItem tsmiBrowseSourceFile, ToolStripMenuItem tsmiBrowseDestinationFile, ToolStripStatusLabel slblStatus,
ToolStripMenuItem tsmiExtract, ComboBox cmbConversionTR1, ComboBox cmbConversionTR2, ComboBox cmbConversionTR3,
Button btnManageSlotsTR1, Button btnManageSlotsTR2, Button btnManageSlotsTR3, ToolStripMenuItem tsmiBackupDestinationFile)
Button btnBrowseSourceFile, Button btnBrowseDestinationFile, CheckBox chkBackupOnWrite, ListBox lstDestinationSavegamesTR1,
ListBox lstDestinationSavegamesTR2, ListBox lstDestinationSavegamesTR3, ToolStripMenuItem tsmiBrowseSourceFile,
ToolStripMenuItem tsmiBrowseDestinationFile, ToolStripStatusLabel slblStatus, ToolStripMenuItem tsmiExtract,
ComboBox cmbConversionTR1, ComboBox cmbConversionTR2, ComboBox cmbConversionTR3, Button btnManageSlotsTR1,
Button btnManageSlotsTR2, Button btnManageSlotsTR3, ToolStripMenuItem tsmiBackupDestinationFile)
{
isWriting = true;

Expand Down Expand Up @@ -255,9 +256,9 @@ public void WriteSavegamesToDestination(List<Savegame> savegames, CheckedListBox

bgWorker.RunWorkerCompleted += (sender, e) => bgWorker_RunWorkerCompleted(sender, e, cklSourceSavegamesTR1, cklSourceSavegamesTR2,
cklSourceSavegamesTR3, btnExtractTR1, btnExtractTR2, btnExtractTR3, btnSelectAllTR1, btnSelectAllTR2, btnSelectAllTR3,
btnBrowseSourceFile, btnBrowseDestinationFile, chkBackupOnWrite, lstDestinationSavegamesTR2, tsmiBrowseSourceFile,
tsmiBrowseDestinationFile, slblStatus, tsmiExtract, cmbConversionTR1, cmbConversionTR2, cmbConversionTR3, btnManageSlotsTR1,
btnManageSlotsTR2, btnManageSlotsTR3, tsmiBackupDestinationFile);
btnBrowseSourceFile, btnBrowseDestinationFile, chkBackupOnWrite, lstDestinationSavegamesTR1, lstDestinationSavegamesTR2,
lstDestinationSavegamesTR3, tsmiBrowseSourceFile, tsmiBrowseDestinationFile, slblStatus, tsmiExtract, cmbConversionTR1,
cmbConversionTR2, cmbConversionTR3, btnManageSlotsTR1, btnManageSlotsTR2, btnManageSlotsTR3, tsmiBackupDestinationFile);

bgWorker.ProgressChanged += UpdateProgressBar;

Expand All @@ -270,10 +271,11 @@ public void WriteSavegamesToDestination(List<Savegame> savegames, CheckedListBox
private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e, CheckedListBox cklSourceSavegamesTR1,
CheckedListBox cklSourceSavegamesTR2, CheckedListBox cklSourceSavegamesTR3, Button btnExtractTR1, Button btnExtractTR2,
Button btnExtractTR3, Button btnSelectAllTR1, Button btnSelectAllTR2, Button btnSelectAllTR3, Button btnBrowseSourceFile,
Button btnBrowseDestinationFile, CheckBox chkBackupOnWrite, ListBox lstDestinationSavegamesTR2,
ToolStripMenuItem tsmiBrowseSourceFile, ToolStripMenuItem tsmiBrowseDestinationFile, ToolStripStatusLabel slblStatus,
ToolStripMenuItem tsmiExtract, ComboBox cmbConversionTR1, ComboBox cmbConversionTR2, ComboBox cmbConversionTR3,
Button btnManageSlotsTR1, Button btnManageSlotsTR2, Button btnManageSlotsTR3, ToolStripMenuItem tsmiBackupDestinationFile)
Button btnBrowseDestinationFile, CheckBox chkBackupOnWrite, ListBox lstDestinationSavegamesTR1, ListBox lstDestinationSavegamesTR2,
ListBox lstDestinationSavegamesTR3, ToolStripMenuItem tsmiBrowseSourceFile, ToolStripMenuItem tsmiBrowseDestinationFile,
ToolStripStatusLabel slblStatus, ToolStripMenuItem tsmiExtract, ComboBox cmbConversionTR1, ComboBox cmbConversionTR2,
ComboBox cmbConversionTR3, Button btnManageSlotsTR1, Button btnManageSlotsTR2, Button btnManageSlotsTR3,
ToolStripMenuItem tsmiBackupDestinationFile)
{
progressForm.Close();

Expand Down Expand Up @@ -313,6 +315,10 @@ private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventA
cklSourceSavegamesTR2.Enabled = true;
cklSourceSavegamesTR3.Enabled = true;

lstDestinationSavegamesTR1.Enabled = true;
lstDestinationSavegamesTR2.Enabled = true;
lstDestinationSavegamesTR3.Enabled = true;

cmbConversionTR1.Enabled = true;
cmbConversionTR2.Enabled = true;
cmbConversionTR3.Enabled = true;
Expand Down
27 changes: 16 additions & 11 deletions TombExtract/TR3Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,11 @@ public int GetNumOverwrites(List<Savegame> savegames)
public void WriteSavegamesToDestination(List<Savegame> savegames, CheckedListBox cklSourceSavegamesTR1,
CheckedListBox cklSourceSavegamesTR2, CheckedListBox cklSourceSavegamesTR3, Button btnExtractTR1,
Button btnExtractTR2, Button btnExtractTR3, Button btnSelectAllTR1, Button btnSelectAllTR2, Button btnSelectAllTR3,
Button btnBrowseSourceFile, Button btnBrowseDestinationFile, CheckBox chkBackupOnWrite, ListBox lstDestinationSavegamesTR3,
ToolStripMenuItem tsmiBrowseSourceFile, ToolStripMenuItem tsmiBrowseDestinationFile, ToolStripStatusLabel slblStatus,
ToolStripMenuItem tsmiExtract, ComboBox cmbConversionTR1, ComboBox cmbConversionTR2, ComboBox cmbConversionTR3,
Button btnManageSlotsTR1, Button btnManageSlotsTR2, Button btnManageSlotsTR3, ToolStripMenuItem tsmiBackupDestinationFile)
Button btnBrowseSourceFile, Button btnBrowseDestinationFile, CheckBox chkBackupOnWrite, ListBox lstDestinationSavegamesTR1,
ListBox lstDestinationSavegamesTR2, ListBox lstDestinationSavegamesTR3, ToolStripMenuItem tsmiBrowseSourceFile,
ToolStripMenuItem tsmiBrowseDestinationFile, ToolStripStatusLabel slblStatus, ToolStripMenuItem tsmiExtract,
ComboBox cmbConversionTR1, ComboBox cmbConversionTR2, ComboBox cmbConversionTR3, Button btnManageSlotsTR1,
Button btnManageSlotsTR2, Button btnManageSlotsTR3, ToolStripMenuItem tsmiBackupDestinationFile)
{
isWriting = true;

Expand Down Expand Up @@ -258,9 +259,9 @@ public void WriteSavegamesToDestination(List<Savegame> savegames, CheckedListBox

bgWorker.RunWorkerCompleted += (sender, e) => bgWorker_RunWorkerCompleted(sender, e, cklSourceSavegamesTR1, cklSourceSavegamesTR2,
cklSourceSavegamesTR3, btnExtractTR1, btnExtractTR2, btnExtractTR3, btnSelectAllTR1, btnSelectAllTR2, btnSelectAllTR3,
btnBrowseSourceFile, btnBrowseDestinationFile, chkBackupOnWrite, lstDestinationSavegamesTR3, tsmiBrowseSourceFile,
tsmiBrowseDestinationFile, slblStatus, tsmiExtract, cmbConversionTR1, cmbConversionTR2, cmbConversionTR3, btnManageSlotsTR1,
btnManageSlotsTR2, btnManageSlotsTR3, tsmiBackupDestinationFile);
btnBrowseSourceFile, btnBrowseDestinationFile, chkBackupOnWrite, lstDestinationSavegamesTR1, lstDestinationSavegamesTR2,
lstDestinationSavegamesTR3, tsmiBrowseSourceFile, tsmiBrowseDestinationFile, slblStatus, tsmiExtract, cmbConversionTR1,
cmbConversionTR2, cmbConversionTR3, btnManageSlotsTR1, btnManageSlotsTR2, btnManageSlotsTR3, tsmiBackupDestinationFile);

bgWorker.ProgressChanged += UpdateProgressBar;

Expand All @@ -274,10 +275,10 @@ private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventA
CheckedListBox cklSourceSavegamesTR2, CheckedListBox cklSourceSavegamesTR3, Button btnExtractTR1, Button btnExtractTR2,
Button btnExtractTR3, Button btnSelectAllTR1, Button btnSelectAllTR2, Button btnSelectAllTR3,
Button btnBrowseSourceFile, Button btnBrowseDestinationFile, CheckBox chkBackupOnWrite,
ListBox lstDestinationSavegamesTR3, ToolStripMenuItem tsmiBrowseSourceFile, ToolStripMenuItem tsmiBrowseDestinationFile,
ToolStripStatusLabel slblStatus, ToolStripMenuItem tsmiExtract, ComboBox cmbConversionTR1,
ComboBox cmbConversionTR2, ComboBox cmbConversionTR3, Button btnManageSlotsTR1, Button btnManageSlotsTR2, Button btnManageSlotsTR3,
ToolStripMenuItem tsmiBackupDestinationFile)
ListBox lstDestinationSavegamesTR1, ListBox lstDestinationSavegamesTR2, ListBox lstDestinationSavegamesTR3,
ToolStripMenuItem tsmiBrowseSourceFile, ToolStripMenuItem tsmiBrowseDestinationFile, ToolStripStatusLabel slblStatus,
ToolStripMenuItem tsmiExtract, ComboBox cmbConversionTR1, ComboBox cmbConversionTR2, ComboBox cmbConversionTR3,
Button btnManageSlotsTR1, Button btnManageSlotsTR2, Button btnManageSlotsTR3, ToolStripMenuItem tsmiBackupDestinationFile)
{
progressForm.Close();

Expand Down Expand Up @@ -317,6 +318,10 @@ private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventA
cklSourceSavegamesTR2.Enabled = true;
cklSourceSavegamesTR3.Enabled = true;

lstDestinationSavegamesTR1.Enabled = true;
lstDestinationSavegamesTR2.Enabled = true;
lstDestinationSavegamesTR3.Enabled = true;

cmbConversionTR1.Enabled = true;
cmbConversionTR2.Enabled = true;
cmbConversionTR3.Enabled = true;
Expand Down
Binary file modified TombExtract/bin/x64/Release/TombExtract.exe
Binary file not shown.

0 comments on commit cf1c03d

Please sign in to comment.