public void Save(MediaItem mediaItem) { if (!mediaItem.IsAvailable) { log.Warn("Item {0} isn't available, cannot save!", mediaItem.Name); return; } this.persistence.WriteTextFile("library", mediaItem.Id, Serialize(mediaItem)); if (mediaItem.IsDeleted) this.persistence.DeleteFile("library.data", mediaItem.Id); else if (!this.persistence.Filenames("library.data").Contains(mediaItem.Id)) this.persistence.WriteBinaryFile("library.data", mediaItem.Id, mediaItem.DataStream()); log.Info("Item {0} saved", mediaItem.Name); }
public void Save(MediaItem mediaItem) { if (!mediaItem.IsAvailable) { log.Warn("Item {0} isn't available, cannot save!", mediaItem.Name); return; } this.persistence.WriteTextFile("library", mediaItem.Id, Serialize(mediaItem)); if (mediaItem.IsDeleted) { this.persistence.DeleteFile("library.data", mediaItem.Id); } else if (!this.persistence.Filenames("library.data").Contains(mediaItem.Id)) { this.persistence.WriteBinaryFile("library.data", mediaItem.Id, mediaItem.DataStream()); } log.Info("Item {0} saved", mediaItem.Name); }