Обновление
* Исправлена постоянная загрузка конфигов с GitHub (даже когда конфиги актуальные) * Функционал по взаимодействию с ADR Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
@@ -99,13 +99,8 @@ namespace SaveWizard
|
|||||||
item.Value.GetCheck().Checked = true;
|
item.Value.GetCheck().Checked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<string> adr_value = GetADR(RegexHandler.GetValue(RegexHandler.SearchLine("adr:")));
|
txt_adr.Text = string.Join(",", GetADR(RegexHandler.GetValue(RegexHandler.SearchLine("adr:"))));
|
||||||
for (int i = 0; i < 6; i++)
|
chk_adr.Checked = true;
|
||||||
{
|
|
||||||
txt_adr.Text += adr_value[i];
|
|
||||||
if (i != 5)
|
|
||||||
txt_adr.Text += ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RegexHandler.SearchLine("company.volatile.stokes.calais") != 0)
|
if (RegexHandler.SearchLine("company.volatile.stokes.calais") != 0)
|
||||||
selected_game = "ets2";
|
selected_game = "ets2";
|
||||||
@@ -149,6 +144,8 @@ namespace SaveWizard
|
|||||||
item.Key.Text = "";
|
item.Key.Text = "";
|
||||||
item.Value.GetCheck().Checked = true;
|
item.Value.GetCheck().Checked = true;
|
||||||
}
|
}
|
||||||
|
txt_adr.Text = "";
|
||||||
|
chk_adr.Checked = true;
|
||||||
btn_unlock_garages.Enabled = false;
|
btn_unlock_garages.Enabled = false;
|
||||||
btn_recover_backup.Enabled = false;
|
btn_recover_backup.Enabled = false;
|
||||||
btn_apply_changes.Enabled = false;
|
btn_apply_changes.Enabled = false;
|
||||||
@@ -266,6 +263,24 @@ namespace SaveWizard
|
|||||||
|
|
||||||
private void btn_apply_changes_Click(object sender, EventArgs e)
|
private void btn_apply_changes_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (!chk_adr.Checked)
|
||||||
|
{
|
||||||
|
List<char> adrList = txt_adr.Text.ToList();
|
||||||
|
adrList.RemoveAll(i => i == ' ' || i == ',' || i == '.');
|
||||||
|
if (adrList.Count < 6)
|
||||||
|
{
|
||||||
|
Utils.ShowError("ADR can't have less than 6 elements.");
|
||||||
|
}
|
||||||
|
else if (adrList.Count > 6)
|
||||||
|
{
|
||||||
|
Utils.ShowError("ADR can't have more than 6 elements.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int adrNew = Convert.ToInt32(string.Join("", adrList), 2);
|
||||||
|
RegexHandler.SetValue(RegexHandler.SearchLine("adr:"), adrNew.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
foreach (KeyValuePair<TextBox, WindowItem> item in items)
|
foreach (KeyValuePair<TextBox, WindowItem> item in items)
|
||||||
if (!item.Value.GetCheck().Checked)
|
if (!item.Value.GetCheck().Checked)
|
||||||
RegexHandler.SetValue(RegexHandler.SearchLine(item.Value.GetString()), item.Key.Text);
|
RegexHandler.SetValue(RegexHandler.SearchLine(item.Value.GetString()), item.Key.Text);
|
||||||
|
|||||||
@@ -24,16 +24,16 @@ namespace SaveWizard
|
|||||||
foreach (string unit in Regex.Split(path, "/"))
|
foreach (string unit in Regex.Split(path, "/"))
|
||||||
{
|
{
|
||||||
currentDirectory = Path.Combine(currentDirectory, unit);
|
currentDirectory = Path.Combine(currentDirectory, unit);
|
||||||
if (!unit.Contains(".json"))
|
if (unit.Contains(".json"))
|
||||||
{
|
|
||||||
if (!Directory.Exists(currentDirectory))
|
|
||||||
Directory.CreateDirectory(currentDirectory);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (!File.Exists(currentDirectory))
|
if (!File.Exists(currentDirectory))
|
||||||
File.WriteAllText(currentDirectory, "");
|
File.WriteAllText(currentDirectory, "");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(currentDirectory))
|
||||||
|
Directory.CreateDirectory(currentDirectory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ namespace SaveWizard
|
|||||||
if (Utils.GenerateMD5(path) != unit.Value)
|
if (Utils.GenerateMD5(path) != unit.Value)
|
||||||
{
|
{
|
||||||
string newConfigText = wb.DownloadString($"{githubLink}{path}");
|
string newConfigText = wb.DownloadString($"{githubLink}{path}");
|
||||||
File.WriteAllText(Path.Combine(Environment.CurrentDirectory, path), newConfigText);
|
File.WriteAllText(Path.Combine(Environment.CurrentDirectory, path), newConfigText.Replace("\n", "\r\n"));
|
||||||
}
|
}
|
||||||
backgroundWorker1.ReportProgress(progressBar1.Value + 1);
|
backgroundWorker1.ReportProgress(progressBar1.Value + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user