protected virtual void SaveFileToStore()
 {
     if (!string.IsNullOrEmpty(RealFileName) && TempSourceStream != null)
     {
         try {
             using (Stream destination = File.Create(RealFileName)) { //T582918
                 FileSystemDataModule.CopyStream(TempSourceStream, destination);
                 Size = (int)destination.Length;
             }
         }
         catch (DirectoryNotFoundException exc) {
             throw new UserFriendlyException(exc);
         }
     }
 }
Пример #2
0
 //Dennis: Fires when saving or opening a file.
 void IFileData.SaveToStream(Stream destination)
 {
     try {
         if (destination == null)
         {
             FileSystemDataModule.OpenFileWithDefaultProgram(FullName);
         }
         else
         {
             FileSystemDataModule.CopyFileToStream(FullName, destination);
         }
     } catch (Exception exc) {
         throw new UserFriendlyException(exc);
     }
 }
 //Dennis: Fires when saving or opening a file.
 void IFileData.SaveToStream(Stream destination)
 {
     try {
         if (!string.IsNullOrEmpty(RealFileName))
         {
             if (destination == null)
             {
                 FileSystemDataModule.OpenFileWithDefaultProgram(RealFileName);
             }
             else
             {
                 FileSystemDataModule.CopyFileToStream(RealFileName, destination);
             }
         }
         else if (TempSourceStream != null)
         {
             FileSystemDataModule.CopyStream(TempSourceStream, destination);
         }
     } catch (DirectoryNotFoundException exc) {
         throw new UserFriendlyException(exc);
     } catch (FileNotFoundException exc) {
         throw new UserFriendlyException(exc);
     }
 }