public Mod(ModType type, ModLevel level, string name, string path, TinyMinecraftVersion version) { this.type = type; this.level = level; this.name = name; this.path = path; this.version = version; }
public MinecraftVersionControl(TinyMinecraftVersion version) { InitializeComponent(); this.version = version; this.Tag = version; this.label_verName.Content = version.Key + " - " + version.Type.ToString(); Update(); this.MouseDoubleClick += MinecraftVersionControl_MouseDoubleClick; }
public static void LoadJson(string json) { versions = new List <TinyMinecraftVersion>(); JObject obj = JObject.Parse(json); foreach (JObject obj2 in obj["versions"].Children <JObject>()) { TinyMinecraftVersion mcv = new TinyMinecraftVersion(); mcv.Key = (string)obj2["id"]; try { mcv.Type = (ReleaseType)Enum.Parse(typeof(ReleaseType), (string)obj2["type"]); } catch { mcv.Type = ReleaseType.unknown; } versions.Add(mcv); } }
public static void LoadJson(string json) { versions = new List<TinyMinecraftVersion>(); JObject obj = JObject.Parse(json); foreach (JObject obj2 in obj["versions"].Children<JObject>()) { TinyMinecraftVersion mcv = new TinyMinecraftVersion(); mcv.Key = (string)obj2["id"]; try { mcv.Type = (ReleaseType)Enum.Parse(typeof(ReleaseType), (string)obj2["type"]); } catch { mcv.Type = ReleaseType.unknown; } versions.Add(mcv); } }
private void lb_SelectionChanged(object sender, SelectionChangedEventArgs e) { if ((sender as ListBox).SelectedIndex != -1) { if (sender != lb_release) lb_release.SelectedIndex = -1; if (sender != lb_snapshot) lb_snapshot.SelectedIndex = -1; if (sender != lb_instance) lb_instance.SelectedIndex = -1; this.version = (((sender as ListBox).SelectedItem as ListBoxItem).Tag as TinyMinecraftVersion); } }
void bt_Click(object sender, System.Windows.RoutedEventArgs e) { if (changingVersion) { MessageBox.ShowDialog("Warning", "The version is currently being changed/downloaded! Cannot change now!"); } else { ChangeMCVersion cv = new ChangeMCVersion(); if (cv.ShowDialog() == true) { this.changingVersion = true; TinyMinecraftVersion prevVer = this.Version; this.Version = cv.version; try { Task.Factory.StartNew(delegate { if (!File.Exists(cv.version.FullVersion.BinaryPath)) { Download dl = cv.version.FullVersion.ScheduleJarDownload(); PluginAPI.PluginManager.onVersionDownload(dl); DownloadPackage dp = new DownloadPackage("Libraries", true); dp.ShouldContinue = true; cv.version.FullVersion.Libraries.ForEach(l => { if (!File.Exists(l.Extractpath)) { l.ScheduleExtract(dp); } }); if (dp.getDownloads().Count > 0) DownloadManager.ScheduleDownload(dp); dl.WaitForComplete(); CopyJar(); App.InvokeAction(delegate { (App.mainWindow.listBox_instanceInfo.Items[0] as Label).Content = (this.Version == null ? "no version" : this.Version.Key); App.mainWindow.UpdateInstances(); }); this.changingVersion = false; } else { CopyJar(); App.InvokeAction(delegate { (App.mainWindow.listBox_instanceInfo.Items[0] as Label).Content = (this.Version == null ? "no version" : this.Version.Key); App.mainWindow.UpdateInstances(); }); this.changingVersion = false; } }); } catch (Exception ex) { MCM.Utils.MessageBox.ShowDialog("Error", "The selected version could not be changed because: " + ex.Message); this.Version = prevVer; (App.mainWindow.listBox_instanceInfo.Items[0] as Label).Content = (this.Version == null ? "no version" : this.Version.Key); App.mainWindow.UpdateInstances(); this.changingVersion = false; } } PluginManager.onChangeVersion(this); } }