public bool ReadFromFile(TagData.PictureStreamHandlerDelegate pictureStreamHandler, bool readAllMetaFrames = false) { bool result = false; LogDelegator.GetLocateDelegate()(fileName); resetData(); try { // Open file, read first block of data and search for a frame using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize, fileOptions)) using (BinaryReader source = new BinaryReader(fs)) { result = read(source, pictureStreamHandler, readAllMetaFrames); } } catch (Exception e) { System.Console.WriteLine(e.Message); System.Console.WriteLine(e.StackTrace); LogDelegator.GetLogDelegate()(Log.LV_ERROR, e.Message); result = false; } return(result); }
private bool read(BinaryReader source, TagData.PictureStreamHandlerDelegate pictureStreamHandler = null, bool readAllMetaFrames = false, bool prepareForWriting = false) { sizeInfo.ResetData(); sizeInfo.FileSize = source.BaseStream.Length; MetaDataIO.ReadTagParams readTagParams = new MetaDataIO.ReadTagParams(pictureStreamHandler, readAllMetaFrames); readTagParams.PrepareForWriting = prepareForWriting; return(read(source, readTagParams)); }
public Boolean ReadFromFile(TagData.PictureStreamHandlerDelegate pictureStreamHandler, Boolean readAllMetaFrames = false) { var result = false; LogDelegator.GetLocateDelegate()(fileName); resetData(); try { // Open file, read first block of data and search for a frame var s = (null == stream) ? new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize, fileOptions) : stream; var source = new BinaryReader(s); try { result = read(source, pictureStreamHandler, readAllMetaFrames); } finally { if (null == stream) { source.Close(); } } } catch (ArgumentOutOfRangeException e) { throw new AudioDataCorruptionException( "Possible audio data corruption, check Inner Exception for details", e); } catch (Exception e) { System.Console.WriteLine(e.Message); System.Console.WriteLine(e.StackTrace); LogDelegator.GetLogDelegate()(Log.LV_ERROR, e.Message); result = false; } return(result); }
public ReadTagParams(TagData.PictureStreamHandlerDelegate pictureStreamHandler, bool readAllMetaFrames) { PictureStreamHandler = pictureStreamHandler; ReadAllMetaFrames = readAllMetaFrames; }