public override Stream ConvertTemporaryToFinal() { if (this.temporaryStream_ == null) { throw new ZipException("No temporary stream has been created"); } Stream result = null; string tempFileName = DiskArchiveStorage.GetTempFileName(this.fileName_, false); bool flag = false; try { this.temporaryStream_.Close(); File.Move(this.fileName_, tempFileName); File.Move(this.temporaryName_, this.fileName_); flag = true; File.Delete(tempFileName); result = File.OpenRead(this.fileName_); } catch (Exception) { result = null; if (!flag) { File.Move(tempFileName, this.fileName_); File.Delete(this.temporaryName_); } throw; } return(result); }
public override Stream MakeTemporaryCopy(Stream stream) { stream.Close(); this.temporaryName_ = DiskArchiveStorage.GetTempFileName(this.fileName_, true); File.Copy(this.fileName_, this.temporaryName_, true); this.temporaryStream_ = new FileStream(this.temporaryName_, FileMode.Open, FileAccess.ReadWrite); return(this.temporaryStream_); }
public override Stream GetTemporaryOutput() { if (this.temporaryName_ != null) { this.temporaryName_ = DiskArchiveStorage.GetTempFileName(this.temporaryName_, true); this.temporaryStream_ = File.OpenWrite(this.temporaryName_); } else { this.temporaryName_ = Path.GetTempFileName(); this.temporaryStream_ = File.OpenWrite(this.temporaryName_); } return(this.temporaryStream_); }
public override Stream GetTemporaryOutput() { if (this.temporaryName_ != null) { this.temporaryName_ = DiskArchiveStorage.GetTempFileName(this.temporaryName_, true); this.temporaryStream_ = File.Open(this.temporaryName_, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None); } else { this.temporaryName_ = Path.GetTempFileName(); this.temporaryStream_ = File.Open(this.temporaryName_, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None); } return(this.temporaryStream_); }