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

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

Loading…
Cancel
Save