public MediaData(DataPart part)
 {
     ContentType = part.ContentType;
     using (Stream s = part.GetStream(FileMode.Open, FileAccess.Read))
     {
         Media = new byte[s.Length];
         s.Read(Media, 0, (int)s.Length);
     }
 }
Beispiel #2
0
 public static long GetPartSize(this DataPart part)
 {
     using var stream = part.GetStream();
     return(stream.Length);
 }
 public void WriteMedia(DataPart part)
 {
     using (Stream s = part.GetStream(FileMode.Create, FileAccess.ReadWrite))
         s.Write(Media, 0, Media.GetUpperBound(0) + 1);
 }