public static FileHeaderSection FromFile(string filename)
 {
     using (FileStream stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
     using (PsdReader reader = new PsdReader(stream, new PathResolver(), new Uri(Path.GetDirectoryName(filename))))
     {
         reader.ReadDocumentHeader();
         return FileHeaderSectionReader.Read(reader);
     }
 }
Beispiel #2
0
 public override void ReadValue(PsdReader reader, object userData, out FileHeaderSection value)
 {
     if (this.IsDocument(reader) == true)
     {
         using (Stream stream = new RangeStream(reader.Stream, reader.Position, this.Length))
             using (PsdReader r = new PsdReader(stream, reader.Resolver, reader.Uri))
             {
                 r.ReadDocumentHeader();
                 value = FileHeaderSectionReader.Read(r);
             }
     }
     else
     {
         value = new FileHeaderSection();
     }
 }
 protected override void ReadData(PsdReader reader, object userData)
 {
     if (this.IsDocument(reader) == true)
     {
         using (Stream stream = new RangeStream(reader.Stream, reader.Position, this.Length))
             using (PsdReader reader2 = new PsdReader(stream, reader.Resolver, reader.Uri))
             {
                 reader.ReadDocumentHeader();
                 fileHeaderSection = FileHeaderSection.Read(reader2);
             }
     }
     else
     {
         fileHeaderSection = new FileHeaderSection();
     }
 }