Esempio n. 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);
        }
Esempio n. 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();
        }
Esempio n. 3
0
 protected bool Equals(Ticker other) =>
 Equals(TradePair, other.TradePair) &&
 Hight.Equals(other.Hight) &&
 Low.Equals(other.Low) &&
 Avg.Equals(other.Avg) &&
 Volume.Equals(other.Volume) &&
 CurrentVolume.Equals(other.CurrentVolume) &&
 Last.Equals(other.Last) &&
 Buy.Equals(other.Buy) &&
 Sell.Equals(other.Sell);
Esempio n. 4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id.GetHashCode();
         hashCode = (hashCode * 397) ^ (TradePair?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Hight.GetHashCode();
         hashCode = (hashCode * 397) ^ Low.GetHashCode();
         hashCode = (hashCode * 397) ^ Avg.GetHashCode();
         hashCode = (hashCode * 397) ^ Volume.GetHashCode();
         hashCode = (hashCode * 397) ^ CurrentVolume.GetHashCode();
         hashCode = (hashCode * 397) ^ Last.GetHashCode();
         hashCode = (hashCode * 397) ^ Buy.GetHashCode();
         hashCode = (hashCode * 397) ^ Sell.GetHashCode();
         return(hashCode);
     }
 }