Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
        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);
        }