Пример #1
0
 public StructuredStorageRoot(Stream stream)
 {
     try
     {
         this._storageRoot = (StorageInfo)StructuredStorageRoot.InvokeStorageRootMethod(null, "CreateOnStream", stream);
     }
     catch (Exception innerException)
     {
         throw new StructuredStorageException("Cannot get StructuredStorageRoot", innerException);
     }
 }
Пример #2
0
 public StructuredStorageRoot(string fileName)
 {
     try
     {
         this._storageRoot = (StorageInfo)StructuredStorageRoot.InvokeStorageRootMethod(null, "Open", fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
     }
     catch (Exception innerException)
     {
         throw new StructuredStorageException("Cannot get StructuredStorageRoot", innerException);
     }
 }
Пример #3
0
 private static byte[] GetRawBasicFileInfo(string revitFileName)
 {
     if (!StructuredStorageUtils.IsFileStucturedStorage(revitFileName))
     {
         throw new NotSupportedException("File is not a structured storage file");
     }
     using (StructuredStorageRoot structuredStorageRoot = new StructuredStorageRoot(revitFileName))
     {
         if (!structuredStorageRoot.BaseRoot.StreamExists("BasicFileInfo"))
         {
             throw new NotSupportedException(string.Format("File doesn't contain {0} stream", "BasicFileInfo"));
         }
         StreamInfo streamInfo = structuredStorageRoot.BaseRoot.GetStreamInfo("BasicFileInfo");
         using (Stream stream = streamInfo.GetStream(FileMode.Open, FileAccess.Read))
         {
             byte[] array = new byte[stream.Length];
             stream.Read(array, 0, array.Length);
             return(array);
         }
     }
 }
Пример #4
0
 private void CloseStorageRoot()
 {
     StructuredStorageRoot.InvokeStorageRootMethod(this._storageRoot, "Close");
 }