Enforce better variable naming scheme

pull/2/head
Lojemiru 6 years ago
parent c416a73466
commit b2c6b20fd1

@ -42,8 +42,8 @@
this.NameTextBox = new System.Windows.Forms.TextBox(); this.NameTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel();
this.APKLabel = new System.Windows.Forms.Label(); this.ApkLabel = new System.Windows.Forms.Label();
this.APKButton = new System.Windows.Forms.Button(); this.ApkButton = new System.Windows.Forms.Button();
this.AndroidCheckBox = new System.Windows.Forms.CheckBox(); this.AndroidCheckBox = new System.Windows.Forms.CheckBox();
this.YYCCheckBox = new System.Windows.Forms.CheckBox(); this.YYCCheckBox = new System.Windows.Forms.CheckBox();
this.SaveCheckBox = new System.Windows.Forms.CheckBox(); this.SaveCheckBox = new System.Windows.Forms.CheckBox();
@ -175,8 +175,8 @@
// //
// panel3 // panel3
// //
this.panel3.Controls.Add(this.APKLabel); this.panel3.Controls.Add(this.ApkLabel);
this.panel3.Controls.Add(this.APKButton); this.panel3.Controls.Add(this.ApkButton);
this.panel3.Controls.Add(this.AndroidCheckBox); this.panel3.Controls.Add(this.AndroidCheckBox);
this.panel3.Controls.Add(this.YYCCheckBox); this.panel3.Controls.Add(this.YYCCheckBox);
this.panel3.Controls.Add(this.SaveCheckBox); this.panel3.Controls.Add(this.SaveCheckBox);
@ -186,26 +186,26 @@
this.panel3.Size = new System.Drawing.Size(291, 111); this.panel3.Size = new System.Drawing.Size(291, 111);
this.panel3.TabIndex = 2; this.panel3.TabIndex = 2;
// //
// APKLabel // ApkLabel
// //
this.APKLabel.AutoSize = true; this.ApkLabel.AutoSize = true;
this.APKLabel.Location = new System.Drawing.Point(176, 90); this.ApkLabel.Location = new System.Drawing.Point(176, 90);
this.APKLabel.Name = "APKLabel"; this.ApkLabel.Name = "ApkLabel";
this.APKLabel.Size = new System.Drawing.Size(112, 13); this.ApkLabel.Size = new System.Drawing.Size(112, 13);
this.APKLabel.TabIndex = 7; this.ApkLabel.TabIndex = 7;
this.APKLabel.Text = "Modded APK Loaded!"; this.ApkLabel.Text = "Modded APK Loaded!";
this.APKLabel.Visible = false; this.ApkLabel.Visible = false;
// //
// APKButton // ApkButton
// //
this.APKButton.Enabled = false; this.ApkButton.Enabled = false;
this.APKButton.Location = new System.Drawing.Point(3, 85); this.ApkButton.Location = new System.Drawing.Point(3, 85);
this.APKButton.Name = "APKButton"; this.ApkButton.Name = "ApkButton";
this.APKButton.Size = new System.Drawing.Size(143, 23); this.ApkButton.Size = new System.Drawing.Size(143, 23);
this.APKButton.TabIndex = 6; this.ApkButton.TabIndex = 6;
this.APKButton.Text = "Load modded Android APK"; this.ApkButton.Text = "Load modded Android APK";
this.APKButton.UseVisualStyleBackColor = true; this.ApkButton.UseVisualStyleBackColor = true;
this.APKButton.Click += new System.EventHandler(this.APKButton_Click); this.ApkButton.Click += new System.EventHandler(this.ApkButton_Click);
// //
// AndroidCheckBox // AndroidCheckBox
// //
@ -289,12 +289,12 @@
private System.Windows.Forms.TextBox NameTextBox; private System.Windows.Forms.TextBox NameTextBox;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel3; private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Button APKButton; private System.Windows.Forms.Button ApkButton;
private System.Windows.Forms.CheckBox AndroidCheckBox; private System.Windows.Forms.CheckBox AndroidCheckBox;
private System.Windows.Forms.CheckBox YYCCheckBox; private System.Windows.Forms.CheckBox YYCCheckBox;
private System.Windows.Forms.CheckBox SaveCheckBox; private System.Windows.Forms.CheckBox SaveCheckBox;
private System.Windows.Forms.CheckBox MusicCheckBox; private System.Windows.Forms.CheckBox MusicCheckBox;
private System.Windows.Forms.Label APKLabel; private System.Windows.Forms.Label ApkLabel;
private System.Windows.Forms.Label CreateLabel; private System.Windows.Forms.Label CreateLabel;
} }
} }

