fixed new backup method triggered depending on how many time the guid was in the api

This commit is contained in:
Asval 2019-05-26 03:10:14 +02:00
parent 4d81e3aa91
commit 3b63867888
5 changed files with 43 additions and 7 deletions

View File

@ -11,7 +11,7 @@ namespace FModel.Converter
static byte[] _oggNoHeader = { 0x4F, 0x67, 0x67, 0x53 };
static byte[] _uexpToDelete = { 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00 };
static byte[] _oggOutNewArray;
public static List<int> SearchBytePattern(byte[] pattern, byte[] bytes)
private static List<int> SearchBytePattern(byte[] pattern, byte[] bytes)
{
List<int> positions = new List<int>();
int patternLength = pattern.Length;
@ -32,7 +32,7 @@ namespace FModel.Converter
}
return positions;
}
public static bool TryFindAndReplace<T>(T[] source, T[] pattern, T[] replacement, out T[] newArray)
private static bool TryFindAndReplace<T>(T[] source, T[] pattern, T[] replacement, out T[] newArray)
{
if (source == null)
throw new ArgumentNullException(nameof(source));

View File

@ -1 +1 @@
5ba2a9e
4d81e3a

View File

@ -53,6 +53,7 @@
this.textBox3 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.label7 = new System.Windows.Forms.Label();
this.textBox5 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
@ -313,6 +314,7 @@
// groupBox5
//
this.groupBox5.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.groupBox5.Controls.Add(this.checkBox1);
this.groupBox5.Controls.Add(this.label7);
this.groupBox5.Controls.Add(this.textBox5);
this.groupBox5.Controls.Add(this.label6);
@ -325,11 +327,22 @@
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Optional - Backup PAKs 1000+";
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(499, 71);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(60, 17);
this.checkBox1.TabIndex = 7;
this.checkBox1.Text = "Reveal";
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.CheckBox1_CheckedChanged);
//
// label7
//
this.label7.AutoSize = true;
this.label7.ForeColor = System.Drawing.Color.Red;
this.label7.Location = new System.Drawing.Point(294, 72);
this.label7.Location = new System.Drawing.Point(214, 72);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(262, 13);
this.label7.TabIndex = 6;
@ -340,9 +353,9 @@
//
this.textBox5.Location = new System.Drawing.Point(95, 45);
this.textBox5.Name = "textBox5";
this.textBox5.PasswordChar = '*';
this.textBox5.Size = new System.Drawing.Size(459, 20);
this.textBox5.TabIndex = 4;
this.textBox5.UseSystemPasswordChar = true;
//
// label6
//
@ -357,9 +370,9 @@
//
this.textBox4.Location = new System.Drawing.Point(74, 19);
this.textBox4.Name = "textBox4";
this.textBox4.PasswordChar = '*';
this.textBox4.Size = new System.Drawing.Size(480, 20);
this.textBox4.TabIndex = 2;
this.textBox4.UseSystemPasswordChar = true;
//
// label2
//
@ -437,5 +450,6 @@
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.CheckBox checkBox1;
}
}

View File

@ -349,5 +349,19 @@ namespace FModel.Forms
Application.OpenForms[assetsForm.Name].Focus();
}
}
private void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
{
textBox4.UseSystemPasswordChar = false;
textBox5.UseSystemPasswordChar = false;
}
else
{
textBox4.UseSystemPasswordChar = true;
textBox5.UseSystemPasswordChar = true;
}
}
}
}

View File

@ -786,14 +786,22 @@ namespace FModel
}
else if (_backupDynamicKeys != null)
{
string oldGuid = string.Empty;
foreach (string myString in _backupDynamicKeys)
{
string[] parts = myString.Split(':');
string newGuid = DynamicPAKs.getPakGuidFromKeychain(parts);
if (DynamicPAKs.getPakGuidFromKeychain(parts) == arCurrentUsedPakGuid)
/***
* if same guid several time in keychain do not backup twice
* it works fine that way because of the loop through all the paks
* even if in keychain we do "found 1004" -> "found 1001" -> "found 1004" through the paks we do 1000 -> 1001 -> 1002...
***/
if (newGuid == arCurrentUsedPakGuid && oldGuid != newGuid)
{
byte[] bytes = Convert.FromBase64String(parts[1]);
string aeskey = BitConverter.ToString(bytes).Replace("-", "");
oldGuid = newGuid;
try
{