public static string ExportPicture(IPicture picture, string exportDirectory) { if (picture == null) { picture = new Picture(new FileInfo(Path.Combine(PathUtil.GetDirectory(), "media", "default-album-art.png"))); } var extension = "." + Regex.Split(picture.MimeType, "/").Last(); var digest = Digest.Get(picture.Data.Data); var picturePath = Path.Combine(exportDirectory, digest + extension); using (var w = System.IO.File.OpenWrite(picturePath)) { w.Write(picture.Data.Data, 0, picture.Data.Data.Length); } return(picturePath); }
public string GetPenAudioFilePath(string mp3SourceFile) { var oggFile = Path.Combine(cacheDirectory, Digest.Get(mp3SourceFile.ToLowerInvariant()) + oggExtension); return(oggFile); }