Начинающий
- Статус
- Оффлайн
- Регистрация
- 22 Мар 2025
- Сообщения
- 5
- Реакции
- 0
SRC:
using System;
using System.IO;
using System.Net;
using System.Threading;
using System.IO.Compression;
using System.Diagnostics;
using System.Linq;
namespace FobosDLC_Loader
{
class Program
{
// Константы
private static string archiveName = "unzip.zip"; // ТАК ОБЯЗАТЕЛЬНО ДОЛЖЕН БЫТЬ НАЗВАН АРХИВ
private static string downloadUrl = "https://www.dropbox.com/scl/fi/30i7l6xd38zi46o6yxm2d/unzip.zip?rlkey=x24eo37y4dsz5y0vlgbxen77v&st=3iaawg9h&dl=1"; // ЗАМЕНИТЕ НА ВАШУ ССЫЛКУ
private static string installPath = @"C:\FobosClient"; // Путь куда установится
private static string jarFileName = "1.16.5.jar"; // Крч это класс вашей версии
private static User[] authorizedUsers = new User[]
{
new User("XerdezNew", "SigmaKriper"),
new User("wayroxqq", "tester358"),
new User("username", "password")
};
static void Main(string[] args)
{
Console.Title = "FobosDLC 1.0";
Console.ForegroundColor = ConsoleColor.Cyan;
// Создаем папку если её нет (скрыто)
if (!Directory.Exists(installPath))
{
Directory.CreateDirectory(installPath);
}
// Вывод ASCII арта
PrintASCIIArt();
Console.ResetColor();
Console.WriteLine();
// Логин снизу найдете
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("Логин: ");
string login = Console.ReadLine();
// ШИФРОВАНИЕ
Console.Write("Пароль: ");
string password = ReadPassword();
Console.WriteLine();
// ПРОВЕРКА ПОЛЬЗОВАТЕЛЯ
bool isAuthorized = false;
string username = login;
foreach (var user in authorizedUsers)
{
if (user.Login == login && user.Password == password)
{
isAuthorized = true;
username = user.DisplayName ?? login;
break;
}
}
if (isAuthorized)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"\n[УСПЕШНО] Добро пожаловать, {username}!");
Console.WriteLine("[INFO] Инициализация загрузчика FobosDLC...\n");
Thread.Sleep(1500);
StartMinecraftInstaller();
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("\n[ОШИБКА] Неверный логин или пароль!");
Console.WriteLine("[INFO] Доступ запрещен.");
Thread.Sleep(3000);
Environment.Exit(0);
}
Console.ResetColor();
Console.WriteLine("\nНажмите любую клавишу для выхода...");
Console.ReadKey();
}
static void StartMinecraftInstaller()
{
try
{
string archivePath = Path.Combine(installPath, archiveName);
// Проверка архива
if (!File.Exists(archivePath))
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("[INFO] Поиск необходимых файлов...\n");
bool downloadSuccess = DownloadArchive(archivePath);
if (!downloadSuccess)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("[ОШИБКА] Не удалось загрузить необходимые файлы!");
Console.WriteLine("[INFO] Проверьте подключение к интернету.");
Thread.Sleep(5000);
Environment.Exit(0);
}
}
// Проверка на установку jar файла
string jarPath = FindJarFile(installPath);
if (jarPath != null && File.Exists(jarPath))
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("\n[ВНИМАНИЕ] Обнаружена существующая установка!");
Console.Write("Хотите переустановить? (Y/N): ");
string choice = Console.ReadLine().ToUpper();
if (choice != "Y")
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("[INFO] Запуск игры...");
RunMinecraft(jarPath, installPath);
return;
}
}
// Распаковка архива
ExtractArchive(archivePath, installPath);
// jar файл после распаковки
jarPath = FindJarFile(installPath);
if (jarPath == null)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"[ОШИБКА] Файл {jarFileName} не найден в архиве!");
Console.WriteLine("[INFO] Показываем содержимое папки установки для отладки:");
ShowDirectoryContents(installPath, 0);
Thread.Sleep(8000);
Environment.Exit(0);
}
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"[INFO] Найден файл: {jarPath}");
// Запуск игры после установки
RunMinecraft(jarPath, installPath);
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"\n[ОШИБКА] {ex.Message}");
Thread.Sleep(5000);
}
}
static string FindJarFile(string searchPath)
{
try
{
string[] foundFiles = Directory.GetFiles(searchPath, jarFileName, SearchOption.AllDirectories);
if (foundFiles.Length > 0)
{
return foundFiles[0];
}
return null;
}
catch
{
return null;
}
}
static void ShowDirectoryContents(string path, int level)
{
try
{
string indent = new string(' ', level * 2);
string[] files = Directory.GetFiles(path);
foreach (string file in files.Take(20))
{
Console.WriteLine($"{indent}📄 {Path.GetFileName(file)}");
}
if (files.Length > 20)
{
Console.WriteLine($"{indent}... и еще {files.Length - 20} файлов");
}
string[] dirs = Directory.GetDirectories(path);
foreach (string dir in dirs)
{
Console.WriteLine($"{indent}📁 {Path.GetFileName(dir)}/");
if (level < 2)
{
ShowDirectoryContents(dir, level + 1);
}
}
}
catch { }
}
static bool DownloadArchive(string savePath)
{
try
{
using (WebClient client = new WebClient())
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("[DOWNLOAD] Загрузка необходимых файлов...");
client.DownloadProgressChanged += (sender, e) =>
{
Console.ForegroundColor = ConsoleColor.Green;
double megaBytesReceived = e.BytesReceived / 1024.0 / 1024.0;
double megaBytesTotal = e.TotalBytesToReceive / 1024.0 / 1024.0;
Console.Write($"\r[DOWNLOAD] Прогресс: {e.ProgressPercentage}% ({megaBytesReceived:F1} MB / {megaBytesTotal:F1} MB) ");
};
client.DownloadFile(new Uri(downloadUrl), savePath);
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("\n[DOWNLOAD] Загрузка завершена!");
if (IsZipValid(savePath))
{
return true;
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("[DOWNLOAD] Файл поврежден, повторная загрузка...");
File.Delete(savePath);
return false;
}
}
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"\n[DOWNLOAD] Ошибка: {ex.Message}");
return false;
}
}
static bool IsZipValid(string zipPath)
{
try
{
if (!File.Exists(zipPath))
return false;
FileInfo fileInfo = new FileInfo(zipPath);
if (fileInfo.Length < 22)
return false;
using (FileStream fs = new FileStream(zipPath, FileMode.Open, FileAccess.Read))
{
byte[] buffer = new byte[4];
fs.Read(buffer, 0, 4);
if (buffer[0] == 0x50 && buffer[1] == 0x4B)
return true;
}
return false;
}
catch
{
return false;
}
}
static void ExtractArchive(string archivePath, string extractPath)
{
try
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("\n[raspakovka nax] Установка файлов...");
// Используем PowerShell
string psCommand = $@"
Add-Type -AssemblyName System.IO.Compression.FileSystem
$zip = [System.IO.Compression.ZipFile]::OpenRead('{archivePath.Replace("'", "''")}')
$dest = '{extractPath.Replace("'", "''")}'
foreach ($entry in $zip.Entries) {{
$path = [System.IO.Path]::Combine($dest, $entry.FullName)
if ($entry.Name -eq '') {{
if (-not (Test-Path $path)) {{
New-Item -ItemType Directory -Path $path -Force | Out-Null
}}
}} else {{
$dir = [System.IO.Path]::GetDirectoryName($path)
if (-not (Test-Path $dir)) {{
New-Item -ItemType Directory -Path $dir -Force | Out-Null
}}
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $path, $true)
}}
}}
$zip.Dispose()
Write-Host 'OK'
";
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = "powershell.exe",
Arguments = $"-NoProfile -ExecutionPolicy Bypass -Command \"{psCommand}\"",
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true,
RedirectStandardError = true
};
using (Process process = Process.Start(psi))
{
process.WaitForExit(60000);
if (process.ExitCode == 0)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("[UNZIP] Установка завершена!");
return;
}
}
throw new Exception("Не удалось распаковать архив");
}
catch (Exception ex)
{
throw new Exception($"Не удалось распаковать файлы: {ex.Message}");
}
}
static void RunMinecraft(string jarPath, string workingDir)
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("\n[LAUNCH] Запуск Minecraft 1.16.5...\n");
Thread.Sleep(1000);
if (!File.Exists(jarPath))
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"[ОШИБКА] Файл не найден: {jarPath}");
return;
}
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"[INFO] Найден файл: {Path.GetFileName(jarPath)}");
// Запускаем Minecraft со всеми необходимыми параметрами
RunMinecraftWithAllParams(GetJavaPath(), jarPath, workingDir);
}
static void RunMinecraftWithAllParams(string javaPath, string jarFile, string workingDir)
{
try
{
// Генерируем случайный токен доступа
string accessToken = GenerateAccessToken();
string uuid = GenerateUUID();
string username = "FobosPlayer";
// Пути к папкам
string gameDir = workingDir;
string assetsDir = Path.Combine(workingDir, "assets");
string nativesDir = FindNativesDir(workingDir);
// Создаем папку assets если её нет
if (!Directory.Exists(assetsDir))
{
Directory.CreateDirectory(assetsDir);
}
// Формируем classpath
string classpath = BuildClasspath(workingDir, jarFile);
// Основной класс Minecraft
string mainClass = "net.minecraft.client.main.Main";
// Все аргументы для Minecraft (полный набор)
string mcArgs = $"--username {username} " +
$"--version 1.16.5 " +
$"--gameDir \"{gameDir}\" " +
$"--assetsDir \"{assetsDir}\" " +
$"--assetIndex 1.16 " +
$"--uuid {uuid} " +
$"--accessToken {accessToken} " +
$"--userType legacy " +
$"--versionType release " +
$"--width 854 " +
$"--height 480";
// Аргументы Java
string javaArgs = $"-Xmx2G " +
$"-Djava.library.path=\"{nativesDir}\" " +
$"-cp \"{classpath}\" " +
$"{mainClass} " +
$"{mcArgs}";
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("[INFO] Запуск Minecraft с полными параметрами...");
Console.WriteLine("[INFO] Игрок: FobosPlayer");
Console.WriteLine("[INFO] Версия: 1.16.5");
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = javaPath,
Arguments = javaArgs,
WorkingDirectory = workingDir,
UseShellExecute = false,
CreateNoWindow = false,
WindowStyle = ProcessWindowStyle.Normal
};
Process process = Process.Start(startInfo);
if (process != null)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("\n[SUCCESS] Minecraft 1.16.5 успешно запущен!");
Console.WriteLine("[INFO] Приятной игры!");
Console.WriteLine("[INFO] Закройте это окно после завершения игры.\n");
}
else
{
throw new Exception("Не удалось запустить процесс");
}
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"[ОШИБКА] Запуск не удался: {ex.Message}");
Console.WriteLine("[INFO] Пробуем упрощенный способ запуска...");
// Упрощенный способ через bat файл
RunSimpleBatLaunch(javaPath, jarFile, workingDir);
}
}
static string FindNativesDir(string workingDir)
{
// Ищем папку с библиотеками
string[] possibleNatives = {
Path.Combine(workingDir, "natives"),
Path.Combine(workingDir, "bin", "natives"),
Path.Combine(workingDir, "versions", "1.16.5", "natives"),
Path.Combine(workingDir, "1.16.5", "natives")
};
foreach (string dir in possibleNatives)
{
if (Directory.Exists(dir))
return dir;
}
// создаем пустую папку
string defaultNatives = Path.Combine(workingDir, "natives");
if (!Directory.Exists(defaultNatives))
Directory.CreateDirectory(defaultNatives);
return defaultNatives;
}
static string BuildClasspath(string workingDir, string mainJar)
{
var classpathEntries = new System.Collections.Generic.List<string>();
// Добавляем основной jar
classpathEntries.Add(mainJar);
// Ищем все jar файлы в различных папках
string[] searchFolders = {
"libraries",
"libs",
"versions/1.16.5",
"bin",
"1.16.5"
};
foreach (string folder in searchFolders)
{
string folderPath = Path.Combine(workingDir, folder);
if (Directory.Exists(folderPath))
{
foreach (string jar in Directory.GetFiles(folderPath, "*.jar", SearchOption.AllDirectories))
{
if (!classpathEntries.Contains(jar) && jar != mainJar)
classpathEntries.Add(jar);
}
}
}
// Также ищем в корневой папке
foreach (string jar in Directory.GetFiles(workingDir, "*.jar"))
{
if (!classpathEntries.Contains(jar) && jar != mainJar)
classpathEntries.Add(jar);
}
return string.Join(";", classpathEntries);
}
static string GenerateAccessToken()
{
// Генерируем случайный токен доступа
return Guid.NewGuid().ToString().Replace("-", "");
}
static string GenerateUUID()
{
// Генерируем UUID
return Guid.NewGuid().ToString();
}
static void RunSimpleBatLaunch(string javaPath, string jarFile, string workingDir)
{
try
{
string accessToken = GenerateAccessToken();
string uuid = GenerateUUID();
string nativesDir = FindNativesDir(workingDir);
string assetsDir = Path.Combine(workingDir, "assets");
string batContent = $@"@echo off
echo Запуск Minecraft 1.16.5...
echo.
""{javaPath}"" -Xmx2G -Djava.library.path=""{nativesDir}"" -cp ""{jarFile}"" net.minecraft.client.main.Main --username FobosPlayer --version 1.16.5 --gameDir ""{workingDir}"" --assetsDir ""{assetsDir}"" --assetIndex 1.16 --uuid {uuid} --accessToken {accessToken} --userType legacy --versionType release --width 854 --height 480
echo.
echo Игра завершена. Нажмите любую клавишу для выхода...
pause";
string batPath = Path.Combine(workingDir, "launch_minecraft.bat");
File.WriteAllText(batPath, batContent);
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = batPath,
WorkingDirectory = workingDir,
UseShellExecute = true
};
Process.Start(startInfo);
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("\n[SUCCESS] Minecraft запущен через bat файл!");
Console.WriteLine("[INFO] Файл запуска: launch_minecraft.bat");
Console.WriteLine("[INFO] Вы можете использовать его для повторного запуска.\n");
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"[ОШИБКА] Не удалось создать bat файл: {ex.Message}");
Console.WriteLine("\n[INFO] Попробуйте запустить Minecraft вручную командой:");
Console.WriteLine($"java -Xmx2G -cp \"{jarFile}\" net.minecraft.client.main.Main --username FobosPlayer --version 1.16.5 --gameDir \"{workingDir}\" --assetsDir \"{workingDir}\\assets\" --assetIndex 1.16 --accessToken dummy_token");
}
}
static string GetJavaPath()
{
// Список возможных путей Java
string[] possibleJavaPaths = {
@"C:\Program Files\Java\jre1.8.0_301\bin\javaw.exe",
@"C:\Program Files\Java\jre1.8.0_301\bin\java.exe",
@"C:\Program Files\Java\jre1.8.0_291\bin\javaw.exe",
@"C:\Program Files\Java\jre1.8.0_291\bin\java.exe",
@"C:\Program Files\Java\jdk1.8.0_301\bin\javaw.exe",
@"C:\Program Files\Java\jdk1.8.0_301\bin\java.exe",
@"C:\Program Files (x86)\Java\jre1.8.0_301\bin\javaw.exe",
@"C:\Program Files (x86)\Java\jre1.8.0_301\bin\java.exe",
@"C:\Program Files (x86)\Minecraft Launcher\runtime\java-runtime-alpha\windows-x64\java-runtime-alpha\bin\javaw.exe",
@"C:\Program Files (x86)\Minecraft Launcher\runtime\java-runtime-alpha\windows-x64\java-runtime-alpha\bin\java.exe"
};
foreach (string javaPath in possibleJavaPaths)
{
if (File.Exists(javaPath))
return javaPath;
}
// Пробуем найти через системную переменную PATH
try
{
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = "where",
Arguments = "java",
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
};
Process p = Process.Start(psi);
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
if (!string.IsNullOrEmpty(output))
{
string javaFromPath = output.Split('\n')[0].Trim();
if (File.Exists(javaFromPath))
return javaFromPath;
}
}
catch { }
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("[WARN] Java не найдена, пробуем использовать 'java' из PATH");
return "java";
}
static string ReadPassword()
{
string password = "";
ConsoleKeyInfo key;
do
{
key = Console.ReadKey(true);
if (key.Key != ConsoleKey.Backspace && key.Key != ConsoleKey.Enter)
{
password += key.KeyChar;
Console.Write("*");
}
else if (key.Key == ConsoleKey.Backspace && password.Length > 0)
{
password = password.Substring(0, password.Length - 1);
Console.Write("\b \b");
}
}
while (key.Key != ConsoleKey.Enter);
return password;
}
static void PrintASCIIArt()
{
string[] art = {
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%#############%##%%%%%%%%%%%##########*##########################%%%%%%%%",
"%%%%%%%#####*********#%%##************####****************####**+++++++++++**####*++++++++++++++#%%%",
"%%%%%*++++++++++++++++%*+==============+##===-------------=##=----:::::::::::+#*:::::::::::::::-*#%%",
"%%%%%+++*#############%*==#%%%%%%%%%%===*#=-=+******++++---#*---######*****::=*+::=++++++++++++*##%%",
"%%%%%++++++++++++++++*%*==#%%%%%%%%%%===*#=----------------#*-:-########**+::=**+-::::::::::::::=###",
"%%%%%+++#%%%%%%%%%%%%%%*==***********===##=--+++++++++++---#*=:-++++++++++=::=**+++++====+++==::-###",
"%%%%%+++#%%%%%%%%%%%%%%%#+============+#%%=--------------=####=:::::::::::::=***:::::::::::::::+###%",
"@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%##################################*********#############%%",
"@@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%########################*#########****************#*****##%",
"@@@%%#*++++++++++++++%#++#%%%%%%%%%%%%%#=-=##*-----------:::=**::::-+######+::+*::::::::::::::::+###",
"%%%%***#%%#%%%%%%%%%%%#++#%%%%%%%%%%%%%#=-=#*---##***#********-::-:::-+###*+::+**#####+::=#######%%%",
"%%%%#***%%%%%%%%%%%%%%#++#%%%%%%%%%%%%%#=-=#+---------::::::=*-::=#+-::-=**+::***#####+::=######%%%%",
"@@%%***#%%%%%%%%%%%%%%#++#%%%%%%%%%%%%%#=-=#*---####**********-::+###*-:::=+::*#####**+::=#####%%%%%",
"@@@@%************+++*%%*+++++=========+#=-=##+----------::::=*-::+#####*=:::::*#######+::=#########%",
"@@@@@@@%%%%%%%%%%%%%%%%%%%##%%#%%%####%%###%%%##########################*#**#############*#######%#%",
"СЛИТО НА YOUGAME !! СЛИТО НА YOUGAME "
};
foreach (string line in art)
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine(line);
Thread.Sleep(10);
}
}
}
// Класс для хранения данных пользователя
class User
{
public string Login { get; set; }
public string Password { get; set; }
public string DisplayName { get; set; }
public User(string login, string password, string displayName = null)
{
Login = login;
Password = password;
DisplayName = displayName ?? login;
}
}
}
SS :
вам надо будет самим настроить .bat файл чтобы оно работало (хотя думаю у некоторых запустит)