public void Dispose() { using (owner.trace.NewNamedFrame("Disposing {0}", DictionaryKey)) { if (isDisposed) { owner.trace.Warning("Already disposed"); return; } isDisposed = true; if (simpleMedia != null) { owner.trace.Info("Disposing SimpleMedia object"); simpleMedia.Dispose(); } } }
public static async Task <SimpleFileMedia> Create(IFileSystem fileSystem, IConnectionParams connectParams) { var media = new SimpleFileMedia(fileSystem, connectParams); try { await media.Init(); await media.Update(); return(media); } catch { media.Dispose(); throw; } }