/// <summary> /// Get an asset by its ID. /// </summary> /// <param name="id">The ID of the asset.</param> /// <returns>A file of the specified type.</returns> public T Get(ulong id) { lock (Cache) { if (Cache.ContainsKey(id)) { return(Cache[id]); } var item = (Entries.ContainsKey(id))?Entries[id]:null; if (item == null) { return(default(T)); } using (var dataStream = ContentManager.GetResource(item.FilePath, id)) { if (dataStream == null) { return(default(T)); } T value = this.Codec.Decode(dataStream); Cache.Add(id, value); return(value); } } }