Skip to content

Commit

Permalink
Update to version 1.2.1
Browse files Browse the repository at this point in the history
- Fixed a bug where you could copy or delete invalid mods, like mods with no name or such.
  • Loading branch information
daredloco committed Jul 13, 2020
1 parent df44b1e commit 5baf875
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Backend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ internal static void SaveProject(Project project)

internal static void DeleteProject(Project project)
{
if (project == null)
return;
string floc = Path.Combine(ProjectsPath, project.Name + "." + project.Type.ToString());
if (File.Exists(floc))
File.Delete(floc);
Expand Down
40 changes: 40 additions & 0 deletions src/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ private void bt_codesave_Click(object sender, EventArgs e)

private void bt_codecopy_Click(object sender, EventArgs e)
{
if (tb_codename.Text == "")
{
MessageBox.Show("You didn't select a mod!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (Backend.GetCodeProjects().Find(x => x.Name == tb_codename.Text) == null)
{
MessageBox.Show("Couldn't find a mod with this name!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
bt_codesave_Click(null, null);
if(Backend.GetCodeProjects().Find(x => x.Name == tb_codename.Text).CopyFiles())
{
Expand All @@ -115,6 +125,16 @@ private void bt_codecopy_Click(object sender, EventArgs e)

private void bt_codedelete_Click(object sender, EventArgs e)
{
if(tb_codename.Text == "")
{
MessageBox.Show("You didn't select a mod!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if(Backend.GetCodeProjects().Find(x => x.Name == tb_codename.Text) == null)
{
MessageBox.Show("Couldn't find a mod with this name!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if(MessageBox.Show("Do you want to delete the mod project?\nThere won't be deleted any mod files, just the project inside the application.","Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Backend.DeleteProject(Backend.GetCodeProjects().Find(x => x.Name == tb_codename.Text));
Expand Down Expand Up @@ -197,6 +217,16 @@ private void tb_datasource_DoubleClick(object sender, EventArgs e)

private void bt_datacopy_Click(object sender, EventArgs e)
{
if (tb_dataname.Text == "")
{
MessageBox.Show("You didn't select a mod!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (Backend.GetDataProjects().Find(x => x.Name == tb_dataname.Text) == null)
{
MessageBox.Show("Couldn't find a mod with this name!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
bt_datasave_Click(null, null);
if (Backend.GetDataProjects().Find(x => x.Name == tb_dataname.Text).CopyFiles())
{
Expand All @@ -220,6 +250,16 @@ private void bt_dataall_Click(object sender, EventArgs e)

private void bt_datadelete_Click(object sender, EventArgs e)
{
if (tb_dataname.Text == "")
{
MessageBox.Show("You didn't select a mod!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (Backend.GetDataProjects().Find(x => x.Name == tb_dataname.Text) == null)
{
MessageBox.Show("Couldn't find a mod with this name!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (MessageBox.Show("Do you want to delete the mod project?\nThere won't be deleted any mod files, just the project inside the application.", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Backend.DeleteProject(Backend.GetCodeProjects().Find(x => x.Name == tb_dataname.Text));
Expand Down
4 changes: 2 additions & 2 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]

0 comments on commit 5baf875

Please sign in to comment.