protected override void Invalidate(bool disposing)
 {
     if (disposing && TempSourceStream != null)
     {
         TempSourceStream.Close();
         TempSourceStream = null;
     }
     base.Invalidate(disposing);
 }
Esempio n. 2
0
 protected virtual void SaveFileToStore()
 {
     if (!string.IsNullOrEmpty(RealFileName))
     {
         try {
             using (Stream destination = File.OpenWrite(RealFileName)) {
                 TempSourceStream.CopyStream(destination);
                 Size = (int)destination.Length;
             }
         } catch (DirectoryNotFoundException exc) {
             throw new UserFriendlyException(exc);
         }
         if (_oldRealFileName != RealFileName)
         {
             if (File.Exists(_oldRealFileName))
             {
                 File.Delete(_oldRealFileName);
             }
         }
     }
 }