public Category GetCategory(string idString, NavigatorTreeSearchMode treeSearchMode = NavigatorTreeSearchMode.PublicFirst) { Category result = null; switch (treeSearchMode) { case NavigatorTreeSearchMode.PublicOnly: { _publicCategories.TryGetValue(idString, out result); break; } case NavigatorTreeSearchMode.GuestOnly: { _guestCategories.TryGetValue(idString, out result); break; } case NavigatorTreeSearchMode.PublicFirst: { _publicCategories.TryGetValue(idString, out result); if (result == null) { _guestCategories.TryGetValue(idString, out result); } break; } case NavigatorTreeSearchMode.GuestFirst: { _guestCategories.TryGetValue(idString, out result); if (result == null) { _publicCategories.TryGetValue(idString, out result); } break; } } return(result); }
internal Navigator RemoveCategory(Category category, NavigatorTreeSearchMode treeSearchMode = NavigatorTreeSearchMode.PublicFirst, NestedSetRemoveChildAction childAction = NestedSetRemoveChildAction.MoveUpGeneration) { switch (treeSearchMode) { case NavigatorTreeSearchMode.PublicOnly: { if (!_publicCategories.ContainsKey(category.IdString)) throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: PublicOnly"); _publicCategories.Remove(category.IdString, childAction); break; } case NavigatorTreeSearchMode.GuestOnly: { if (!_guestCategories.ContainsKey(category.IdString)) throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: GuestOnly"); _guestCategories.Remove(category.IdString, childAction); break; } case NavigatorTreeSearchMode.PublicFirst: { if (!_publicCategories.ContainsKey(category.IdString)) if (!_guestCategories.ContainsKey(category.IdString)) throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: PublicFirst"); else _guestCategories.Remove(category.IdString, childAction); else _publicCategories.Remove(category.IdString, childAction); break; } case NavigatorTreeSearchMode.GuestFirst: { if (!_guestCategories.ContainsKey(category.IdString)) if (!_publicCategories.ContainsKey(category.IdString)) throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: GuestFirst"); else _publicCategories.Remove(category.IdString, childAction); else _guestCategories.Remove(category.IdString, childAction); break; } } return this; }
internal Navigator AddCategory(Category category, Category parent, NavigatorTreeSearchMode treeSearchMode = NavigatorTreeSearchMode.PublicFirst) { switch (treeSearchMode) { case NavigatorTreeSearchMode.PublicOnly: { if (!_publicCategories.ContainsKey(parent.IdString)) throw new NavigatorException("This instance of Navigator does not contain a \"" + parent.IdString + "\" category. SearchMode: PublicOnly"); _publicCategories.AddAsChildOf(category.IdString, category, parent.IdString); break; } case NavigatorTreeSearchMode.GuestOnly: { if (!_guestCategories.ContainsKey(parent.IdString)) throw new NavigatorException("This instance of Navigator does not contain a \"" + parent.IdString + "\" category. SearchMode: GuestOnly"); _guestCategories.AddAsChildOf(category.IdString, category, parent.IdString); break; } case NavigatorTreeSearchMode.PublicFirst: { if (!_publicCategories.ContainsKey(parent.IdString)) if (!_guestCategories.ContainsKey(parent.IdString)) throw new NavigatorException("This instance of Navigator does not contain a \"" + parent.IdString + "\" category. SearchMode: PublicFirst"); else _guestCategories.AddAsChildOf(category.IdString, category, parent.IdString); else _publicCategories.AddAsChildOf(category.IdString, category, parent.IdString); break; } case NavigatorTreeSearchMode.GuestFirst: { if (!_guestCategories.ContainsKey(parent.IdString)) if (!_publicCategories.ContainsKey(parent.IdString)) throw new NavigatorException("This instance of Navigator does not contain a \"" + parent.IdString + "\" category. SearchMode: GuestFirst"); else _publicCategories.AddAsChildOf(category.IdString, category, parent.IdString); else _guestCategories.AddAsChildOf(category.IdString, category, parent.IdString); break; } } CoreManager.ServerCore.GetStandardOut().PrintDebug("Navigator Manager => Category " + category.IdString + " adopted by " + parent.IdString); return this; }
public ICollection<Category> GetChildren(Category category, NavigatorTreeSearchMode treeSearchMode = NavigatorTreeSearchMode.PublicFirst) { switch (treeSearchMode) { case NavigatorTreeSearchMode.PublicOnly: { if (!_publicCategories.ContainsKey(category.IdString)) throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: PublicOnly"); return _publicCategories.GetChildren(category.IdString); } case NavigatorTreeSearchMode.GuestOnly: { if (!_guestCategories.ContainsKey(category.IdString)) throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: GuestOnly"); return _guestCategories.GetChildren(category.IdString); } case NavigatorTreeSearchMode.PublicFirst: { if (!_publicCategories.ContainsKey(category.IdString)) if (!_guestCategories.ContainsKey(category.IdString)) throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: PublicFirst"); else return _guestCategories.GetChildren(category.IdString); return _publicCategories.GetChildren(category.IdString); } case NavigatorTreeSearchMode.GuestFirst: { if (!_guestCategories.ContainsKey(category.IdString)) if (!_publicCategories.ContainsKey(category.IdString)) throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: GuestFirst"); else return _publicCategories.GetChildren(category.IdString); return _guestCategories.GetChildren(category.IdString); } default: { throw new NavigatorException("Invalid SearchMode."); } } }
public Category GetCategory(string idString, NavigatorTreeSearchMode treeSearchMode = NavigatorTreeSearchMode.PublicFirst) { Category result = null; switch (treeSearchMode) { case NavigatorTreeSearchMode.PublicOnly: { _publicCategories.TryGetValue(idString, out result); break; } case NavigatorTreeSearchMode.GuestOnly: { _guestCategories.TryGetValue(idString, out result); break; } case NavigatorTreeSearchMode.PublicFirst: { _publicCategories.TryGetValue(idString, out result); if (result == null) _guestCategories.TryGetValue(idString, out result); break; } case NavigatorTreeSearchMode.GuestFirst: { _guestCategories.TryGetValue(idString, out result); if (result == null) _publicCategories.TryGetValue(idString, out result); break; } } return result; }
internal Navigator RemoveCategory(Category category, NavigatorTreeSearchMode treeSearchMode = NavigatorTreeSearchMode.PublicFirst, NestedSetRemoveChildAction childAction = NestedSetRemoveChildAction.MoveUpGeneration) { switch (treeSearchMode) { case NavigatorTreeSearchMode.PublicOnly: { if (!_publicCategories.ContainsKey(category.IdString)) { throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: PublicOnly"); } _publicCategories.Remove(category.IdString, childAction); break; } case NavigatorTreeSearchMode.GuestOnly: { if (!_guestCategories.ContainsKey(category.IdString)) { throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: GuestOnly"); } _guestCategories.Remove(category.IdString, childAction); break; } case NavigatorTreeSearchMode.PublicFirst: { if (!_publicCategories.ContainsKey(category.IdString)) { if (!_guestCategories.ContainsKey(category.IdString)) { throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: PublicFirst"); } else { _guestCategories.Remove(category.IdString, childAction); } } else { _publicCategories.Remove(category.IdString, childAction); } break; } case NavigatorTreeSearchMode.GuestFirst: { if (!_guestCategories.ContainsKey(category.IdString)) { if (!_publicCategories.ContainsKey(category.IdString)) { throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: GuestFirst"); } else { _publicCategories.Remove(category.IdString, childAction); } } else { _guestCategories.Remove(category.IdString, childAction); } break; } } return(this); }
internal Navigator AddCategory(Category category, Category parent, NavigatorTreeSearchMode treeSearchMode = NavigatorTreeSearchMode.PublicFirst) { switch (treeSearchMode) { case NavigatorTreeSearchMode.PublicOnly: { if (!_publicCategories.ContainsKey(parent.IdString)) { throw new NavigatorException("This instance of Navigator does not contain a \"" + parent.IdString + "\" category. SearchMode: PublicOnly"); } _publicCategories.AddAsChildOf(category.IdString, category, parent.IdString); break; } case NavigatorTreeSearchMode.GuestOnly: { if (!_guestCategories.ContainsKey(parent.IdString)) { throw new NavigatorException("This instance of Navigator does not contain a \"" + parent.IdString + "\" category. SearchMode: GuestOnly"); } _guestCategories.AddAsChildOf(category.IdString, category, parent.IdString); break; } case NavigatorTreeSearchMode.PublicFirst: { if (!_publicCategories.ContainsKey(parent.IdString)) { if (!_guestCategories.ContainsKey(parent.IdString)) { throw new NavigatorException("This instance of Navigator does not contain a \"" + parent.IdString + "\" category. SearchMode: PublicFirst"); } else { _guestCategories.AddAsChildOf(category.IdString, category, parent.IdString); } } else { _publicCategories.AddAsChildOf(category.IdString, category, parent.IdString); } break; } case NavigatorTreeSearchMode.GuestFirst: { if (!_guestCategories.ContainsKey(parent.IdString)) { if (!_publicCategories.ContainsKey(parent.IdString)) { throw new NavigatorException("This instance of Navigator does not contain a \"" + parent.IdString + "\" category. SearchMode: GuestFirst"); } else { _publicCategories.AddAsChildOf(category.IdString, category, parent.IdString); } } else { _guestCategories.AddAsChildOf(category.IdString, category, parent.IdString); } break; } } CoreManager.ServerCore.GetStandardOut().PrintDebug("Navigator Manager => Category " + category.IdString + " adopted by " + parent.IdString); return(this); }
public ICollection <Category> GetChildren(Category category, NavigatorTreeSearchMode treeSearchMode = NavigatorTreeSearchMode.PublicFirst) { switch (treeSearchMode) { case NavigatorTreeSearchMode.PublicOnly: { if (!_publicCategories.ContainsKey(category.IdString)) { throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: PublicOnly"); } return(_publicCategories.GetChildren(category.IdString)); } case NavigatorTreeSearchMode.GuestOnly: { if (!_guestCategories.ContainsKey(category.IdString)) { throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: GuestOnly"); } return(_guestCategories.GetChildren(category.IdString)); } case NavigatorTreeSearchMode.PublicFirst: { if (!_publicCategories.ContainsKey(category.IdString)) { if (!_guestCategories.ContainsKey(category.IdString)) { throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: PublicFirst"); } else { return(_guestCategories.GetChildren(category.IdString)); } } return(_publicCategories.GetChildren(category.IdString)); } case NavigatorTreeSearchMode.GuestFirst: { if (!_guestCategories.ContainsKey(category.IdString)) { if (!_publicCategories.ContainsKey(category.IdString)) { throw new NavigatorException("This instance of Navigator does not contain a \"" + category.IdString + "\" category. SearchMode: GuestFirst"); } else { return(_publicCategories.GetChildren(category.IdString)); } } return(_guestCategories.GetChildren(category.IdString)); } default: { throw new NavigatorException("Invalid SearchMode."); } } }