public FanSection Migrate(FanSectionV1 oldFanSection) { if (oldFanSection == null) { return null; } var newFanSectionBuilder = new FanSectionBuilder(); foreach (var direction in EnumExtensions.GetCompassDirections()) { var oldFan = (FanV1)oldFanSection.GetComponentValueInDirection(direction); if (oldFan == null) { continue; } var newFan = new Fan() { Intensity = oldFan.Intensity }; newFanSectionBuilder.WithFanInDirection(direction, newFan); } return newFanSectionBuilder.Build(); }
public FanSectionBuilder WithFanInDirection(eDirection direction, Fan fan) { if (fanSection.GetComponentSectionInDirection(direction) != null) { throw new ArgumentException("Attempted to add multiple fans in the same direction"); } fan.Direction = direction; fanSection.Fans.Add(fan); return this; }
private void UpdateFan(Fan fan) { Updated[eComponentType.Fan] = true; Status.FanSection.Fans.Add(fan); }
public void UpdateFan(Fan inputFan) { var fan = fans[inputFan.Direction]; fan.Intensity = inputFan.Intensity; }
public FanSectionBuilder WithAllFans(Fan fan) { WithFanInDirection(eDirection.East, (Fan)fan.Clone()); WithFanInDirection(eDirection.West, (Fan)fan.Clone()); return this; }