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); } } }
//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); } }