Exemplo n.º 1
0
        public void Patch(string filename, LauncherProfileData data)
        {
            if (!File.Exists(filename))
            {
                Downloader.Download(defaultLauncherProfile, filename);
            }

            UpdateLauncherProfile(filename, data);
        }
Exemplo n.º 2
0
        private void UpdateLauncherProfile(string filename, LauncherProfileData data)
        {
            JObject json = ReadProfile(filename);

            UpdateProfile(ref json, data);

            WriteProfile(json, filename);

            OutputConsole.Print($"[Updated] {filename}.");
        }
Exemplo n.º 3
0
 private JProperty CreateForgeProfile(LauncherProfileData data)
 {
     return(new JProperty("forge", new JObject(
                              CreateName(data),
                              CreateType(data),
                              CreateCreated(data),
                              CreateLastUsed(data),
                              CreateIcon(data),
                              CreateLastVersionId(data),
                              CreateGameDirectory(data),
                              CreateResolution(),
                              CreateJavaArgs(data)
                              )));
 }
Exemplo n.º 4
0
        private LauncherProfileData ReadLauncherProfileData(XElement launcherProfile)
        {
            LauncherProfileData result = new LauncherProfileData
            {
                Name          = XElementExtender.ReadName(launcherProfile),
                Type          = XElementExtender.ReadString(launcherProfile, "type"),
                Icon          = XElementExtender.ReadString(launcherProfile, "icon"),
                LastVersionId = XElementExtender.ReadString(launcherProfile, "lastVersionId"),
                JavaArgs      = XElementExtender.ReadString(launcherProfile, "javaArgs"),
                GameDirectory = XElementExtender.ReadString(launcherProfile, "gameDir")
            };

            OutputConsole.PrintVerbose(result, 1);
            return(result);
        }
Exemplo n.º 5
0
 private JProperty CreateLastVersionId(LauncherProfileData data)
 {
     return(new JProperty("lastVersionId", data.LastVersionId));
 }
Exemplo n.º 6
0
 private JProperty CreateIcon(LauncherProfileData data)
 {
     return(new JProperty("icon", data.Icon));
 }
Exemplo n.º 7
0
 private JProperty CreateLastUsed(LauncherProfileData data)
 {
     return(new JProperty("lastUsed", data.LastUsed));
 }
Exemplo n.º 8
0
 private JProperty CreateCreated(LauncherProfileData data)
 {
     return(new JProperty("created", data.Created));
 }
Exemplo n.º 9
0
 private JProperty CreateType(LauncherProfileData data)
 {
     return(new JProperty("type", data.Type));
 }
Exemplo n.º 10
0
 private JProperty CreateName(LauncherProfileData data)
 {
     return(new JProperty("name", data.Name));
 }
Exemplo n.º 11
0
 private void UpdateProfile(ref JObject json, LauncherProfileData data)
 {
     json["profiles"] = new JObject(CreateForgeProfile(data));
 }
Exemplo n.º 12
0
        private JProperty CreateJavaArgs(LauncherProfileData data)
        {
            Regex rgx = new Regex("-Xmx\\d+G");

            return(new JProperty("javaArgs", rgx.Replace(data.JavaArgs, $"-Xmx{Settings.Default.RAM}G")));
        }
Exemplo n.º 13
0
        private JProperty CreateGameDirectory(LauncherProfileData data)
        {
            string gameDir = Path.Combine(Paths.ExecutingDirectory, data.GameDirectory);

            return(new JProperty("gameDir", gameDir));
        }