Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.80 KB | None | 0 0
  1. JObject json = JObject.Parse(File.ReadAllText(cnfg.folder + u_core + "core.json"));
  2.                     JArray libraries = (JArray)json["libraries"];
  3.                     JArray modLibraries = (JArray)json["modsLibraries"];
  4.  
  5.                     string libs = "";
  6.  
  7.                     foreach (JObject lib in libraries)
  8.                     {
  9.                         if (lib["artifact"] != null)
  10.                             libs += cnfg.folder + u_other + "libraries\\" + ((string)lib["artifact"]["path"]).Replace("/", "\\") + ';';
  11.                         else if(lib["packed"] != null)
  12.                         {
  13.                             string lb = ((string)lib["name"]).Split(':')[0].Replace('.','\\') + '\\' + ((string)lib["name"]).Split(':')[1] + '\\'
  14.                                 + ((string)lib["name"]).Split(':')[1] + ".jar";
  15.  
  16.                             libs += cnfg.folder + u_other + "libraries\\" + lb;
  17.                         }
  18.  
  19.                         if (lib["classifies"] != null)
  20.                             if (lib["classifies"]["windows"] != null)
  21.                                 libs+= cnfg.folder + u_other + "libraries\\" + ((string)lib["classifies"]["windows"]["path"]).Replace("/", "\\") + ';';
  22.  
  23.                     }
  24.  
  25.                     foreach (JObject lib in modLibraries)
  26.                         if (lib["artifact"] != null)
  27.                             libs += cnfg.folder + u_other + "libraries\\" + ((string)lib["artifact"]["path"]).Replace("/", "\\") + ';';
  28.                          
  29.  
  30.                     string Ajava = "-Xmx${ram}M -Xms${ram}M -cp \"${core};${libs}\"".
  31.                     Replace("${ram}",cnfg.ram).
  32.                     Replace("${core}",cnfg.folder + u_core + json["id"] + ".jar").
  33.                     Replace("${libs}", libs.Substring(0,libs.Length - 1));
  34.  
  35.                     string AMinecraft = json["mainClass"] + " -Djava.library.path=" + cnfg.folder + u_core + @"natives\ "
  36.                         + ((string)json["minecraftArguments"]).
  37.                         Replace("${auth_player_name}", cnfg.nick).
  38.                         Replace("${version_name}", (string)json["id"]).
  39.                         Replace("${game_directory}", cnfg.folder + u_other).
  40.                         Replace("${assets_root}", cnfg.folder + u_other + @"assets\").
  41.                         Replace("${assets_index_name}", (string)json["assetIndex"]["id"]).
  42.                         Replace("${auth_uuid}", "00000000000000000000000000000000").
  43.                         Replace("${auth_access_token}", "0").
  44.                         Replace("${user_properties}", "{}").
  45.                         Replace("${user_type}", "legacy");
  46.                    
  47.  
  48.                     ProcessStartInfo info = new ProcessStartInfo("java",Ajava + " " + AMinecraft);
  49.                     Process.Start(info);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement