public FileOverlayStat(string statFile, Size srcSize, Size overSize, byte version = OverlayUtils.OVERLAY_FORMAT_VERSION) { this.srcSize = srcSize; this.overSize = overSize; this.statFile = statFile == null ? null : Path.GetFullPath(statFile); stream = string.IsNullOrEmpty(statFile) ? new BufferedStream(new MemoryStream()) : new BufferedStream(new FileStream(statFile, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)); reader = new BinaryReader(stream); format = new OverlayStatFormat(version); }
public FileOverlayStat(string statFile) { this.statFile = statFile == null ? null : Path.GetFullPath(statFile); if (!File.Exists(statFile)) { throw new AvisynthException("Stat file not found"); } stream = new BufferedStream(new FileStream(statFile, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)); reader = new BinaryReader(stream); var header = (byte)stream.ReadByte(); if (header == 0 || header > OverlayUtils.OVERLAY_FORMAT_VERSION) { throw new AvisynthException("Unsupported stat file version"); } format = new OverlayStatFormat(header); }