Skip to content

Commit

Permalink
Made RecipeManagerForm always read before exporting
Browse files Browse the repository at this point in the history
  • Loading branch information
WesselKuipers committed Mar 12, 2018
1 parent 722aeab commit 93fb917
Showing 1 changed file with 29 additions and 18 deletions.
47 changes: 29 additions & 18 deletions GGRev2ComboRecipeManager.GUI/RecipeManagerForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,7 @@ private void btnOpenRecordingFolder_Click(object sender, EventArgs e)

private void btnReadRecipes_Click(object sender, EventArgs e)
{
var recipes = ComboRecipeManager.ReadComboRecipes();

if (recipes == null)
{
MessageBox.Show("Unable to read Combo Recipe data.");
return;
}

ComboRecipes = recipes.ToList();
ReadComboRecipes();

var characterNames = ComboRecipes.Select(cr => Enum.IsDefined(typeof(CharacterCode), cr.CharacterCode)
? cr.CharacterCode.ToString()
Expand Down Expand Up @@ -300,21 +292,14 @@ private void ExportDummyRecording(int slotNr)

if (sfd.ShowDialog() == DialogResult.OK)
{
ReadDummyRecordings();
File.WriteAllBytes(sfd.FileName, DummyRecordings[slotNr].RecordingData);
}
}

private void btnReadDummyRecordings_Click(object sender, EventArgs e)
{
var recordings = DummyRecordingManager.ReadDummyRecordings();

if (recordings == null)
{
MessageBox.Show("Unable to read Dummy Recording data.");
return;
}

DummyRecordings = recordings.ToList();
ReadDummyRecordings();

btnImportDummySlot1.Enabled = true;
btnImportDummySlot2.Enabled = true;
Expand All @@ -328,5 +313,31 @@ private void btnReadDummyRecordings_Click(object sender, EventArgs e)
btnClearDummySlot2.Enabled = true;
btnClearDummySlot3.Enabled = true;
}

private void ReadDummyRecordings()
{
var recordings = DummyRecordingManager.ReadDummyRecordings();

if (recordings == null)
{
MessageBox.Show("Unable to read Dummy Recording data.");
return;
}

DummyRecordings = recordings.ToList();
}

private void ReadComboRecipes()
{
var recipes = ComboRecipeManager.ReadComboRecipes();

if (recipes == null)
{
MessageBox.Show("Unable to read Combo Recipe data.");
return;
}

ComboRecipes = recipes.ToList();
}
}
}

0 comments on commit 93fb917

Please sign in to comment.