Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions BypassReplacer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ public MainWindow()
string replacePath = "\\Minigames\\libraries\\";
string replaceName = "feder-live-SNAPSHOT.jar";

if (!File.Exists("C:\\Cristalix\\" + replaceName))
{
Dispatcher.Invoke(() => inform.Text = "Ошибка: Не найден файл " + "C:\\Cristalix\\" + replaceName + "\n\nПерезапустите BypassReplacer для повторной попытки");
return;
}

Console.WriteLine("Запустите Cristalix...");
Dispatcher.Invoke(() => inform.Text = "Запустите Cristalix...");

Expand Down Expand Up @@ -104,8 +110,26 @@ public MainWindow()
string tempPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "sunec_temp");
string tempFile = System.IO.Path.Combine(tempPath, replaceName);

Console.WriteLine("Подготовка...");
Dispatcher.Invoke(() => inform.Text = "Подготовка...");
Console.WriteLine("Проверка на вшивость...");
Dispatcher.Invoke(() => inform.Text = "Проверка на вшивость...");

if (!File.Exists("C:\\Xenoceal\\" + replaceName))
{
Dispatcher.Invoke(() => inform.Text = "Ошибка: Не найден файл " + "C:\\Xenoceal\\" + replaceName + "\n\nПерезапустите BypassReplacer для повторной попытки");
return;
}
if (IsSymbolicLink(filePath))
{
File.Delete(filePath);
Dispatcher.Invoke(() => inform.Text = "Ошибка: Похоже предыдущая попытка подмена была не успешной, перезапустите лаунчер (кристаликс) без BypassReplacer и попробуйте снова\n\nПерезапустите BypassReplacer для повторной попытки");
return;
}

if (IsFileEqual("C:\\Xenoceal\\" + replaceName, filePath))
{
Dispatcher.Invoke(() => inform.Text = "Ошибка: Похоже файл " + "C:\\Xenoceal\\" + replaceName + " был перезаписан лаунчером, верните модифиваронный " + replaceName + "\n\nПерезапустите BypassReplacer для повторной попытки");
return;
}

try
{
Expand All @@ -128,7 +152,7 @@ public MainWindow()
}
}
File.Delete(filePath);
File.WriteAllBytes(filePath, Properties.Resources.feder_live_SNAPSHOT);
File.Copy("C:\\Xenoceal\\" + replaceName, filePath, overwrite: true);
JavaProcess(currProcess, true);

Console.WriteLine("Ждём запуска майнкрафта...");
Expand Down Expand Up @@ -170,6 +194,7 @@ public MainWindow()
}
File.Delete(filePath);
File.Copy(tempFile, filePath, overwrite: true);
//File.Copy(tempFile, filePath, overwrite: true);
JavaProcess(currProcess, true);
foreach (Process p in multiProcess)
{
Expand Down