Обновление
* Добавлены методы для показа информационных сообщений * Обновлена логика основной формы Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
10
MainForm.cs
10
MainForm.cs
@@ -107,7 +107,7 @@ namespace SaveWizard_rewritten
|
|||||||
owns[item.Key] = true;
|
owns[item.Key] = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
MessageBox.Show($"'dlc.json' from '{selected_game}' have errors or not found, functionality has been limited", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
Utils.ShowError($"'dlc.json' from '{selected_game}' have errors or not found, functionality has been limited");
|
||||||
}
|
}
|
||||||
|
|
||||||
btn_unlock_garages.Enabled = true;
|
btn_unlock_garages.Enabled = true;
|
||||||
@@ -204,7 +204,7 @@ namespace SaveWizard_rewritten
|
|||||||
{
|
{
|
||||||
if (DecryptAndDecodeFile(ofd.FileName, ofd.FileName) != 0)
|
if (DecryptAndDecodeFile(ofd.FileName, ofd.FileName) != 0)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Something went wrong with decrypting file. Try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
Utils.ShowError("Something went wrong with decrypting file. Try again.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -218,12 +218,12 @@ namespace SaveWizard_rewritten
|
|||||||
string backup_path = opened_file_path + ".swbak";
|
string backup_path = opened_file_path + ".swbak";
|
||||||
if (!File.Exists(backup_path))
|
if (!File.Exists(backup_path))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Backup not found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
Utils.ShowError("Backup not found.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File.WriteAllLines(opened_file_path, File.ReadAllLines(backup_path));
|
File.WriteAllLines(opened_file_path, File.ReadAllLines(backup_path));
|
||||||
File.Delete(backup_path);
|
File.Delete(backup_path);
|
||||||
MessageBox.Show("Backup successfully recovered.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
Utils.ShowInfo("Backup successfully recovered.");
|
||||||
GetFileData(opened_file_path);
|
GetFileData(opened_file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,7 +234,7 @@ namespace SaveWizard_rewritten
|
|||||||
RegexHandler.SetValue(RegexHandler.SearchLine(item.Value.GetString()), item.Key.Text);
|
RegexHandler.SetValue(RegexHandler.SearchLine(item.Value.GetString()), item.Key.Text);
|
||||||
File.WriteAllLines(opened_file_path + ".swbak", RegexHandler.GetBackup());
|
File.WriteAllLines(opened_file_path + ".swbak", RegexHandler.GetBackup());
|
||||||
File.WriteAllLines(opened_file_path, RegexHandler.GetAllLines());
|
File.WriteAllLines(opened_file_path, RegexHandler.GetAllLines());
|
||||||
MessageBox.Show("Changes successfully applied.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
Utils.ShowInfo("Changes successfully applied.");
|
||||||
GetFileData(opened_file_path);
|
GetFileData(opened_file_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
Utils.cs
11
Utils.cs
@@ -1,6 +1,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace SaveWizard_rewritten
|
namespace SaveWizard_rewritten
|
||||||
{
|
{
|
||||||
@@ -23,5 +24,15 @@ namespace SaveWizard_rewritten
|
|||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ShowError(string message)
|
||||||
|
{
|
||||||
|
MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ShowInfo(string message)
|
||||||
|
{
|
||||||
|
MessageBox.Show(message, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user