public override bool SetProperty( string propertyName, string value, string[] source, ref int line ) { switch ( propertyName ) { case "Name": m_name = value; break; case "Comment": m_comment = Parser.ParseComment( value, source, ref line ); break; case "Category Entry": CategoryEntry category = new CategoryEntry(); category.Parse( source, ref line, OwnerProject ); break; case "Sound Entry": WorkspaceSoundEntry sound = new WorkspaceSoundEntry(); sound.Parse( source, ref line, OwnerProject ); break; default: return false; } return true; }
// Convenience Accessors public void Insert(int index, CategoryEntry category) { if (category == null) { throw FxTrace.Exception.ArgumentNull("category"); } this.Items.Insert(index, category); }
public JsonResult Update(CategoryEntry VE) { int code = VE.CATEGORY.CATE_CD; var Q = DB.CATEGORY.Where(M => M.CATE_CD == code).FirstOrDefault(); Q.CATE_NM = VE.CATEGORY.CATE_NM; Q.CATE_DESC = VE.CATEGORY.CATE_DESC; DB.SaveChanges(); return(Json("Success", JsonRequestBehavior.AllowGet)); }
// <summary> // Looks for and returns CategoryContainer for the specified CategoryEntry. Returns null if not // found. // </summary> // <param name="category">CategoryEntry to look for.</param> // <returns>Corresponding CategoryContainer if found, null otherwise.</returns> internal CategoryContainer FindCategoryEntryVisual(CategoryEntry category) { if (category == null) { return(null); } CiderCategoryContainer categoryContainer = this.ItemContainerGenerator.ContainerFromItem(category) as CiderCategoryContainer; return(categoryContainer); }
void SelectedEntries_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { // Only set the selected entry if we have one item selected. Otherwise it sets it to null // as we don't support multi-entry editing. if (SelectedEntries.Count == 1) { SelectedEntry = SelectedEntries[0]; } else { SelectedEntry = null; } }
public ActionResult GetCategories(int?parentId = null) { var all = _categoryService.Query().Select(c => new CategoryEntry { Id = c.Id, Name = c.Name, ParentId = c.ParentId }) .ToList(); var tree = CategoryEntry.BuildCategoryTree(parentId, all); return(JsonNet(tree)); }
// ISelectionPathInterpreter Members public DependencyObject ResolveSelectionPath(CategoryList root, SelectionPath path, out bool pendingGeneration) { pendingGeneration = false; if (path == null || !string.Equals(PathTypeId, path.PathTypeId)) { Debug.Fail("Invalid SelectionPath specified."); return(null); } if (root == null) { Debug.Fail("No CategoryList specified."); return(null); } string[] pathValues = path.Path.Split(','); string categoryName = PersistedStateUtilities.Unescape(pathValues[0]); bool isAdvanced = pathValues.Length == 2; CategoryEntry category = root.FindCategory(categoryName); if (category == null) { return(null); } DependencyObject categoryVisual = root.FindCategoryEntryVisual(category); if (categoryVisual == null) { return(null); } DependencyObject searchStart; // For basic section, start at the root. // For advanced section, start at the advanced expander. // The next SelectionStop in both cases will be the section header SelectionStop. if (!isAdvanced) { searchStart = categoryVisual; } else { searchStart = VisualTreeUtils.GetNamedChild <FrameworkElement>(categoryVisual, "PART_AdvancedExpander"); } return(PropertySelection.FindNeighborSelectionStop <DependencyObject>(searchStart, SearchDirection.Next)); }
public void InsertAlphabetically(CategoryEntry category) { // POSSIBLE OPTIMIZATION: optimize using the fact that the list of categories in this // collection is ordered. int index = 0; for (; index < this.Count; index++) { if (string.Compare(category.CategoryName, this[index].CategoryName, StringComparison.CurrentCulture) < 0) { break; } } this.Insert(index, category); }
// Visual Lookup Helpers // <summary> // Looks for and returns the PropertyContainer used to represent the specified PropertyEntry. Returns // null if not found. // </summary> // <param name="property">PropertyEntry to look up</param> // <param name="parentCategory">Category to examine</param> // <param name="pendingGeneration">Set to true if the specified property exists in a collapsed container // (CategoryContainer or an advanced section). If so, the section is expanded, but the visual does not // exist yet and should be requested later. // </param> // <returns>PropertyContainer for the specified PropertyEntry if found, null otherwise</returns> internal PropertyContainer FindPropertyEntryVisual(PropertyEntry property, CategoryEntry parentCategory, out bool pendingGeneration) { pendingGeneration = false; if (property == null || parentCategory == null) { return(null); } if (property.MatchesFilter == false) { return(null); } CiderCategoryContainer categoryContainer = this.ItemContainerGenerator.ContainerFromItem(parentCategory) as CiderCategoryContainer; if (categoryContainer == null) { return(null); } // Expand the parent category, if it isn't already if (!categoryContainer.Expanded) { categoryContainer.Expanded = true; pendingGeneration = true; } // Expand the parent advanced section, if any and if it isn't already if (property.IsAdvanced && !categoryContainer.AdvancedSectionPinned) { categoryContainer.AdvancedSectionPinned = true; pendingGeneration = true; } bool pendingGenerationTemp; PropertyContainer propertyContainer = categoryContainer.ContainerFromProperty(property, out pendingGenerationTemp); pendingGeneration |= pendingGenerationTemp; if (propertyContainer != null) { pendingGeneration = false; } return(propertyContainer); }
// GET: Admin_Category public ActionResult Admin_Category() { CategoryEntry VE = new CategoryEntry(); VE.CATEGORYLIST = (from a in DB.CATEGORY select new CATEGORYLIST() { CATE_CD = a.CATE_CD, CATE_NM = a.CATE_NM, CATE_DESC = a.CATE_DESC }).ToList(); for (int i = 0; i <= VE.CATEGORYLIST.Count - 1; i++) { VE.CATEGORYLIST[i].SLNO = Convert.ToInt32(i + 1); } return(View(VE)); }
PropertyEntry GetPropertyEntry(CategoryEntry category, object parameter) { PropertyEntry property = null; IEnumerable <PropertyEntry> properties = (category == null ? null : category.Properties); if (null != properties) { if (null == parameter) { property = properties.ElementAtOrDefault <PropertyEntry>(0); } else { property = properties.FirstOrDefault <PropertyEntry>(p => string.Equals(p.DisplayName, parameter)); } } return(property); }
private void CreateNewEntry() { if (LoadedFile == null || SelectedCategory == null) { throw new InvalidOperationException("Cannot add entry to unloaded file or null category!"); } CategoryEntry entry = new CategoryEntry(); SelectedCategory.Entries.Add(entry); // Add it to our collection view source so it shows up in the filtered results... ((List <CategoryEntry>)CollViewSource.Source).Add(entry); // Clear the list of currently selected entries and then add the newly created one as the only selected one. SelectedEntries.Clear(); SelectedEntries.Add(entry); }
public ActionResult SearchCategories(string term) { var all = _categoryService.Query().Select(c => new CategoryEntry { Id = c.Id, Name = c.Name, ParentId = c.ParentId }); var categories = CategoryEntry.BuildCategoryTree(null, all); return(JsonNet(new { Items = categories, More = false }) .UsingClientConvention()); }
public JsonResult Save(CategoryEntry VE) { try { CATEGORY CAT = new CATEGORY(); Random rnd = new Random(); int id = rnd.Next(0, 9999); CAT.CATE_CD = id; CAT.CATE_NM = VE.CATEGORY.CATE_NM; CAT.CATE_DESC = VE.CATEGORY.CATE_DESC; DB.CATEGORY.Add(CAT); DB.SaveChanges(); return(Json("Success", JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(ex.Message + ex.InnerException, JsonRequestBehavior.AllowGet)); } }
public CategoryEntry convertToModel(bool includeIdentity) { var cat = new CategoryEntry(); dynamic _log = Newtonsoft.Json.JsonConvert.DeserializeObject(this.JsonLog); if (PropertyExists(_log, "ID")) { if (includeIdentity) { cat.ID = _log.ID; } } if (PropertyExists(_log, "Name")) { cat.Name = _log.Name; } return(cat); }
private void OnPluginLoaded(Plugin plugin) { var entry = GetPluginEntry(plugin); if (entry != null) { return; } // Special case for editor plugins (merge with game plugin if has linked) if (plugin is EditorPlugin editorPlugin && GetPluginEntry(editorPlugin.GamePluginType) != null) { return; } var desc = plugin.Description; var category = _categories.Find(x => string.Equals(x.Text, desc.Category, StringComparison.OrdinalIgnoreCase)); if (category == null) { category = new CategoryEntry(desc.Category) { AnchorPreset = AnchorPresets.StretchAll, Offsets = Margin.Zero, Parent = _tabs }; _categories.Add(category); category.UnlockChildrenRecursive(); } entry = new PluginEntry(plugin, category, ref desc) { Parent = category.Panel, }; _entries.Add(plugin, entry); entry.UnlockChildrenRecursive(); if (_tabs.SelectedTab == null) { _tabs.SelectedTab = category; } }
// <summary> // Returns a SelectionPath pointing to the first visible property // in the list or null if no such property exists. // </summary> // <param name="categoryList">CategoryList for reference</param> // <returns>SelectionPath pointing to the first visible property // in the list or null if no such property exists.</returns> public SelectionPath GetDefaultSelectionPath(CategoryList categoryList) { if (categoryList.Count > 0) { CategoryEntry firstCategory = categoryList[0]; if (firstCategory != null) { foreach (ModelPropertyEntry firstProperty in firstCategory.Properties) { if (firstProperty != null && firstProperty.IsBrowsable && firstProperty.MatchesFilter) { return(PropertySelectionPathInterpreter.Instance.ConstructSelectionPath(firstProperty)); } } } } return(null); }
public override bool SetProperty( string propertyName, string value, string[] source, ref int line ) { switch ( propertyName ) { case "Name": m_name = value; break; case "Comment": m_comment = Parser.ParseComment( value, source, ref line ); break; case "Public": m_public = Parser.ParseInt( value, line ); break; case "Background Music": m_backgroundMusic = Parser.ParseInt( value, line ); break; case "Volume": m_volume = Parser.ParseInt( value, line ); break; case "Category Entry": case "Parent": // So say the docs, but not the XAP file! m_parentCategory = new CategoryEntry(); m_parentCategory.Parse( source, ref line, OwnerProject ); break; case "Instance Limit": m_instanceLimit = new InstanceLimit(); m_instanceLimit.Parse( source, ref line, OwnerProject ); break; default: return false; } return true; }
private void OnAdvancedSectionPinnedChanged(object sender, EventArgs e) { // If we are in "Filter-applied" mode, don't store the expansion state, since applying // the filter automatically expands everything that matches that filter if (_currentFilter != null && !_currentFilter.IsEmpty) { return; } CiderCategoryContainer container = sender as CiderCategoryContainer; if (container != null) { CategoryEntry category = container.Category; if (category != null) { CategoryState state = _categoryStates.GetCategoryState(container.Category.CategoryName); state.AdvancedSectionExpanded = container.AdvancedSectionPinned; } } }
// Re-initialize the expansion state here and hook into the ExpandedChanged and // AdvancedSectionPinnedChanged events, because by now Blend may have ----ed those // two values up (see comment in PrepareContainerForItemOverride() ) private void OnContainerLoaded(object sender, RoutedEventArgs e) { CiderCategoryContainer container = sender as CiderCategoryContainer; if (container != null) { CategoryEntry category = container.Category; if (category != null) { // Look into stored state CategoryState state = _categoryStates.GetCategoryState(category.CategoryName); container.Expanded = state.CategoryExpanded; container.AdvancedSectionPinned = state.AdvancedSectionExpanded; // Hook into these events here, because Blend won't mess the state up at this point container.ExpandedChanged += new EventHandler(OnContainerExpandedChanged); container.AdvancedSectionPinnedChanged += new EventHandler(OnAdvancedSectionPinnedChanged); } } else { Debug.Fail("CategoryList expects the individual items to be CiderCategoryContainers"); } }
/// <summary> /// This method calculates the edit distances for all selected subjects /// scanpath with the current settings and populates the data grid views /// with the Loci and Sequence similarity matrices. /// </summary> private void RefillDistancesTable() { // Clear Existing Rows and Columns this.dgvLociSimilarity.Rows.Clear(); this.dgvLociSimilarity.Columns.Clear(); this.dgvSequenceSimilarity.Rows.Clear(); this.dgvSequenceSimilarity.Columns.Clear(); if (!this.calcDistances) { return; } // Skip if no data available if (this.scanpathsPicture.GazeFixations == null) { return; } if (this.aggregateDistancesByCategory) { var categories = new List<string>(); // Create loci similarity matrix int rows = this.selectedSubjects.Count; Array lociSimilarities = new DistanceEntry[rows, rows]; Array globalSimilarities = new DistanceEntry[rows, rows]; DataTable fixations = this.scanpathsPicture.GazeFixations; var fixationsView = new DataView( fixations, string.Empty, "CountInTrial", DataViewRowState.CurrentRows); DataTable mainTable = Document.ActiveDocument.DocDataSet.SubjectsAdapter.GetData(); foreach (DataRow row in mainTable.Rows) { string entry = row["Category"].ToString(); if (entry == string.Empty || entry == " ") { entry = "no category"; } if (!categories.Contains(entry)) { categories.Add(entry); } } int rowCounter = 0; foreach (KeyValuePair<string, ScanpathProperties> subjectRowKVP in this.selectedSubjects) { int columnCounter = 0; ////DataView fixationsOfS = new DataView( //// fixations, //// "(SubjectName='" + subjectRowKVP.Value.SubjectName + "')", //// "CountInTrial", //// DataViewRowState.CurrentRows); foreach (KeyValuePair<string, ScanpathProperties> subjectColumnKVP in this.selectedSubjects) { ////DataView fixationsOfT = new DataView( //// fixations, //// "(SubjectName='" + subjectColumnKVP.Value.SubjectName + "')", //// "CountInTrial", //// DataViewRowState.CurrentRows); ////float malsburgSimilarity = EditDistance.MalsburgDistance(sFixations, tFixations, 0.5f); List<string> rowStringList = GetStringListForExtendedString(subjectRowKVP.Value.ScanpathString); List<string> columnStringList = GetStringListForExtendedString(subjectColumnKVP.Value.ScanpathString); float localSimilarity = EditDistance.CharacterSimilarityExtended( rowStringList, columnStringList) * 100; float globalSimilarity = EditDistance.SequenceSimilarityExtended( rowStringList, columnStringList) * 100; lociSimilarities.SetValue( new DistanceEntry( categories.IndexOf(subjectRowKVP.Value.SubjectCategory), categories.IndexOf(subjectColumnKVP.Value.SubjectCategory), localSimilarity), rowCounter, columnCounter); globalSimilarities.SetValue( new DistanceEntry( categories.IndexOf(subjectRowKVP.Value.SubjectCategory), categories.IndexOf(subjectColumnKVP.Value.SubjectCategory), globalSimilarity), rowCounter, columnCounter); columnCounter++; } rowCounter++; } int mergedRows = categories.Count; Array mergedLociSimilarities = new CategoryEntry[mergedRows, mergedRows]; Array mergedGlobalSimilarities = new CategoryEntry[mergedRows, mergedRows]; // Merge categories for (int i = 0; i <= lociSimilarities.GetUpperBound(0); i++) { for (int j = 0; j <= lociSimilarities.GetUpperBound(1); j++) { // Only take values above the diagonal if (i >= j) { continue; } DistanceEntry currentLociValue = (DistanceEntry)lociSimilarities.GetValue(i, j); CategoryEntry currentCategoryValue = (CategoryEntry)mergedLociSimilarities.GetValue(currentLociValue.RowCategory, currentLociValue.ColumnCategory); currentCategoryValue.Divisor++; CategoryEntry newCategoryValue = new CategoryEntry(currentCategoryValue.Divisor, currentLociValue.DistanceValue + currentCategoryValue.DistanceValue); mergedLociSimilarities.SetValue(newCategoryValue, currentLociValue.RowCategory, currentLociValue.ColumnCategory); mergedLociSimilarities.SetValue(newCategoryValue, currentLociValue.ColumnCategory, currentLociValue.RowCategory); DistanceEntry currentGlobalValue = (DistanceEntry)globalSimilarities.GetValue(i, j); CategoryEntry currentGlobalCategoryValue = (CategoryEntry)mergedGlobalSimilarities.GetValue(currentGlobalValue.RowCategory, currentGlobalValue.ColumnCategory); currentGlobalCategoryValue.Divisor++; CategoryEntry newGlobalCategoryValue = new CategoryEntry(currentGlobalCategoryValue.Divisor, currentGlobalValue.DistanceValue + currentGlobalCategoryValue.DistanceValue); mergedGlobalSimilarities.SetValue(newGlobalCategoryValue, currentGlobalValue.RowCategory, currentGlobalValue.ColumnCategory); mergedGlobalSimilarities.SetValue(newGlobalCategoryValue, currentGlobalValue.ColumnCategory, currentGlobalValue.RowCategory); } } this.dgvLociSimilarity.Columns.Add("columnLociSubjects", "Loci Similarity"); this.dgvSequenceSimilarity.Columns.Add("columnSequenceSubjects", "Sequence Similarity"); foreach (string category in categories) { this.dgvLociSimilarity.Columns.Add(category, category); this.dgvSequenceSimilarity.Columns.Add(category, category); } // Ouput category distances for (int i = 0; i <= mergedLociSimilarities.GetUpperBound(0); i++) { var lociSimilarity = new List<object>(); var sequenceSimilarity = new List<object>(); for (int j = 0; j <= mergedLociSimilarities.GetUpperBound(1); j++) { CategoryEntry currentCategoryValue = (CategoryEntry)mergedLociSimilarities.GetValue(i, j); lociSimilarity.Add(currentCategoryValue.DistanceValue / currentCategoryValue.Divisor); CategoryEntry currentGlobalCategoryValue = (CategoryEntry)mergedGlobalSimilarities.GetValue(i, j); sequenceSimilarity.Add(currentGlobalCategoryValue.DistanceValue / currentGlobalCategoryValue.Divisor); } var lociColumns = new List<object> { categories[i] }; lociColumns.AddRange(lociSimilarity.ToArray()); this.dgvLociSimilarity.Rows.Add(lociColumns.ToArray()); var sequenceColumns = new List<object> { categories[i] }; sequenceColumns.AddRange(sequenceSimilarity.ToArray()); this.dgvSequenceSimilarity.Rows.Add(sequenceColumns.ToArray()); } } else { this.dgvLociSimilarity.Columns.Add("columnLociSubjects", "Loci Similarity"); this.dgvSequenceSimilarity.Columns.Add("columnSequenceSubjects", "Sequence Similarity"); foreach (string subject in this.selectedSubjects.Keys) { this.dgvLociSimilarity.Columns.Add(subject, subject); this.dgvSequenceSimilarity.Columns.Add(subject, subject); } this.dgvLociSimilarity.Columns.Add("columnLociString", "Scanpath string"); this.dgvSequenceSimilarity.Columns.Add("columnSequenceString", "Scanpath string"); this.dgvLociSimilarity.Columns.Add("columnLociSubjectGroup", "Subject Group"); this.dgvSequenceSimilarity.Columns.Add("columnSequenceSubjectGroup", "Subject Group"); DataTable fixations = this.scanpathsPicture.GazeFixations; ////DataView fixationsView = new DataView( //// fixations, //// string.Empty, //// "CountInTrial", //// DataViewRowState.CurrentRows); foreach (KeyValuePair<string, ScanpathProperties> subjectRowKVP in this.selectedSubjects) { var lociSimilarity = new List<object>(); var sequenceSimilarity = new List<object>(); ////DataView fixationsOfS = new DataView( //// fixations, //// "(SubjectName='" + subjectRowKVP.Value.SubjectName + "')", //// "CountInTrial", //// DataViewRowState.CurrentRows); foreach (KeyValuePair<string, ScanpathProperties> subjectColumnKVP in this.selectedSubjects) { ////DataView fixationsOfT = new DataView( //// fixations, //// "(SubjectName='" + subjectColumnKVP.Value.SubjectName + "')", //// "CountInTrial", //// DataViewRowState.CurrentRows); ////float malsburgSimilarity = EditDistance.MalsburgDistance(sFixations, tFixations, 0.5f); List<string> rowStringList = GetStringListForExtendedString(subjectRowKVP.Value.ScanpathString); List<string> columnStringList = GetStringListForExtendedString(subjectColumnKVP.Value.ScanpathString); float localSimilarity = EditDistance.CharacterSimilarityExtended( rowStringList, columnStringList) * 100; float globalSimilarity = EditDistance.SequenceSimilarityExtended( rowStringList, columnStringList) * 100; lociSimilarity.Add(localSimilarity.ToString("N0") + " %"); sequenceSimilarity.Add(globalSimilarity.ToString("N0") + " %"); } var lociColumns = new List<object>(); lociColumns.Add(subjectRowKVP.Value.SubjectName); lociColumns.AddRange(lociSimilarity.ToArray()); lociColumns.Add(subjectRowKVP.Value.ScanpathString); lociColumns.Add(subjectRowKVP.Value.SubjectCategory); this.dgvLociSimilarity.Rows.Add(lociColumns.ToArray()); var sequenceColumns = new List<object>(); sequenceColumns.Add(subjectRowKVP.Value.SubjectName); sequenceColumns.AddRange(sequenceSimilarity.ToArray()); sequenceColumns.Add(subjectRowKVP.Value.ScanpathString); sequenceColumns.Add(subjectRowKVP.Value.SubjectCategory); this.dgvSequenceSimilarity.Rows.Add(sequenceColumns.ToArray()); } } this.dgvLociSimilarity.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells); this.dgvSequenceSimilarity.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells); }
public override bool IsCategoryPresent(CategoryEntry category) { throw new NotImplementedException(ExceptionStringTable.MethodOrOperationIsNotImplemented); }
public static CategoryEntryAddRequestBuilder Add(CategoryEntry categoryEntry) { return(new CategoryEntryAddRequestBuilder(categoryEntry)); }
public abstract bool IsCategoryPresent(CategoryEntry category);
public static void Init() { entries = new Dictionary <string, CodexEntry>(); unlockedEntryLookup = new Dictionary <string, List <string> >(); Dictionary <string, CodexEntry> dictionary = new Dictionary <string, CodexEntry>(); if (widgetTagMappings == null) { List <Tuple <string, Type> > list = new List <Tuple <string, Type> >(); list.Add(new Tuple <string, Type>("!CodexText", typeof(CodexText))); list.Add(new Tuple <string, Type>("!CodexImage", typeof(CodexImage))); list.Add(new Tuple <string, Type>("!CodexDividerLine", typeof(CodexDividerLine))); list.Add(new Tuple <string, Type>("!CodexSpacer", typeof(CodexSpacer))); list.Add(new Tuple <string, Type>("!CodexLabelWithIcon", typeof(CodexLabelWithIcon))); list.Add(new Tuple <string, Type>("!CodexLabelWithLargeIcon", typeof(CodexLabelWithLargeIcon))); list.Add(new Tuple <string, Type>("!CodexContentLockedIndicator", typeof(CodexContentLockedIndicator))); list.Add(new Tuple <string, Type>("!CodexLargeSpacer", typeof(CodexLargeSpacer))); list.Add(new Tuple <string, Type>("!CodexVideo", typeof(CodexVideo))); widgetTagMappings = list; } string text = FormatLinkID("tips"); dictionary.Add(text, CodexEntryGenerator.GenerateCategoryEntry(text, UI.CODEX.CATEGORYNAMES.TIPS, CodexEntryGenerator.GenerateTutorialNotificationEntries(), Assets.GetSprite("unknown"), false, false, UI.CODEX.TIPS)); text = FormatLinkID("creatures"); dictionary.Add(text, CodexEntryGenerator.GenerateCategoryEntry(text, UI.CODEX.CATEGORYNAMES.CREATURES, CodexEntryGenerator.GenerateCreatureEntries(), Def.GetUISpriteFromMultiObjectAnim(Assets.GetPrefab("Hatch").GetComponent <KBatchedAnimController>().AnimFiles[0], "ui", false, string.Empty), true, true, null)); text = FormatLinkID("plants"); dictionary.Add(text, CodexEntryGenerator.GenerateCategoryEntry(text, UI.CODEX.CATEGORYNAMES.PLANTS, CodexEntryGenerator.GeneratePlantEntries(), Def.GetUISpriteFromMultiObjectAnim(Assets.GetPrefab("PrickleFlower").GetComponent <KBatchedAnimController>().AnimFiles[0], "ui", false, string.Empty), true, true, null)); text = FormatLinkID("food"); dictionary.Add(text, CodexEntryGenerator.GenerateCategoryEntry(text, UI.CODEX.CATEGORYNAMES.FOOD, CodexEntryGenerator.GenerateFoodEntries(), Def.GetUISpriteFromMultiObjectAnim(Assets.GetPrefab("CookedMeat").GetComponent <KBatchedAnimController>().AnimFiles[0], "ui", false, string.Empty), true, true, null)); text = FormatLinkID("buildings"); dictionary.Add(text, CodexEntryGenerator.GenerateCategoryEntry(text, UI.CODEX.CATEGORYNAMES.BUILDINGS, CodexEntryGenerator.GenerateBuildingEntries(), Def.GetUISpriteFromMultiObjectAnim(Assets.GetPrefab("Generator").GetComponent <KBatchedAnimController>().AnimFiles[0], "ui", false, string.Empty), true, true, null)); text = FormatLinkID("tech"); dictionary.Add(text, CodexEntryGenerator.GenerateCategoryEntry(text, UI.CODEX.CATEGORYNAMES.TECH, CodexEntryGenerator.GenerateTechEntries(), Assets.GetSprite("hud_research"), true, true, null)); text = FormatLinkID("roles"); dictionary.Add(text, CodexEntryGenerator.GenerateCategoryEntry(text, UI.CODEX.CATEGORYNAMES.ROLES, CodexEntryGenerator.GenerateRoleEntries(), Assets.GetSprite("hat_role_mining2"), true, true, null)); text = FormatLinkID("disease"); dictionary.Add(text, CodexEntryGenerator.GenerateCategoryEntry(text, UI.CODEX.CATEGORYNAMES.DISEASE, CodexEntryGenerator.GenerateDiseaseEntries(), Assets.GetSprite("codexDiseases"), false, true, null)); text = FormatLinkID("elements"); dictionary.Add(text, CodexEntryGenerator.GenerateCategoryEntry(text, UI.CODEX.CATEGORYNAMES.ELEMENTS, CodexEntryGenerator.GenerateElementEntries(), null, true, false, null)); text = FormatLinkID("geysers"); dictionary.Add(text, CodexEntryGenerator.GenerateCategoryEntry(text, UI.CODEX.CATEGORYNAMES.GEYSERS, CodexEntryGenerator.GenerateGeyserEntries(), null, true, true, null)); text = FormatLinkID("equipment"); dictionary.Add(text, CodexEntryGenerator.GenerateCategoryEntry(text, UI.CODEX.CATEGORYNAMES.EQUIPMENT, CodexEntryGenerator.GenerateEquipmentEntries(), null, true, true, null)); CategoryEntry item = CodexEntryGenerator.GenerateCategoryEntry(FormatLinkID("HOME"), UI.CODEX.CATEGORYNAMES.ROOT, dictionary, null, true, true, null); CodexEntryGenerator.GeneratePageNotFound(); List <CategoryEntry> list2 = new List <CategoryEntry>(); foreach (KeyValuePair <string, CodexEntry> item2 in dictionary) { list2.Add(item2.Value as CategoryEntry); } CollectYAMLEntries(list2); CollectYAMLSubEntries(list2); CheckUnlockableContent(); list2.Add(item); foreach (KeyValuePair <string, CodexEntry> entry in entries) { if (entry.Value.subEntries.Count > 0) { entry.Value.subEntries.Sort((SubEntry a, SubEntry b) => a.layoutPriority.CompareTo(b.layoutPriority)); if ((UnityEngine.Object)entry.Value.icon == (UnityEngine.Object)null) { entry.Value.icon = entry.Value.subEntries[0].icon; entry.Value.iconColor = entry.Value.subEntries[0].iconColor; } int num = 0; foreach (SubEntry subEntry in entry.Value.subEntries) { if (subEntry.lockID != null && !Game.Instance.unlocks.IsUnlocked(subEntry.lockID)) { num++; } } List <ICodexWidget> list3 = new List <ICodexWidget>(); list3.Add(new CodexSpacer()); list3.Add(new CodexText((string)CODEX.HEADERS.SUBENTRIES + " (" + (entry.Value.subEntries.Count - num) + "/" + entry.Value.subEntries.Count + ")", CodexTextStyle.Subtitle)); foreach (SubEntry subEntry2 in entry.Value.subEntries) { if (subEntry2.lockID != null && !Game.Instance.unlocks.IsUnlocked(subEntry2.lockID)) { list3.Add(new CodexText(UI.FormatAsLink(CODEX.HEADERS.CONTENTLOCKED, UI.ExtractLinkID(subEntry2.name)), CodexTextStyle.Body)); } else { list3.Add(new CodexText(subEntry2.name, CodexTextStyle.Body)); } } list3.Add(new CodexSpacer()); entry.Value.contentContainers.Insert(entry.Value.customContentLength, new ContentContainer(list3, ContentContainer.ContentLayout.Vertical)); } for (int i = 0; i < entry.Value.subEntries.Count; i++) { entry.Value.contentContainers.AddRange(entry.Value.subEntries[i].contentContainers); } } CodexEntryGenerator.PopulateCategoryEntries(list2, delegate(CodexEntry a, CodexEntry b) { if (a.name == (string)UI.CODEX.CATEGORYNAMES.TIPS) { return(-1); } if (b.name == (string)UI.CODEX.CATEGORYNAMES.TIPS) { return(1); } return(UI.StripLinkFormatting(a.name).CompareTo(UI.StripLinkFormatting(b.name))); }); }
public void Load(EndianBinaryReader stream) { // Store the position of the stream so we can reset back to it after we jump to read children. long streamPos = stream.BaseStream.Position; DisplayName = Encoding.GetEncoding("shift-jis").GetString(stream.ReadBytesUntil(0)); stream.BaseStream.Position = streamPos + 0x20; short entryCount = stream.ReadInt16(); Trace.Assert(stream.ReadInt16() == 0x00); // Padding int entryOffset = stream.ReadInt32(); stream.BaseStream.Position = entryOffset; for (int i = 0; i < entryCount; i++) { CategoryEntry entry = new CategoryEntry(); entry.Load(stream); Entries.Add(entry); } // Reset the stream to the start of the struct (+ size of struct) since reading the sub-options jumps us // around in the stream. stream.BaseStream.Position = streamPos + 0x28; }
private CategoryEntry findEITCategoryEntry(CategoryEntry openTVCategoryEntry) { foreach (CategoryEntry categoryEntry in EITSection.CategoryEntries) { if (categoryEntry.NetworkID == openTVCategoryEntry.NetworkID && categoryEntry.TransportStreamID == openTVCategoryEntry.TransportStreamID && categoryEntry.ServiceID == openTVCategoryEntry.ServiceID && categoryEntry.StartTime == openTVCategoryEntry.StartTime) return (categoryEntry); } return (null); }
public override bool SetProperty( string propertyName, string value, string[] source, ref int line ) { switch ( propertyName ) { case "Name": m_name = value; break; case "Volume": m_volume = Parser.ParseInt( value, line ); break; case "Pitch": m_pitch = Parser.ParseInt( value, line ); break; case "Priority": m_priority = Parser.ParseInt( value, line ); break; case "Category Entry": // Docs appear to be wrong about how this is arranged CategoryEntry entry = new CategoryEntry(); entry.Parse( source, ref line, OwnerProject ); m_category = entry.FindCategory(); break; case "Effect Entry": EffectEntry effectEntry = new EffectEntry(); effectEntry.Parse( source, ref line, OwnerProject ); foreach ( Effect effect in OwnerProject.m_globalSettings.m_effects ) { if ( effect.m_name == effectEntry.m_name ) { m_effects.Add( effect ); break; } } break; case "RPC Entry": RpcEntry rpcEntry = new RpcEntry(); rpcEntry.Parse( source, ref line, OwnerProject ); m_rpcEntries.Add( rpcEntry ); break; case "Track": Track track = new Track(); track.Parse( source, ref line, OwnerProject ); m_tracks.Add( track ); break; case "Comment": m_comment = Parser.ParseComment( value, source, ref line ); break; default: return false; } return true; }
/// <summary> /// Initializes a new instance of the <see cref="PluginEntry"/> class. /// </summary> /// <param name="plugin">The plugin.</param> /// <param name="category">The category.</param> /// <param name="desc">Plugin description</param> public PluginEntry(Plugin plugin, CategoryEntry category, ref PluginDescription desc) { Plugin = plugin; Category = category; float margin = 4; float iconSize = 64; var iconImage = new Image { Brush = new SpriteBrush(Editor.Instance.Icons.Plugin64), Parent = this, Bounds = new Rectangle(margin, margin, iconSize, iconSize), }; var icon = PluginUtils.TryGetPluginIcon(plugin); if (icon) { iconImage.Brush = new TextureBrush(icon); } Size = new Vector2(300, 100); float tmp1 = iconImage.Right + margin; var nameLabel = new Label { HorizontalAlignment = TextAlignment.Near, AnchorPreset = AnchorPresets.HorizontalStretchTop, Text = desc.Name, Font = new FontReference(Style.Current.FontLarge), Parent = this, Bounds = new Rectangle(tmp1, margin, Width - tmp1 - margin, 28), }; tmp1 = nameLabel.Bottom + margin + 8; var descLabel = new Label { HorizontalAlignment = TextAlignment.Near, VerticalAlignment = TextAlignment.Near, Wrapping = TextWrapping.WrapWords, AnchorPreset = AnchorPresets.HorizontalStretchTop, Text = desc.Description, Parent = this, Bounds = new Rectangle(nameLabel.X, tmp1, nameLabel.Width, Height - tmp1 - margin), }; string versionString = string.Empty; if (desc.IsAlpha) { versionString = "ALPHA "; } else if (desc.IsBeta) { versionString = "BETA "; } versionString += "Version "; versionString += desc.Version != null?desc.Version.ToString() : "1.0"; var versionLabel = new Label { HorizontalAlignment = TextAlignment.Far, VerticalAlignment = TextAlignment.Center, AnchorPreset = AnchorPresets.TopRight, Text = versionString, Parent = this, Bounds = new Rectangle(Width - 140 - margin, margin, 140, 14), }; string url = null; if (!string.IsNullOrEmpty(desc.AuthorUrl)) { url = desc.AuthorUrl; } else if (!string.IsNullOrEmpty(desc.HomepageUrl)) { url = desc.HomepageUrl; } else if (!string.IsNullOrEmpty(desc.RepositoryUrl)) { url = desc.RepositoryUrl; } versionLabel.Font.Font.WaitForLoaded(); var font = versionLabel.Font.GetFont(); var authorWidth = font.MeasureText(desc.Author).X + 8; var authorLabel = new ClickLabel { HorizontalAlignment = TextAlignment.Far, VerticalAlignment = TextAlignment.Center, AnchorPreset = AnchorPresets.TopRight, Text = desc.Author, Parent = this, Bounds = new Rectangle(Width - authorWidth - margin, versionLabel.Bottom + margin, authorWidth, 14), }; if (url != null) { authorLabel.TextColorHighlighted = Style.Current.BackgroundSelected; authorLabel.DoubleClick = () => Platform.OpenUrl(url); } }
private void RebuildCategorisation_Callback() { CategoryEntry root = new CategoryEntry( null, "Add Menu", new CategoryEntry[]{ Categorization.Items, Categorization.Mobiles } ); Categorization.Export( root, "Data/objects.xml", "Objects" ); MessageBox.Show(Core.MainForm, "Categorisation updated successfully", "Success"); }