private T GetExistingItemWithType <T>(string name) where T : class { AssetCatalogItem child = this.GetChild(name); if (child == null) { return(default(T)); } if (child is T) { return(child as T); } throw new Exception("The given path is already occupied with an asset"); }
public AssetFolder OpenFolder(string name) { AssetCatalogItem child = this.GetChild(name); if (child != null) { if (child is AssetFolder) { return(child as AssetFolder); } throw new Exception("The given path is already occupied with an asset"); } AssetFolder assetFolder = new AssetFolder(this.m_Path, name, this.authorId); this.m_Items.Add((AssetCatalogItem)assetFolder); return(assetFolder); }
public AssetFolder OpenFolder(string name) { AssetCatalogItem child = this.GetChild(name); if (child != null) { if (!(child is AssetFolder)) { throw new Exception("The given path is already occupied with an asset"); } return(child as AssetFolder); } AssetFolder item = new AssetFolder(base.m_Path, name, base.authorId); this.m_Items.Add(item); return(item); }
private void AddItem(AssetCatalogItem item, string idiom, string role, int width, int height) { foreach (AssetBrandAssetGroup.AssetBrandAssetItem assetBrandAssetItem in this.m_Items) { if (assetBrandAssetItem.item.name == item.name) { throw new Exception("An item with given name already exists"); } } this.m_Items.Add(new AssetBrandAssetGroup.AssetBrandAssetItem() { item = item, idiom = idiom, role = role, width = width, height = height }); }
private void AddItem(AssetCatalogItem item, string idiom, string role, int width, int height) { foreach (AssetBrandAssetItem item2 in this.m_Items) { if (item2.item.name == item.name) { throw new Exception("An item with given name already exists"); } } AssetBrandAssetItem item3 = new AssetBrandAssetItem { item = item, idiom = idiom, role = role, width = width, height = height }; this.m_Items.Add(item3); }
void AddItem(AssetCatalogItem item, string idiom, string role, int width, int height) { foreach (var it in m_Items) { if (it.item.name == item.name) { throw new Exception("An item with given name already exists"); } } var newItem = new AssetBrandAssetItem(); newItem.item = item; newItem.idiom = idiom; newItem.role = role; newItem.width = width; newItem.height = height; m_Items.Add(newItem); }