private void Play(VersionJson json) { Launch.Login.IAuth auth; if (string.IsNullOrWhiteSpace(MeCore.Config.DefaultAuth)) { ACSelect ac = new ACSelect(); ac.ShowDialog(); auth = ac.auth; } else { SavedAuth dauth; MeCore.Config.SavedAuths.TryGetValue(MeCore.Config.DefaultAuth, out dauth); if (dauth == null) { ACSelect ac = new ACSelect(); ac.ShowDialog(); auth = ac.auth; } else auth = dauth.AuthType.Equals("Yggdrasil") ? new Launch.Login.YggdrasilRefreshAuth(dauth.AccessToken) : new Launch.Login.AuthWarpper(new Launch.Login.AuthInfo { Pass = true, DisplayName = MeCore.Config.DefaultAuth, Session = dauth.AccessToken, UUID = dauth.UUID, UserType = dauth.UserType, Prop = dauth.Properies }) as Launch.Login.IAuth; } /*ACLogin ac = new ACLogin(); ac.ShowDialog(); auth = ac.auth;*/ if (auth == null) { return; } MeCore.MainWindow._LaunchOptions = Launch.LaunchGameInfo.CreateInfo(MeCore.Config.MCPath, auth, json, MeCore.Config.Javaw, (int)MeCore.Config.Javaxmx, CreateServerInfo()); MeCore.MainWindow.launchFlyout.IsOpen = true; Back(); }
public PlaySetting(PlayNew parent, Versions.VersionJson mcver) : this() { this.parent = parent; mcversion = mcver; DataContext = mcversion; if (mcversion.errored) { tabAssets.Visibility = Visibility.Collapsed; tabLib.Visibility = Visibility.Collapsed; tabs.SelectedIndex = 2; butPlay.IsEnabled = false; butDLAssets.IsEnabled = false; gridMissInherit.Visibility = Visibility.Visible; if (mcversion.baseErrored) butDLtoFix.Visibility = Visibility.Collapsed; } }
public static VersionJson GetFurtherVersion(string MCPath, VersionJson version) { VersionJson shadow = version; if (shadow == null) return null; if (string.IsNullOrWhiteSpace(shadow.inheritsFrom)) { return shadow; } VersionJson deep = GetFurtherVersion(MCPath, shadow.inheritsFrom); if (deep != null) { if (string.IsNullOrWhiteSpace(shadow.assets)) { shadow.assets = deep.assets ?? "legacy"; } if (string.IsNullOrWhiteSpace(shadow.mainClass)) { shadow.mainClass = deep.mainClass; } if (string.IsNullOrWhiteSpace(shadow.minecraftArguments)) { shadow.minecraftArguments = deep.minecraftArguments; } if (string.IsNullOrWhiteSpace(shadow.jar)) { shadow.jar = deep.jar; } shadow.libraries = shadow.libraries.Concat(deep.libraries).ToArray(); if (deep.errored) { shadow.errored = true; shadow.baseErrored = true; } } else { Logger.log(string.Format("Inherit version {0} doesn't have a valid base version {1}. Skip it.", shadow.id, shadow.inheritsFrom)); shadow.errored = true; return shadow; } return shadow; }
public static void BackupJson(string file, VersionJson json) { file = file + ".bak"; TextWriter writer = File.CreateText(file); writer.Write(JsonConvert.SerializeObject(json, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore })); writer.Close(); }