/// <summary> /// Initializes a new instance of the <see cref="EncryptionPassPhase"/> class. /// </summary> /// <param name="passPhaseToCopy">Phase to copy.</param> public EncryptionPassPhase(EncryptionPassPhase passPhaseToCopy) { this.StartTime = passPhaseToCopy.StartTime; this.EndTime = passPhaseToCopy.EndTime; this.PhaseName = passPhaseToCopy.PhaseName; this.TotalEnergyUsed = passPhaseToCopy.TotalEnergyUsed; this.BytesToEncrypt = passPhaseToCopy.BytesToEncrypt; }
private void InitPhases(Random random) { // TODO: Fix this to not be so hardcoded - but this will work for now to make the history graph not look bad this.PassPhases = new List <IPassPhase>(); DateTime startTime = this.StartTime; int numPhases = Enum.GetValues(typeof(PhaseType)).Length; double duration = (this.EndTime - this.StartTime).TotalSeconds / numPhases; var enums = Enum.GetValues(typeof(PhaseType)).Cast <PhaseType>().Where(x => x != PhaseType.Encryption); double phaseEnergy = this.PassEnergy / numPhases; // Do sunlight var sunlight = new PassPhase(startTime, startTime.AddSeconds(duration), PhaseType.Sunlight); sunlight.SetRandomValues(random.NextDouble(), phaseEnergy); startTime = startTime.AddSeconds(duration); this.PassPhases.Add(sunlight); // Do mission var mission = new PassPhase(startTime, startTime.AddSeconds(duration), PhaseType.Mission); mission.SetRandomValues(random.NextDouble(), phaseEnergy); startTime = startTime.AddSeconds(duration); this.PassPhases.Add(mission); // Do encryption EncryptionPassPhase encryptionPhase = new EncryptionPassPhase(startTime, startTime.AddSeconds(duration), PhaseType.Encryption); encryptionPhase.SetRandomValues(random.NextDouble(), phaseEnergy, random.Next()); startTime = startTime.AddSeconds(duration); this.PassPhases.Add(encryptionPhase); // Do datalink var datalink = new PassPhase(startTime, startTime.AddSeconds(duration), PhaseType.Datalink); datalink.SetRandomValues(random.NextDouble(), phaseEnergy); startTime = startTime.AddSeconds(duration); this.PassPhases.Add(datalink); }