public void Load(System.IO.Stream stream) { CanSave = true; Read(new FileReader(stream)); TreeNode node = new QuickAccessFolder(this, "Quick access"); Nodes.Add(node); Dictionary <string, TreeNode> folders = new Dictionary <string, TreeNode>(); foreach (var file in files) { string ext = Utils.GetExtension(file.FileName); string folderName = "Other"; if (CategoryLookup.ContainsKey(ext)) { folderName = CategoryLookup[ext]; } if (!folders.ContainsKey(folderName)) { TreeNode folder = new QuickAccessFileFolder(folderName); if (folderName == "Textures") { folder = new TextureFolder(this, "Textures"); } if (folderName == "Models") { folder = new ModelFolder("Models"); } if (folderName == "Animations") { folder = new AnimationFolder("Animations"); } node.Nodes.Add(folder); folders.Add(folderName, folder); } string name = Path.GetFileName(file.FileName).Split('[').FirstOrDefault(); string imageKey = "fileBlank"; switch (ext) { case ".bntx": imageKey = "bntx"; break; case ".gfbmdl": imageKey = "model"; break; } TreeNode fodlerNode = folders[folderName]; fodlerNode.Nodes.Add(new QuickAccessFile(name) { Tag = file, ImageKey = imageKey, SelectedImageKey = imageKey, }); } }
public static CategoryLookup GetCategoryById(int categoryId) { using (var db = new Context()) { CategoryLookup category = db.Categories.Find(categoryId); return(category); } }
protected override void DrawSidebarRow(CategoryLookup category, int i) { BeginSidebarRow(category, i); DrawSidebarRowElement(category.name, 400); EndSidebarRow(category, i); }
public static CategoryLookup GetCategoryById(int categoryId) { var category = ContextManager.GetCategoryById(categoryId); CategoryLookup categoryLookup = new CategoryLookup { CategoryId = category.CategoryId, CategoryName = category.CategoryName }; return(categoryLookup); }
public static void DeleteCategory(CategoryLookup category) { using (var db = new Context()) { CategoryLookup categoryRef = db.Categories.Find(category.CategoryId); if (categoryRef != null) { db.Categories.Remove(categoryRef); db.SaveChanges(); } } }
public static void UpdateCategory(CategoryLookup category) { using (var db = new Context()) { CategoryLookup categoryRef = db.Categories.Find(category.CategoryId); if (categoryRef != null) { categoryRef.CategoryName = category.CategoryName; db.SaveChanges(); } } }
public static void AddCategory(string categoryName) { CategoryLookup category = new CategoryLookup { CategoryName = categoryName }; using (var db = new Context()) { db.Categories.Add(category); db.SaveChanges(); } }
protected override void DrawDetail(CategoryLookup category, int index) { EditorGUILayout.BeginVertical("box"); EditorGUIUtility.labelWidth = EditorGUIUtility.labelWidth; serializedObject.Update(); foreach (var setting in category.serializedProperties) { EditorGUILayout.PropertyField(setting, true); } serializedObject.ApplyModifiedProperties(); EditorGUIUtility.labelWidth = 0; // Resets it to the default EditorGUILayout.EndVertical(); }
protected override bool MatchesSearch(CategoryLookup category, string searchQuery) { string search = searchQuery.ToLower(); return(category.name.ToLower().Contains(search) || category.serializedProperties.Any(o => o.displayName.ToLower().Contains(search))); }
public TreeNodeAdv CreateNavigationNodes(InventoryEntry entry) { int[] sortmodes = IEComparisonEngine.CurrentComparer().comparisons; int loopcount = (NavigationLayers < sortmodes.Length) ? NavigationLayers : sortmodes.Length; TreeNodeAdv navnode = null; TreeNodeAdv newbranch = null; string currentcategory; string categorytext; for (int i = 0; i < loopcount; i++) { // 0: Name // 1: Rarity // 2: Category // 3: Title // 4: Prefix // 5: Model // 6: Manufacturer // 7: Level // 8: Key switch (sortmodes[i]) { case 2: currentcategory = entry.Category; if (currentcategory == "") { currentcategory = "none"; } if (!CategoryLookup.TryGetValue(currentcategory, out categorytext)) { currentcategory = "(Unknown)"; categorytext = "(Unknown)"; } break; case 6: currentcategory = entry.NameParts[0]; if (currentcategory == "") { currentcategory = "No Manufacturer"; } categorytext = currentcategory; break; case 7: currentcategory = "Level " + entry.EffectiveLevel.ToString(); categorytext = currentcategory; break; case 3: currentcategory = entry.NameParts[3]; if (currentcategory == "") { currentcategory = "No Title"; } categorytext = currentcategory; break; case 4: currentcategory = entry.NameParts[2]; if (currentcategory == "") { currentcategory = "No Prefix"; } categorytext = currentcategory; break; case 5: currentcategory = entry.NameParts[1]; if (currentcategory == "") { currentcategory = "No Model"; } categorytext = currentcategory; break; case 1: currentcategory = entry.Name; categorytext = currentcategory; break; default: return(navnode); } //Debugger.Break(); //if (navnode == null) // newbranch = Tree.FindFirstNodeByTag(currentcategory, false); //else if (navnode != null) { newbranch = navnode.FindFirstByTag(currentcategory, false); } else { newbranch = Tree.Root.FindFirstByTag(currentcategory, false); } if (newbranch == null) { // This category does not exist yet. Create a node for it. ColoredTextNode data = new ColoredTextNode(); data.Tag = currentcategory; data.ForeColor = Color.LightSkyBlue; if (GlobalSettings.UseColor) { data.Text = categorytext; } else { data.Text = "--- " + categorytext + " ---"; } if (navnode == null) { (Tree.Model as TreeModel).Nodes.Add(data); navnode = Tree.Root; } else { navnode.AddNode(data); } newbranch = navnode.Children[navnode.Children.Count - 1]; //newbranch = navnode.FindFirstByTag(currentcategory, false); //if (navnode == null) //{ // (Tree.Model as TreeModel).Nodes.Add(data); // newbranch = Tree.FindNodeByTag(data).Tag as Node; //} //else // navnode.Nodes.Add(newbranch); } // Update the navnode then iterate again for the next tier of // category nodes until all category nodes are present navnode = newbranch; } return(navnode); }
public override Task GetProductsByCategoryId(CategoryLookup request, IServerStreamWriter <ProductInfo> responseStream, ServerCallContext context) { return(base.GetProductsByCategoryId(request, responseStream, context)); }
public override Task <CategoryInfo> GetCategoryById(CategoryLookup request, ServerCallContext context) { return(base.GetCategoryById(request, context)); }
public override CategoryLookup DuplicateItem(CategoryLookup item) { return(item); }