@ -18,21 +18,21 @@ namespace AM2R_ModPacker
public partial class ModPacker : Form public partial class ModPacker : Form
{ {
private static readonly string ORIGINAL_MD5 = "f2b84fe5ba64cb64e284be1066ca08ee"; private static readonly string ORIGINAL_MD5 = "f2b84fe5ba64cb64e284be1066ca08ee";
private bool originalLoaded, modLoaded, androidLoaded; private bool isOriginalLoaded, isModLoaded, isApkLoaded;
private string localPath, originalLocation, modLocation, androidLocation; private string localPath, originalPath, modPath, apkPath;
private static readonly string[] DATAFILES_BLACKLIST = { "data.win", "AM2R.exe", "D3DX9_43.dll" }; private static readonly string[] DATAFILES_BLACKLIST = { "data.win", "AM2R.exe", "D3DX9_43.dll" };
private ModProfile profile; private ModProfile profile;
public ModPacker() public ModPacker()
{ {
InitializeComponent(); InitializeComponent();
profile = new ModProfile(1, "", "", false, "default", false, false); profile = new ModProfile(1, "", "", false, "default", false, false);
originalLoaded = false; isOriginalLoaded = false;
modLoaded = false; isModLoaded = false;
androidLoaded = false; isApkLoaded = false;
localPath = Directory.GetCurrentDirectory(); localPath = Directory.GetCurrentDirectory();
originalLocation = ""; originalPath = "";
modLocation = ""; modPath = "";
} }
#region WinForms events #region WinForms events
@ -40,9 +40,9 @@ namespace AM2R_ModPacker
private void OriginalButton_Click(object sender, EventArgs e) private void OriginalButton_Click(object sender, EventArgs e)
{ {
// Open window to select AM2R 1.1 // Open window to select AM2R 1.1
(originalLoaded, originalLocation) = SelectFile("Please select AM2R_11.zip", "zip", "zip files (*.zip)|*.zip"); (isOriginalLoaded, originalPath) = SelectFile("Please select AM2R_11.zip", "zip", "zip files (*.zip)|*.zip");
OriginalLabel.Visible = originalLoaded; OriginalLabel.Visible = isOriginalLoaded;
UpdateCreateButton(); UpdateCreateButton();
} }
@ -50,9 +50,9 @@ namespace AM2R_ModPacker
private void ModButton_Click(object sender, EventArgs e) private void ModButton_Click(object sender, EventArgs e)
{ {
// Open window to select modded AM2R // Open window to select modded AM2R
(modLoaded, modLocation) = SelectFile("Please select your custom AM2R .zip", "zip", "zip files (*.zip)|*.zip"); (isModLoaded, modPath) = SelectFile("Please select your custom AM2R .zip", "zip", "zip files (*.zip)|*.zip");
ModLabel.Visible = modLoaded; ModLabel.Visible = isModLoaded;
UpdateCreateButton(); UpdateCreateButton();
} }
@ -115,8 +115,8 @@ namespace AM2R_ModPacker
} }
// Extract 1.1 and modded AM2R to their own directories in temp work // Extract 1.1 and modded AM2R to their own directories in temp work
ZipFile.ExtractToDirectory(originalLocation, tempOriginal); ZipFile.ExtractToDirectory(originalPath, tempOriginal);
ZipFile.ExtractToDirectory(modLocation, tempMod); ZipFile.ExtractToDirectory(modPath, tempMod);
// Verify 1.1 with an MD5. If it does not match, exit cleanly and provide a warning window. // Verify 1.1 with an MD5. If it does not match, exit cleanly and provide a warning window.
try try
@ -168,7 +168,7 @@ namespace AM2R_ModPacker
{ {
FileName = "cmd.exe", FileName = "cmd.exe",
WorkingDirectory = tempAndroid, WorkingDirectory = tempAndroid,
Arguments = "/C java -jar \"" + localPath + "\\utilities\\android\\apktool.jar\" d -f -o \"" + tempAndroid + "\" \"" + androidLocation + "\"", Arguments = "/C java -jar \"" + localPath + "\\utilities\\android\\apktool.jar\" d -f -o \"" + tempAndroid + "\" \"" + apkPath + "\"",
UseShellExecute = false, UseShellExecute = false,
CreateNoWindow = true CreateNoWindow = true
}; };
@ -283,19 +283,19 @@ namespace AM2R_ModPacker
CreateLabel.Text = "Mod package created!"; CreateLabel.Text = "Mod package created!";
} }
private void APKButton_Click(object sender, EventArgs e) private void ApkButton_Click(object sender, EventArgs e)
{ {
// Open window to select modded AM2R APK // Open window to select modded AM2R APK
(androidLoaded, androidLocation) = SelectFile("Please select your custom AM2R .apk", "apk", "android application packages (*.apk)|*.apk"); (isApkLoaded, apkPath) = SelectFile("Please select your custom AM2R .apk", "apk", "android application packages (*.apk)|*.apk");
APKLabel.Visible = androidLoaded; ApkLabel.Visible = isApkLoaded;
UpdateCreateButton(); UpdateCreateButton();
} }
private void AndroidCheckBox_CheckedChanged(object sender, EventArgs e) private void AndroidCheckBox_CheckedChanged(object sender, EventArgs e)
{ {
APKButton.Enabled = AndroidCheckBox.Checked; ApkButton.Enabled = AndroidCheckBox.Checked;
UpdateCreateButton(); UpdateCreateButton();
} }
@ -321,18 +321,18 @@ namespace AM2R_ModPacker
private void AbortPatch() private void AbortPatch()
{ {
// Unload files // Unload files
originalLoaded = false; isOriginalLoaded = false;
modLoaded = false; isModLoaded = false;
androidLoaded = false; isApkLoaded = false;
originalLocation = ""; originalPath = "";
modLocation = ""; modPath = "";
androidLocation = ""; apkPath = "";
// Set labels // Set labels
CreateLabel.Text = "Mod packaging aborted!"; CreateLabel.Text = "Mod packaging aborted!";
OriginalLabel.Visible = false; OriginalLabel.Visible = false;
ModLabel.Visible = false; ModLabel.Visible = false;
APKLabel.Visible = false; ApkLabel.Visible = false;
// Remove temp directory // Remove temp directory
if (Directory.Exists(Path.GetTempPath() + "\\AM2RModPacker")) if (Directory.Exists(Path.GetTempPath() + "\\AM2RModPacker"))
@ -360,7 +360,7 @@ namespace AM2R_ModPacker
private void UpdateCreateButton() private void UpdateCreateButton()
{ {
if (originalLoaded && modLoaded && (!AndroidCheckBox.Checked || androidLoaded)) if (isOriginalLoaded && isModLoaded && (!AndroidCheckBox.Checked || isApkLoaded))
{ {
CreateButton.Enabled = true; CreateButton.Enabled = true;
} }

Loading…
Cancel
Save