public void Installation_Edit(string uuid, string name, MCVersion version, string directory, string iconPath = null, bool isCustom = false) { if (CurrentProfile == null) { return; } if (CurrentInstallations == null) { return; } MCProfileExtensions.GetVersionParams(version, out VersioningMode versioningMode, out string version_uuid); BLInstallation new_installation = new BLInstallation() { DisplayName = name, IconPath = (iconPath == null ? @"Furnace.png" : iconPath), IsCustomIcon = isCustom, DirectoryName = directory, VersioningMode = versioningMode, VersionUUID = version_uuid }; if (CurrentInstallations.Any(x => x.InstallationUUID == uuid)) { int index = CurrentInstallations.FindIndex(x => x.InstallationUUID == uuid); CurrentInstallations[index] = new_installation; Save(); } }
public void Installation_UpdateLP(BLInstallation installation) { if (installation == null) { return; } installation.LastPlayed = DateTime.Now; Save(); }
public void Installation_Delete(BLInstallation installation) { if (CurrentProfile == null) { return; } if (CurrentInstallations == null) { return; } CurrentInstallations.Remove(installation); Save(); }
public void Validate() { BLInstallation latest_release = new BLInstallation() { DisplayName = "Latest Release", DirectoryName = "Latest Release", VersionUUID = "latest_release", VersioningMode = VersioningMode.LatestRelease, IconPath = "Grass_Block.png", IsCustomIcon = false, ReadOnly = true, InstallationUUID = "latest_release" }; BLInstallation latest_beta = new BLInstallation() { DisplayName = "Latest Beta", DirectoryName = "Latest Beta", VersionUUID = "latest_beta", VersioningMode = VersioningMode.LatestBeta, IconPath = "Crafting_Table.png", IsCustomIcon = false, ReadOnly = true, InstallationUUID = "latest_beta" }; foreach (var profile in profiles.Values) { if (!profile.Installations.Any(x => x.InstallationUUID == latest_release.InstallationUUID && x.ReadOnly)) { Installation_Add(latest_release); } if (!profile.Installations.Any(x => x.InstallationUUID == latest_beta.InstallationUUID && x.ReadOnly)) { Installation_Add(latest_beta); } foreach (var installation in profile.Installations.Where(x => x.VersionUUID == latest_release.VersionUUID)) { installation.VersioningMode = VersioningMode.LatestRelease; } foreach (var installation in profile.Installations.Where(x => x.VersionUUID == latest_beta.VersionUUID)) { installation.VersioningMode = VersioningMode.LatestBeta; } } Save(); }
public void Installation_Add(BLInstallation installation) { if (CurrentProfile == null) { return; } if (CurrentInstallations == null) { return; } if (!CurrentInstallations.Any(x => x.InstallationUUID == installation.InstallationUUID)) { CurrentInstallations.Add(installation); Save(); } }
public void Installation_Create(string name, MCVersion version, string directory, string iconPath = null, bool isCustom = false) { if (CurrentProfile == null) { return; } if (CurrentInstallations == null) { return; } MCProfileExtensions.GetVersionParams(version, out VersioningMode versioningMode, out string version_uuid); BLInstallation new_installation = new BLInstallation() { DisplayName = name, IconPath = (iconPath == null ? @"Furnace.png" : iconPath), IsCustomIcon = isCustom, DirectoryName = directory, VersioningMode = versioningMode, VersionUUID = version_uuid }; Installation_Add(new_installation); }
public void Installation_Clone(BLInstallation installation) { if (CurrentProfile == null) { return; } if (CurrentInstallations == null) { return; } if (CurrentInstallations.Any(x => x.InstallationUUID == installation.InstallationUUID)) { string newName = installation.DisplayName; int i = 1; while (CurrentInstallations.Any(x => x.DisplayName == newName)) { newName = newName + "(" + i + ")"; i++; } Installation_Add(installation.Clone(newName)); } }