public static MinecartProfile LoadProfile() { MinecartProfile profile = JsonConvert.DeserializeObject <MinecartProfile>(File.ReadAllText(settingsFileName)); if (profile.mods == null) { profile.mods = new List <Mod>(); } foreach (var mod in Directory.GetFiles(modsDirName)) { profile.mods.Add(new Mod(mod)); } if (profile.modpacks == null) { profile.modpacks = new ModpacksList(); } foreach (var modpack in Directory.GetFiles(modpacksDirName)) { Modpack pack = Modpack.Unpack(File.ReadAllText(modpack)); profile.modpacks.Add(pack); } foreach (var pack in profile.modpacks) { pack.UnpackRelatedModpacks(profile.modpacks); } Directory.CreateDirectory(profile.GameModsDir); return(profile); }
public ModpackWindow(MinecartProfile profile, Modpack modpack) { this.profile = profile; sourceModpack = modpack; currentModpack = (Modpack)modpack.Clone(); InitializeComponent(); ModpackNameTextBox.Text = currentModpack.Name; ModpackIDLabel.Content = modpack.id; foreach (var mod in currentModpack.ModsList) { ModsListBox.Items.Add(mod.Name); } ModsListBox.SelectionMode = SelectionMode.Multiple; foreach (var pack in currentModpack.ChildrenModpacks) { ModpacksListBox.Items.Add(pack.Name); } StringBuilder parentsStringBuilder = new StringBuilder(); foreach (var pack in currentModpack.ParentsModpacks) { parentsStringBuilder.Append($"{pack.Name}\n"); } ParentsModpacksTextBlock.Text = parentsStringBuilder.ToString(); ModpacksListBox.SelectionMode = SelectionMode.Multiple; RemoveModButton.IsEnabled = false; RemoveModpackButton.IsEnabled = false; UpdateLists(); }
public MinecartObjectsSelectionWindow(MinecartProfile profile, IEnumerable <IMinecartObject> allObjects, MinecartObjectGetter getter) { this.profile = profile; InitializeComponent(); foreach (var item in allObjects) { ObjectsListBox.Items.Add(item.Name); } ObjectsListBox.SelectionMode = SelectionMode.Multiple; this.getter = getter; }
public MainWindow() { InitializeComponent(); if (!MinecartProfile.Exists()) { profile = new MinecartProfile(); } profile = MinecartProfile.LoadProfile(); PathTextBox.Text = profile.gamedir; PathTextBox.IsReadOnly = true; profile.SaveSettings(); foreach (var pack in profile.modpacks) { ModpacksListBox.Items.Add(pack.Name); } EditModpackButton.IsEnabled = false; DeployButton.IsEnabled = false; }