Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
Merge branch 'gurrenm3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gurrenm3 authored and Gurrenm3 committed May 4, 2020
2 parents 53efeb8 + 49fe815 commit 1454aeb
Show file tree
Hide file tree
Showing 15 changed files with 741 additions and 258 deletions.
10 changes: 10 additions & 0 deletions BTDToolbox/BTDToolbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
<Compile Include="Classes\Bloon_Class.cs" />
<Compile Include="Classes\Card_Class.cs" />
<Compile Include="Classes\CrackBTDB_Pass.cs" />
<Compile Include="Classes\Guard.cs" />
<Compile Include="Classes\ImageProcessing.cs" />
<Compile Include="Classes\JsonEditorHandler.cs" />
<Compile Include="Classes\ModLoader_Handling.cs" />
Expand Down Expand Up @@ -141,6 +142,12 @@
<Compile Include="Extra Forms\FlashReader.Designer.cs">
<DependentUpon>FlashReader.cs</DependentUpon>
</Compile>
<Compile Include="Extra Forms\SelectGame.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Extra Forms\SelectGame.Designer.cs">
<DependentUpon>SelectGame.cs</DependentUpon>
</Compile>
<Compile Include="Extra Forms\SpriteVisualizer.cs">
<SubType>Form</SubType>
</Compile>
Expand Down Expand Up @@ -199,6 +206,9 @@
<EmbeddedResource Include="Extra Forms\FlashReader.resx">
<DependentUpon>FlashReader.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Extra Forms\SelectGame.resx">
<DependentUpon>SelectGame.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Extra Forms\SettingsWindow.resx">
<DependentUpon>SettingsWindow.cs</DependentUpon>
</EmbeddedResource>
Expand Down
69 changes: 36 additions & 33 deletions BTDToolbox/Classes/GeneralMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,17 +352,17 @@ public static void CreateBackup(string game)
ConsoleHandler.appendLog("Unable to create backup for " + game + ".");
}
}
public static void SteamValidateBTD5()
public static void SteamValidate(string game)
{
Process.Start("steam://validate/306020");
}
public static void SteamValidateBTDB()
{
Process.Start("steam://validate/444640");
}
public static void SteamValidateBMC()
{
Process.Start("steam://validate/1252780");
string url = "";
if (game == "BTD5")
url = "306020";
else if (game == "BTDB")
url = "444640";
else if (game == "BMC")
url = "1252780";

Process.Start("steam://validate/" + url);
}
public static void BackupLOC(string game)
{
Expand Down Expand Up @@ -534,31 +534,34 @@ public static void browseForExe(string game)
{
string exeName = Get_EXE_Name(game);

if (exeName != null && exeName != "")
if(!Guard.IsStringValid(exeName))
return;


MessageBox.Show("Please browse for " + exeName + ".\n\nMake sure that your game is UNMODDED, otherwise Toolbox will make a corrupt backup");
ConsoleHandler.appendLog("Make sure that your game is UNMODDED, otherwise Toolbox will make a corrupt backup..");
string exePath = BrowseForFile("Open game exe", "exe", "Exe files (*.exe)|*.exe|All files (*.*)|*.*", "");
if (!Guard.IsStringValid(exePath))
{
MessageBox.Show("Please browse for " + exeName + ".\n\nMake sure that your game is UNMODDED, otherwise Toolbox will make a corrupt backup");
ConsoleHandler.appendLog("Make sure that your game is UNMODDED, otherwise Toolbox will make a corrupt backup..");
string exePath = BrowseForFile("Open game exe", "exe", "Exe files (*.exe)|*.exe|All files (*.*)|*.*", "");
if (exePath != null && exePath != "")
{
if (exePath.Contains(exeName))
{
string gameDir = exePath.Replace("\\" + exeName, "");
if (game == "BTD5")
Main.BTD5_Dir = gameDir;
else if (game == "BTDB")
Main.BTDB_Dir = gameDir;
else if (game == "BMC")
Main.BMC_Dir = gameDir;

Serializer.SaveConfig(Main.getInstance(), "directories");
}
else
{
ConsoleHandler.appendLog("You selected an Invalid .exe. Please browse for the exe for your game.");
}
}
ConsoleHandler.force_appendLog("Invalid EXE path!");
return;
}

if (!exePath.Contains(exeName))
{
ConsoleHandler.appendLog("You selected an Invalid .exe. Please browse for the exe for your game.");
return;
}

string gameDir = exePath.Replace("\\" + exeName, "");
if (game == "BTD5")
Main.BTD5_Dir = gameDir;
else if (game == "BTDB")
Main.BTDB_Dir = gameDir;
else if (game == "BMC")
Main.BMC_Dir = gameDir;

Serializer.SaveConfig(Main.getInstance(), "directories");
}
public static string OutputJet()
{
Expand Down
19 changes: 19 additions & 0 deletions BTDToolbox/Classes/Guard.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BTDToolbox.Classes
{
class Guard
{
public static bool IsStringValid(string input)
{
if (input != null && input != "")
return true;
else
return false;
}
}
}
3 changes: 3 additions & 0 deletions BTDToolbox/Classes/NewProjects/ProjectHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public static ProjectClass.ProjectFile ReadProject(string projFile)
}
public static void SaveProject()
{
if (project == null)
project = new ProjectClass.ProjectFile();

project.ProjectName = CurrentProjectVariables.ProjectName;
project.PathToProjectFiles = CurrentProjectVariables.PathToProjectFiles;
project.PathToProjectClassFile = CurrentProjectVariables.PathToProjectClassFile;
Expand Down
2 changes: 1 addition & 1 deletion BTDToolbox/Extra Forms/EZCard_Editor.Designer.cs

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

19 changes: 12 additions & 7 deletions BTDToolbox/Extra Forms/EasyTowerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ private void PopulateUI()
{
if (game == "BTD5")
{
GeneralMethods.SteamValidateBTD5();
GeneralMethods.SteamValidate("BTD5");
}
else
{
GeneralMethods.SteamValidateBMC();
GeneralMethods.SteamValidate("BMC");
}
}
else
Expand Down Expand Up @@ -809,11 +809,16 @@ private void UpgradeName_TextBox_TextChanged(object sender, EventArgs e)
{
if (Upgrades_ListBox.Items.Count > 0)
{
var item = Upgrades_ListBox.SelectedIndex;
Upgrades_ListBox.Items.RemoveAt(item);
Upgrades_ListBox.Items.Insert(item, UpgradeName_TextBox.Text);
upgradenames[item] = UpgradeName_TextBox.Text;
loc_upgradeNames[item] = UpgradeName_TextBox.Text;
if (Upgrades_ListBox.SelectedIndex < 0)
return;

int item = Upgrades_ListBox.SelectedIndex;;
string text = UpgradeName_TextBox.Text;
Upgrades_ListBox.Items[item] = text;
upgradenames[item] = text;

if(CurrentProjectVariables.GameName != "BTDB")
loc_upgradeNames[item] = UpgradeName_TextBox.Text;

Upgrades_ListBox.SelectedIndex = item;
UpgradeName_TextBox.SelectionStart = UpgradeName_TextBox.Text.Length;
Expand Down
123 changes: 123 additions & 0 deletions BTDToolbox/Extra Forms/SelectGame.Designer.cs

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

Loading

0 comments on commit 1454aeb

Please sign in to comment.