Обновление
* Исправлена постоянная загрузка конфигов с 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;
|
||||
}
|
||||
|
||||
List<string> adr_value = GetADR(RegexHandler.GetValue(RegexHandler.SearchLine("adr:")));
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
txt_adr.Text += adr_value[i];
|
||||
if (i != 5)
|
||||
txt_adr.Text += ",";
|
||||
}
|
||||
txt_adr.Text = string.Join(",", GetADR(RegexHandler.GetValue(RegexHandler.SearchLine("adr:"))));
|
||||
chk_adr.Checked = true;
|
||||
|
||||
if (RegexHandler.SearchLine("company.volatile.stokes.calais") != 0)
|
||||
selected_game = "ets2";
|
||||
@@ -149,6 +144,8 @@ namespace SaveWizard
|
||||
item.Key.Text = "";
|
||||
item.Value.GetCheck().Checked = true;
|
||||
}
|
||||
txt_adr.Text = "";
|
||||
chk_adr.Checked = true;
|
||||
btn_unlock_garages.Enabled = false;
|
||||
btn_recover_backup.Enabled = false;
|
||||
btn_apply_changes.Enabled = false;
|
||||
@@ -266,6 +263,24 @@ namespace SaveWizard
|
||||
|
||||
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)
|
||||
if (!item.Value.GetCheck().Checked)
|
||||
RegexHandler.SetValue(RegexHandler.SearchLine(item.Value.GetString()), item.Key.Text);
|
||||
|
||||
@@ -24,16 +24,16 @@ namespace SaveWizard
|
||||
foreach (string unit in Regex.Split(path, "/"))
|
||||
{
|
||||
currentDirectory = Path.Combine(currentDirectory, unit);
|
||||
if (!unit.Contains(".json"))
|
||||
{
|
||||
if (!Directory.Exists(currentDirectory))
|
||||
Directory.CreateDirectory(currentDirectory);
|
||||
}
|
||||
else
|
||||
if (unit.Contains(".json"))
|
||||
{
|
||||
if (!File.Exists(currentDirectory))
|
||||
File.WriteAllText(currentDirectory, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Directory.Exists(currentDirectory))
|
||||
Directory.CreateDirectory(currentDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace SaveWizard
|
||||
if (Utils.GenerateMD5(path) != unit.Value)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user