diff --git a/Source/CC_RP0/Parameter/AvionicsCheckVesselParam.cs b/Source/CC_RP0/Parameter/AvionicsCheckVesselParam.cs index 63b6bb46829..e5c6283d28e 100644 --- a/Source/CC_RP0/Parameter/AvionicsCheckVesselParam.cs +++ b/Source/CC_RP0/Parameter/AvionicsCheckVesselParam.cs @@ -1,13 +1,12 @@ using ContractConfigurator.Parameters; -using Contracts; namespace ContractConfigurator.RP0 { public class AvionicsCheckParameter : VesselParameter { - protected bool parameterIsSatisified = true; - protected bool controlHasLapsed = false; - protected bool continuousControlRequired = false; + protected bool parameterIsSatisified { get; set; } = true; + protected bool controlHasLapsed { get; set; } + protected bool continuousControlRequired { get; set; } public AvionicsCheckParameter() : base(null) { } @@ -30,7 +29,7 @@ protected override void OnParameterLoad(ConfigNode node) base.OnParameterLoad(node); // Save parameter options on a per-vessel basis - node.TryGetValue("continuousControlRequired", ref continuousControlRequired); + continuousControlRequired = ConfigNodeUtil.ParseValue(node, "continuousControlRequired"); } protected override void OnRegister() { diff --git a/Source/CC_RP0/Parameter/DownrangeDistanceVesselParam.cs b/Source/CC_RP0/Parameter/DownrangeDistanceVesselParam.cs index bf488ab572d..e5a98667426 100644 --- a/Source/CC_RP0/Parameter/DownrangeDistanceVesselParam.cs +++ b/Source/CC_RP0/Parameter/DownrangeDistanceVesselParam.cs @@ -10,10 +10,11 @@ public class DownrangeDistance : VesselParameter { protected static Dictionary CompletedParams; - protected bool triggered = false; - protected double distance = 0; - protected double curDist = 0; - protected double markLatitude, markLongitude; + protected bool triggered { get; set; } + protected double distance { get; set; } + protected double curDist { get; set; } + protected double markLatitude { get; set; } + protected double markLongitude { get; set; } protected float updateFrequency { get; set; } private float lastUpdate = 0.0f; @@ -46,10 +47,10 @@ protected override void OnParameterLoad(ConfigNode node) base.OnParameterLoad(node); updateFrequency = ConfigNodeUtil.ParseValue(node, "updateFrequency", DEFAULT_UPDATE_FREQUENCY); - node.TryGetValue("distance", ref distance); - node.TryGetValue("markLatitude", ref markLatitude); - node.TryGetValue("markLongitude", ref markLongitude); - node.TryGetValue("triggered", ref triggered); + distance = ConfigNodeUtil.ParseValue(node, "distance"); + markLatitude = ConfigNodeUtil.ParseValue(node, "markLatitude"); + markLongitude = ConfigNodeUtil.ParseValue(node, "markLongitude"); + triggered = ConfigNodeUtil.ParseValue(node, "triggered"); } protected override string GetParameterTitle() diff --git a/Source/CC_RP0/Parameter/HasCompleted.cs b/Source/CC_RP0/Parameter/HasCompleted.cs index a380edd42d5..f043b7236f9 100644 --- a/Source/CC_RP0/Parameter/HasCompleted.cs +++ b/Source/CC_RP0/Parameter/HasCompleted.cs @@ -15,7 +15,7 @@ namespace ContractConfigurator.RP0 public class HasCompleted : VesselParameter { protected List ContractTags { get; set; } - protected bool InvertParameter = false; + protected bool InvertParameter { get; set; } public HasCompleted() : base(null) @@ -48,7 +48,7 @@ protected override void OnParameterLoad(ConfigNode node) { base.OnParameterLoad(node); ContractTags = ConfigNodeUtil.ParseValue>(node, "contractTag", new List()); - InvertParameter = Convert.ToBoolean(node.GetValue("invertParameter")); + InvertParameter = ConfigNodeUtil.ParseValue(node, "invertParameter"); } protected override void OnRegister() diff --git a/Source/CC_RP0/Parameter/HorizontalLandingVesselParam.cs b/Source/CC_RP0/Parameter/HorizontalLandingVesselParam.cs index 47b2276edc4..a6d3284546d 100644 --- a/Source/CC_RP0/Parameter/HorizontalLandingVesselParam.cs +++ b/Source/CC_RP0/Parameter/HorizontalLandingVesselParam.cs @@ -6,8 +6,8 @@ namespace ContractConfigurator.RP0 { public class HorizontalLanding : VesselParameter { - protected double glideRatio; - protected bool wasPreviouslyMet = false; + protected double glideRatio { get; set; } + protected bool wasPreviouslyMet { get; set; } protected float updateFrequency { get; set; } private float lastUpdate = 0.0f; @@ -39,8 +39,8 @@ protected override void OnParameterLoad(ConfigNode node) base.OnParameterLoad(node); updateFrequency = ConfigNodeUtil.ParseValue(node, "updateFrequency", DEFAULT_UPDATE_FREQUENCY); - node.TryGetValue("glideRatio", ref glideRatio); - node.TryGetValue("wasPreviouslyMet", ref wasPreviouslyMet); + glideRatio = ConfigNodeUtil.ParseValue(node, "glideRatio"); + wasPreviouslyMet = ConfigNodeUtil.ParseValue(node, "wasPreviouslyMet"); } protected override bool VesselMeetsCondition(Vessel vessel) diff --git a/Source/CC_RP0/Parameter/ImpactCBParam.cs b/Source/CC_RP0/Parameter/ImpactCBParam.cs index c4f73de497f..892f63ded3a 100644 --- a/Source/CC_RP0/Parameter/ImpactCBParam.cs +++ b/Source/CC_RP0/Parameter/ImpactCBParam.cs @@ -8,7 +8,7 @@ public class ImpactCB : VesselParameter { private const int VelQueueSize = 50; - protected double minSrfVel = 0; + protected double minSrfVel { get; set; } private Queue srfVelQueue = new Queue(VelQueueSize); private Dictionary destroyedVessels = new Dictionary(); @@ -47,7 +47,7 @@ protected override void OnParameterLoad(ConfigNode node) { base.OnParameterLoad(node); - node.TryGetValue("minSrfVel", ref minSrfVel); + minSrfVel = ConfigNodeUtil.ParseNode(node, "minSrfVel"); targetBody = ConfigNodeUtil.ParseValue(node, "targetBody", null); } diff --git a/Source/CC_RP0/Parameter/RP1NoDocking.cs b/Source/CC_RP0/Parameter/RP1NoDocking.cs index f465514e3a2..31639b3853a 100644 --- a/Source/CC_RP0/Parameter/RP1NoDocking.cs +++ b/Source/CC_RP0/Parameter/RP1NoDocking.cs @@ -11,7 +11,7 @@ namespace ContractConfigurator.RP0 /// public class RP1NoDocking : VesselParameter { - protected HashSet dockedVesselIDs = new HashSet(); + protected HashSet dockedVesselIDs { get; set; } = new HashSet(); protected List vessels { get; set; } public RP1NoDocking() diff --git a/Source/CC_RP0/Parameter/RP1ReturnHome.cs b/Source/CC_RP0/Parameter/RP1ReturnHome.cs index d17031c499d..2e91f0b6dda 100644 --- a/Source/CC_RP0/Parameter/RP1ReturnHome.cs +++ b/Source/CC_RP0/Parameter/RP1ReturnHome.cs @@ -7,13 +7,13 @@ namespace ContractConfigurator.RP0 public class RP1ReturnHome : VesselParameter { public const double DefaultMaxSpeed = 5; + internal const float DEFAULT_UPDATE_FREQUENCY = 0.5f; - protected string landAtFacility = string.Empty; - protected double maxSpeed = DefaultMaxSpeed; + protected string landAtFacility { get; set; } + protected double maxSpeed { get; set; } protected float updateFrequency { get; set; } private float lastUpdate = 0.0f; - internal const float DEFAULT_UPDATE_FREQUENCY = 0.5f; public RP1ReturnHome() : this(null, string.Empty, DefaultMaxSpeed, DEFAULT_UPDATE_FREQUENCY) @@ -49,8 +49,8 @@ protected override void OnParameterLoad(ConfigNode node) base.OnParameterLoad(node); updateFrequency = ConfigNodeUtil.ParseValue(node, "updateFrequency", DEFAULT_UPDATE_FREQUENCY); - node.TryGetValue("landAtFacility", ref landAtFacility); - node.TryGetValue("maxSpeed", ref maxSpeed); + landAtFacility = ConfigNodeUtil.ParseValue(node, "landAtFacility", string.Empty); + maxSpeed = ConfigNodeUtil.ParseValue(node, "maxSpeed", DefaultMaxSpeed); } protected override void OnUpdate() diff --git a/Source/CC_RP0/Parameter/ReachMachVesselParam.cs b/Source/CC_RP0/Parameter/ReachMachVesselParam.cs index 699cd165f2b..39afdbf58df 100644 --- a/Source/CC_RP0/Parameter/ReachMachVesselParam.cs +++ b/Source/CC_RP0/Parameter/ReachMachVesselParam.cs @@ -5,7 +5,7 @@ namespace ContractConfigurator.RP0 { public class ReachMach : VesselParameter { - protected double mach; + protected double mach { get; set; } protected float updateFrequency { get; set; } private float lastUpdate = 0.0f; @@ -25,7 +25,6 @@ protected override void OnParameterSave(ConfigNode node) { base.OnParameterSave(node); - node.AddValue("updateFrequency", updateFrequency); node.AddValue("updateFrequency", updateFrequency); node.AddValue("mach", mach); } @@ -35,7 +34,7 @@ protected override void OnParameterLoad(ConfigNode node) base.OnParameterLoad(node); updateFrequency = ConfigNodeUtil.ParseValue(node, "updateFrequency", DEFAULT_UPDATE_FREQUENCY); - node.TryGetValue("mach", ref mach); + mach = ConfigNodeUtil.ParseValue(node, "mach"); } protected override string GetParameterTitle() diff --git a/Source/CC_RP0/Parameter/VesselBuiltAt.cs b/Source/CC_RP0/Parameter/VesselBuiltAt.cs index a01fc6ec30b..0868cba48c0 100644 --- a/Source/CC_RP0/Parameter/VesselBuiltAt.cs +++ b/Source/CC_RP0/Parameter/VesselBuiltAt.cs @@ -5,7 +5,7 @@ namespace ContractConfigurator.RP0 { public class VesselBuiltAtParameter : VesselParameter { - private EditorFacility builtAt; + private EditorFacility builtAt { get; set; } public VesselBuiltAtParameter() : base(null)