public ModDefinitionSetup() { Configuration = new ModConfiguration(); Configuration.AcceptChanges(); InitializeComponent(); ImageBrush brsh = ArtemisModLoader.Helpers.FileHelper.GetRandomSkybox(); if (brsh != null) { this.Background = brsh; } }
private void New_Click(object sender, RoutedEventArgs e) { ResetData(); ModConfiguration cfg = new ModConfiguration(); cfg.ID = "{" + Guid.NewGuid().ToString() + "}"; string wrkPath = System.IO.Path.Combine(Locations.InstalledModsPath, cfg.ID); FileHelper.CreatePath(wrkPath); FileHelper.CreatePath(Path.Combine(wrkPath, "dat")); cfg.InstalledPath = wrkPath; InstalledModConfigurations.Current.Configurations.Configurations.Add(cfg); InstalledModConfigurations.Current.Save(); cfg.AcceptChanges(); bool UseStock = true; if (ActiveModConfigurations.Current.Configurations.Configurations.Count > 1) { if (Locations.MessageBoxShow( AMLResources.Properties.Resources.SetDependsOnActivated, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { UseStock = false; foreach (ModConfiguration config in ActiveModConfigurations.Current.Configurations.Configurations) { if (!config.ID.Contains(DataStrings.StockID)) { cfg.DependsOn.Add(new StringItem(config.ID)); string fle = ArtemisModLoader.Helpers.FileHelper.LocateExpectedFileInMod("artemis.ini", config); if (!string.IsNullOrEmpty(fle)) { FileHelper.Copy(fle, Path.Combine(cfg.InstalledPath, "artemis.ini")); } fle = ArtemisModLoader.Helpers.FileHelper.LocateExpectedFileInMod("dat\\vesselData.xml", config); if (!string.IsNullOrEmpty(fle)) { FileHelper.Copy(fle, Path.Combine(cfg.InstalledPath, "dat", "vesselData.xml")); } } } cfg.AcceptChanges(); } else { UseStock = true; } } else { UseStock = true; } if (UseStock) { foreach (ModConfiguration config in ActiveModConfigurations.Current.Configurations.Configurations) { if (config.ID == DataStrings.StockID) { string fle = ArtemisModLoader.Helpers.FileHelper.LocateExpectedFileInMod("artemis.ini", config); if (!string.IsNullOrEmpty(fle)) { FileHelper.Copy(fle, Path.Combine(cfg.InstalledPath, "artemis.ini")); } fle = ArtemisModLoader.Helpers.FileHelper.LocateExpectedFileInMod("dat\\vesselData.xml", config); if (!string.IsNullOrEmpty(fle)) { FileHelper.Copy(fle, Path.Combine(cfg.InstalledPath, "dat", "vesselData.xml")); } } } } Configuration = cfg; }