示例#1
0
        public bool SaveCurrentVolume(String password)
        {
            if (CurrentVolume.VolumeSizeExceedAllocatedSpace(_noOfBytesInArchive, password))
            {
                var confirmationPrompt = "The size of " + CurrentVolume.VolumeName +
                                         " exceeds the default allocated space, if your archive has a" +
                                         " volume " + (CurrentVolume.VolumeNo + 2) +
                                         " that volume and possibly later volumes will be corrupted." +
                                         " Are you sure you want to continue? (y/n) ";

                if (!UserConfirmationFunc(confirmationPrompt))
                {
                    return(false);
                }
            }


            var binaryWriter = new BinaryWriter(new FileStream(FileName, FileMode.Open));

            binaryWriter.BaseStream.Seek(CurrentVolume.VolumePosition, SeekOrigin.Begin);

            CurrentVolume.WriteToFile(binaryWriter.BaseStream, password, AlgorithmNo);

            binaryWriter.Flush();
            binaryWriter.Close();

            return(true);
        }
示例#2
0
        public void WriteCurrentVolumeToFile(String password)
        {
            var binaryWriter = new BinaryWriter(new FileStream(FileName, FileMode.Open));

            CurrentVolume.WriteToFile(binaryWriter.BaseStream, password, AlgorithmNo);
            binaryWriter.Flush();
            binaryWriter.Close();
        }