/// <summary> /// Gets an archive based on a Far3ProviderEntry. /// </summary> /// <param name="Entry">The Far3ProviderEntry of the archive.</param> /// <returns>A FAR3 archive.</returns> public T Get(Far3ProviderEntry <T> Entry) { //thread safe. return(Cache.GetOrAdd(Entry.ID, (id) => { byte[] data = Entry.Archive.GetEntry(Entry.FarEntry); using (var stream = new MemoryStream(data, false)) { T result = this.Codec.Decode(stream); if (result is IFileInfoUtilizer) { ((IFileInfoUtilizer)result).SetFilename(Entry.FarEntry.Filename); } return result; } })); }
public T Get(Far1ProviderEntry <T> entry) { return(Cache.GetOrAdd(entry.FarEntry.Filename, (name) => { byte[] data = entry.Archive.GetEntry(entry.FarEntry); using (var stream = new MemoryStream(data, false)) { T result = default(T); if (Codec == null) { result = (T)SmartCodec.Decode(stream, Path.GetExtension(entry.FarEntry.Filename)); } else { result = this.Codec.Decode(stream); } if (result is IFileInfoUtilizer) { ((IFileInfoUtilizer)result).SetFilename(entry.FarEntry.Filename); } return result; } })); }