private static void Main(string[] args) { ///Booting Mods. /// LoadService.Setup(); var mods = LoadService.GetListOfMods(); var rules = RuleService.GetRules(); File.WriteAllText("rules.json", JsonConvert.SerializeObject(rules)); var orderedList = RuleService.OrderMods(mods); }
public MainWindow() { try { InitializeComponent(); this.Title = $"[v{Assembly.GetExecutingAssembly().GetName().Version.ToString(2)}] - {this.Title}"; if (SystemParameters.PrimaryScreenWidth >= 1000) { this.Width = 1000; } else if (SystemParameters.PrimaryScreenWidth >= 750) { this.Width = 750; } CmbSortBy.ItemsSource = Enum.GetValues(typeof(EnumOrder)).Cast <EnumOrder>().Select(sort => new ComboData { Id = (int)sort, Value = $"Sort By: {sort}" }); CmbSortBy.SelectedItem = CmbSortBy.Items.GetItemAt(0); MainGrid.ShowGridLines = false; lblSearchInfo.Content = ""; RtbDetail.Document.Blocks.Clear(); Style itemContainerStyle = new Style(typeof(ListBoxItem)); itemContainerStyle.Setters.Add(new Setter(ListBoxItem.AllowDropProperty, true)); itemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(PreviewDragAndDrop))); itemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.DropEvent, new DragEventHandler(SetDropAction))); ListBox.ItemContainerStyle = itemContainerStyle; LoadService.Setup(); AskGamePathIfRequired(); AskSteamPathIfRequired(); LoadService.SaveConfig(); LoadModList(); } catch (Exception ex) { File.AppendAllText(Constants.Errorfile, $"{DateTime.Now} - {ex.Message}.{Environment.NewLine}"); File.AppendAllText(Constants.Errorfile, $"{ex.StackTrace} {Environment.NewLine}"); } }
public MainWindow() { try { InitializeComponent(); AutoUpdater.DownloadPath = Environment.CurrentDirectory; string jsonPath = Path.Combine(Environment.CurrentDirectory, "updateSettings.json"); AutoUpdater.PersistenceProvider = new JsonFilePersistenceProvider(jsonPath); this.Title = $"[v{Assembly.GetExecutingAssembly().GetName().Version.ToString(2)}] - {this.Title}"; if (SystemParameters.PrimaryScreenWidth >= 1000) { this.Width = 1000; } else if (SystemParameters.PrimaryScreenWidth >= 750) { this.Width = 750; } MainGrid.ShowGridLines = false; lblSearchInfo.Content = ""; RtbDetail.Document.Blocks.Clear(); lsView.Items.Clear(); Style itemContainerStyle = lsView.ItemContainerStyle; itemContainerStyle.Setters.Add(new Setter(ListViewItem.AllowDropProperty, true)); itemContainerStyle.Setters.Add(new EventSetter(ListViewItem.PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(PreviewDragAndDrop))); itemContainerStyle.Setters.Add(new EventSetter(ListViewItem.DropEvent, new DragEventHandler(SetDropAction))); lsView.ContextMenuOpening += LsView_ContextMenuOpening; LoadService.Setup(); AskGamePathIfRequired(); AskSteamPathIfRequired(); LoadService.SaveConfig(); LoadModList(); if (ModList.Count > 0) { var files = Directory.GetFiles(Directory.GetCurrentDirectory(), $"{Constants.BackupSubscribeList}*").OrderBy(c => c); if (files.Count() > LoadService.config.MaxLogFiles) { File.Delete(files.FirstOrDefault()); } File.WriteAllText($"{Constants.BackupSubscribeList}{DateTime.Now:yyyyMMddHHmmss}.info", string.Join(Environment.NewLine, ModList.Where(c => c.Source == SourceEnum.Steam).Select(q => q.Id))); } Dispatcher.BeginInvoke(new Action(() => { var source = ((GridView)lsView.View).Columns[2].Header as GridViewColumnHeader; SortHeaderClick(source, null); if (LoadService.config.CheckForUpdatesAutomatically) { AutoUpdater.Start($"{Constants.UpdateListUrl}?{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}"); updateTimer.Start(); } }), System.Windows.Threading.DispatcherPriority.ContextIdle, null); updateTimer.Elapsed += UpdateTimer_Elapsed; } catch (Exception ex) { Logging.WriteError(ex); } }
public HomeController() { LoadService.Setup(); }
public static void conflict() { var stopwatch = Stopwatch.StartNew(); var filename = "changes.json"; var detailsFilename = "detail.json"; //if (args.Length > 0) //{ // filename = args[0]; // if (args.Length > 1) // detailsFilename = args[1]; //} ///Booting Mods. /// LoadService.Setup(); var mods = LoadService.GetListOfMods(); var orderedList = RuleService.OrderMods(mods); var changes = new Dictionary <string, List <Dictionary <string, string> > >(); var cm = new ConflictManager(); var ordered = mods.OrderBy(c => c.Order).ToList(); var baseGameData = new GameData(); foreach (var item in new string[6] { "gamedata.base", "Newwworld.mod", "Dialogue.mod", "Vitali.mod", "Nizu.mod", "rebirth.mod" }) { cm.LoadMods(Path.Combine(LoadService.config.GamePath, "data", item), ModMode.BASE, baseGameData); } foreach (var mod in ordered) { cm.LoadMods(mod.FilePath, ModMode.ACTIVE, baseGameData); } baseGameData.resolveAllReferences(); cm.LoadBaseChanges(baseGameData); baseGameData = null; foreach (var mod in ordered) { Console.WriteLine($"{mod.DisplayName} Loading..."); var gd = new GameData(); cm.LoadMods(mod.FilePath, ModMode.ACTIVE, gd); cm.ListOfGameData.Add(gd); } cm.LoadChanges(); stopwatch.Stop(); Console.WriteLine(stopwatch.ElapsedMilliseconds / 1000 + " Seconds Elapsed"); if (!Directory.Exists("reports")) { Directory.CreateDirectory("reports"); } Console.WriteLine("writing reports"); var list = new Task[] { Task.Run(() => { File.WriteAllText(filename, JsonConvert.SerializeObject(cm.conflictIndex)); }), Task.Run(() => { File.WriteAllText(detailsFilename, JsonConvert.SerializeObject(cm.DetailIndex)); }), Task.Run(() => { foreach (var item in cm.listOfTags) { File.WriteAllText($"reports/{item.Key}", JsonConvert.SerializeObject(item.Value.Select(c => c.ToString()))); } }) }; Task.WaitAll(list); }