private void LogicEditorReorder_Load(object sender, EventArgs e) { int lastRealItem = -1; foreach (var i in ListContent) { if (!i.IsFake) { lastRealItem = i.ID; } } listBox1.Items.Clear(); foreach (var i in ListContent) { LogicObjects.ListItem ListItem = new LogicObjects.ListItem(); ListItem.LocationEntry = i; ListItem.DisplayName = i.DictionaryName; if (i.ID > lastRealItem) { listBox1.Items.Add(ListItem); } else { SelectedItems.Add(ListItem.LocationEntry); } } }
private void BtnCreateTemplate_Click(object sender, EventArgs e) { CheckedTemplate.Clear(); listBox1.Items.Clear(); foreach (var i in CheckedItems) { CheckedTemplate.Add(i); LogicObjects.ListItem listItem = new LogicObjects.ListItem { DisplayName = UsedInstance.Logic[i].DictionaryName, PathID = UsedInstance.Logic[i].ID }; listBox1.Items.Add(listItem); } }
private void WriteToListBox() { listBox1.Items.Clear(); foreach (var i in ListContent) { LogicObjects.ListItem ListItem = new LogicObjects.ListItem(); ListItem.LocationEntry = i; switch (Display) { case 0: ListItem.DisplayName = i.DictionaryName; break; case 1: ListItem.DisplayName = i.LocationName ?? i.DictionaryName; break; case 2: ListItem.DisplayName = i.ItemName ?? i.DictionaryName; break; case 3: ListItem.DisplayName = i.SpoilerLocation[0] ?? i.LocationName ?? i.DictionaryName; break; case 4: ListItem.DisplayName = i.SpoilerItem[0] ?? i.LocationName ?? i.DictionaryName; break; case 5: ListItem.DisplayName = i.ProgressiveItemName(UsedInstance); break; case 6: ListItem.DisplayName = i.LocationName ?? i.DictionaryName; ListItem.DisplayName = (LogicEditor.UseSpoilerInDisplay) ? (i.SpoilerLocation[0] ?? ListItem.DisplayName) : ListItem.DisplayName; ListItem.DisplayName = (LogicEditor.UseDictionaryNameInSearch) ? i.DictionaryName : ListItem.DisplayName; break; } if (string.IsNullOrWhiteSpace(ListItem.DisplayName)) { ListItem.DisplayName = i.DictionaryName + "DidError"; } if (Utility.FilterSearch(ListItem.LocationEntry, textBox1.Text, ListItem.DisplayName)) { listBox1.Items.Add(ListItem); } } }
private void LbTemplate_DoubleClick(object sender, EventArgs e) { if (!(listBox1.SelectedItem is LogicObjects.ListItem)) { return; } var Item = listBox1.SelectedItem as LogicObjects.ListItem; if (CheckedTemplate.IndexOf(Item.PathID) > -1) { CheckedTemplate.RemoveAt(CheckedTemplate.IndexOf(Item.PathID)); } listBox1.Items.Clear(); foreach (var i in CheckedTemplate) { LogicObjects.ListItem listItem = new LogicObjects.ListItem { DisplayName = UsedInstance.Logic[i].DictionaryName, PathID = UsedInstance.Logic[i].ID }; listBox1.Items.Add(listItem); } }
private void WriteSpoilerItemsToBox() { listBox1.Items.Clear(); foreach (var i in CheckerInstance.Logic) { var SPOILERlOCATION = (i.IsFake) ? null : i.GetItemsSpoilerLocation(CheckerInstance.Logic); if (Utility.FilterSearch(i, textBox1.Text, i.ItemName ?? i.DictionaryName)) { if (SPOILERlOCATION != null) { var ListItem = new LogicObjects.ListItem { ItemEntry = i, LocationEntry = SPOILERlOCATION, PathID = SPOILERlOCATION.ID, DisplayName = i.ItemName ?? i.DictionaryName }; listBox1.Items.Add(ListItem); } if (i.IsFake) { var ListItem = new LogicObjects.ListItem { ItemEntry = i, LocationEntry = i, PathID = i.ID, DisplayName = i.ItemName ?? i.DictionaryName }; listBox1.Items.Add(ListItem); } } } if (listBox1.SelectedIndex < 0) { button2.Enabled = false; button3.Enabled = false; } }
//Pathfinding private void PrintPaths(int PathToPrint, int partition) { LBPathFinder.Items.Clear(); var sortedpaths = PathFinder.paths[partition].OrderBy(x => x.Count); if (PathToPrint == -1 || PathFinder.paths[partition].ElementAtOrDefault(PathToPrint) == null) { int counter = 1; foreach (var path in sortedpaths) { var ListTitle = new LogicObjects.ListItem { DisplayName = "Path: " + counter + " (" + path.Count + " Steps)", PathID = counter - 1, PathPartition = partition }; LBPathFinder.Items.Add(ListTitle); var firstStop = true; foreach (var stop in path) { var start = (firstStop) ? PathFinder.SetSOTName(LogicObjects.MainTrackerInstance, stop) : LogicObjects.MainTrackerInstance.Logic[stop.EntranceToTake].LocationName; var ListItem = new LogicObjects.ListItem { DisplayName = start + " => " + LogicObjects.MainTrackerInstance.Logic[stop.ResultingExit].ItemName, PathID = counter - 1, PathPartition = partition }; LBPathFinder.Items.Add(ListItem); firstStop = false; } LBPathFinder.Items.Add(new LogicObjects.ListItem { DisplayName = "===============================", PathID = counter - 1, PathPartition = partition }); counter++; } } else { var path = sortedpaths.ToArray()[PathToPrint]; var ListTitle = new LogicObjects.ListItem { DisplayName = "Path: " + (PathToPrint + 1) + " (" + path.Count + " Steps)", PathID = -1, PathPartition = partition }; LBPathFinder.Items.Add(ListTitle); var firstStop = true; foreach (var stop in path) { var start = (firstStop) ? PathFinder.SetSOTName(LogicObjects.MainTrackerInstance, stop) : LogicObjects.MainTrackerInstance.Logic[stop.EntranceToTake].LocationName; var ListItem = new LogicObjects.ListItem { DisplayName = start + " => " + LogicObjects.MainTrackerInstance.Logic[stop.ResultingExit].ItemName, PathID = -1, PathPartition = partition }; LBPathFinder.Items.Add(ListItem); firstStop = false; } LBPathFinder.Items.Add(new LogicObjects.ListItem { DisplayName = "===============================", PathID = -1, PathPartition = partition }); } }
private void WriteToListBox() { listView1.BeginUpdate(); Updating = true; listView1.Items.Clear(); var TempList = new List <ListViewItem>(); foreach (var i in ListContent) { LogicObjects.ListItem ListItem = new LogicObjects.ListItem { LocationEntry = i }; switch (Display) { case 0: ListItem.DisplayName = i.DictionaryName; break; case 1: ListItem.DisplayName = i.LocationName ?? i.DictionaryName; break; case 2: ListItem.DisplayName = i.ItemName ?? i.DictionaryName; break; case 3: ListItem.DisplayName = i.SpoilerLocation[0] ?? i.LocationName ?? i.DictionaryName; break; case 4: ListItem.DisplayName = i.SpoilerItem[0] ?? i.LocationName ?? i.DictionaryName; break; case 5: ListItem.DisplayName = i.ProgressiveItemName(UsedInstance); break; case 6: ListItem.DisplayName = i.LocationName ?? i.DictionaryName; ListItem.DisplayName = (LogicEditor.UseSpoilerInDisplay) ? (i.SpoilerLocation[0] ?? ListItem.DisplayName) : ListItem.DisplayName; ListItem.DisplayName = (LogicEditor.UseDictionaryNameInSearch) ? i.DictionaryName : ListItem.DisplayName; break; case 7: ListItem.DisplayName = i.ItemName ?? i.DictionaryName; ListItem.DisplayName = (LogicEditor.UseSpoilerInDisplay) ? (i.SpoilerItem[0] ?? ListItem.DisplayName) : ListItem.DisplayName; ListItem.DisplayName = (LogicEditor.UseDictionaryNameInSearch) ? i.DictionaryName : ListItem.DisplayName; break; } if (string.IsNullOrWhiteSpace(ListItem.DisplayName)) { ListItem.DisplayName = i.DictionaryName + "DidError"; } if (Utility.FilterSearch(ListItem.LocationEntry, textBox1.Text, ListItem.DisplayName)) { ListViewItem item = new ListViewItem { Text = ListItem.DisplayName, Tag = ListItem.LocationEntry }; TempList.Add(item); } } listView1.Items.AddRange(TempList.ToArray()); RecheckItems(); Updating = false; listView1.EndUpdate(); }