//bool wait = true; /// <summary> /// 生成启动参数 /// </summary> /// <returns></returns> public string BuildArguments() { string nativeDir = string.Format("{0}\\versions\\{1}\\{1}-natives", Game.PublicDirectory, Game.id);//生成natives文件夹,放那些DLL用 StringBuilder libBuilder = new StringBuilder(); foreach (var item in Game.libraries) { libBuilder.Append(item.AbsolutelyJarPath).Append(";"); if (!File.Exists(item.AbsolutelyJarPath)) { //Console.WriteLine(item.AbsolutelyJarPath); HttpDownloader hdl = new HttpDownloader(item.BmclUri, item.AbsolutelyJarPath); hdl.Work(null, new System.ComponentModel.DoWorkEventArgs(null)); //while (wait) ; //wait = true; } if (item.natives != null) { UnZip(item.AbsolutelyJarPath, nativeDir); //通通解压到natives文件夹 } } libBuilder.Append(Game.AbsolutelyJarPath).Append(";"); string libDirs = libBuilder.ToString(); StringBuilder gameArgBuilder = new StringBuilder(Game.minecraftArguments); string guid = User.SID == null?SettingProxy.GetUuidByName(User.Name) : User.SID; gameArgBuilder.Replace("${auth_player_name}", User.Name) .Replace("${version_name}", Game.id) .Replace("${game_directory}", ".") .Replace("${game_assets}", "assets") .Replace("${assets_root}", "assets") .Replace("${user_type}", "Legacy") .Replace("${assets_index_name}", Game.assets) .Replace("${auth_uuid}", guid) .Replace("${auth_access_token}", User.accessToken ?? guid) .Replace("${user_properties}", "{}"); string gameArg = gameArgBuilder.ToString(); string arguments = string.Format(Game.RefArguments, MaxMem, nativeDir, libDirs, Game.mainClass, gameArg); //FileStream fs = new FileStream(@"E:\\1.txt", FileMode.Create); //byte[] buffer = arguments.ToBytes(); //fs.Write(buffer,0,buffer.Length); //fs.Close(); return(arguments); }