protected override bool Generate() { // Special case for pre-loader if (ContractState == State.Withdrawn) { return(true); } try { if (contractType != null) { return(true); } else { return(false); } } catch (Exception e) { LoggingUtil.LogError(this, "Error generating contract!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.CONTRACT_GENERATION, e, contractType == null ? "unknown" : contractType.FullName); try { GenerateFailed(); } catch { } return(false); } }
protected override void OnSave(ConfigNode node) { try { node.AddValue("subtype", subType); node.AddValue("title", title); node.AddValue("description", description); node.AddValue("synopsis", synopsis); node.AddValue("completedMessage", completedMessage); node.AddValue("notes", notes); node.AddValue("hash", hash); foreach (ContractBehaviour behaviour in behaviours) { ConfigNode child = new ConfigNode("BEHAVIOUR"); behaviour.Save(child); node.AddNode(child); } } catch (Exception e) { LoggingUtil.LogError(this, "Error saving contract to persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.CONTRACT_SAVE, e, this); SetState(State.Failed); } }
public override void OnSave(ConfigNode node) { try { base.OnSave(node); ConfigNode dataNode = new ConfigNode("DATA"); node.AddNode(dataNode); // Handle individual values foreach (KeyValuePair <string, System.Object> p in data) { StoreToConfigNode(dataNode, p.Key, p.Value); } // Handle config nodes foreach (ConfigNode childNode in configNodes.Values) { dataNode.AddNode(childNode); } } catch (Exception e) { LoggingUtil.LogError(this, "Error saving PersistentDataStore to persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_SAVE, e, "PersistentDataStore"); } }
public override void OnSave(ConfigNode node) { try { foreach (ConfiguredContract contract in contracts.Where(c => c.ContractState == Contract.State.Offered)) { ConfigNode child = new ConfigNode("CONTRACT"); node.AddNode(child); contract.Save(child); } ConfigNode unreadNode = new ConfigNode("UNREAD_CONTRACTS"); node.AddNode(unreadNode); foreach (Contract c in ContractSystem.Instance.Contracts.Where(c => unreadContracts.Contains(c.ContractGuid))) { unreadNode.AddValue("contract", c.ContractGuid); } foreach (ConfiguredContract c in contracts.Where(c => unreadContracts.Contains(c.ContractGuid))) { unreadNode.AddValue("contract", c.ContractGuid); } } catch (Exception e) { LoggingUtil.LogError(this, "Error saving ContractPreLoader to persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_SAVE, e, "ContractPreLoader"); } }
public override void OnLoad(ConfigNode node) { try { foreach (ConfigNode child in node.GetNodes("CONTRACT")) { ConfiguredContract contract = null; try { contract = new ConfiguredContract(); Contract.Load(contract, child); } catch (Exception e) { LoggingUtil.LogWarning(this, "Ignored an exception while trying to load a pre-loaded contract:"); LoggingUtil.LogException(e); } if (contract != null && contract.contractType != null) { contract.preLoaded = true; contracts.Add(contract); } } } catch (Exception e) { LoggingUtil.LogError(this, "Error loading ContractPreLoader from persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_LOAD, e, "ContractPreLoader"); } }
public override void OnLoad(ConfigNode node) { try { lastMCButton = ConfigNodeUtil.ParseValue <MissionControlButton>(node, "lastMCButton", MissionControlButton.All); DisplayOfferedOrbits = ConfigNodeUtil.ParseValue <bool?>(node, "DisplayOfferedOrbits", (bool?)ContractDefs.DisplayOfferedOrbits).Value; DisplayOfferedWaypoints = ConfigNodeUtil.ParseValue <bool?>(node, "DisplayOfferedWaypoints", (bool?)ContractDefs.DisplayOfferedWaypoints).Value; DisplayActiveOrbits = ConfigNodeUtil.ParseValue <bool?>(node, "DisplayActiveOrbits", (bool?)true).Value; DisplayActiveWaypoints = ConfigNodeUtil.ParseValue <bool?>(node, "DisplayActiveWaypoints", (bool?)true).Value; foreach (ConfigNode groupNode in node.GetNodes("CONTRACT_GROUP")) { string groupName = groupNode.GetValue("group"); if (ContractGroup.contractGroups.ContainsKey(groupName)) { ContractGroup group = ContractGroup.contractGroups[groupName]; ContractGroupDetails details = new ContractGroupDetails(group); details.enabled = ConfigNodeUtil.ParseValue <bool>(groupNode, "enabled"); contractGroupDetails[group.name] = details; } else { LoggingUtil.LogWarning(this, "Couldn't find contract group with name '" + groupName + "'"); } } foreach (ConfigNode stateNode in node.GetNodes("CONTRACT_STATE")) { string typeName = stateNode.GetValue("type"); if (!string.IsNullOrEmpty(typeName)) { Type contractType = null; try { contractType = ConfigNodeUtil.ParseTypeValue(typeName); StockContractDetails details = new StockContractDetails(contractType); details.enabled = ConfigNodeUtil.ParseValue <bool>(stateNode, "enabled"); stockContractDetails[contractType] = details; ContractDisabler.SetContractState(contractType, details.enabled); } catch (ArgumentException) { LoggingUtil.LogWarning(this, "Couldn't find contract type with name '" + typeName + "'"); } } } } catch (Exception e) { LoggingUtil.LogError(this, "Error loading ContractConfiguratorSettings from persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_LOAD, e, "ContractConfiguratorSettings"); } }
public override void OnLoad(ConfigNode node) { try { base.OnLoad(node); ConfigNode dataNode = node.GetNode("DATA"); if (dataNode != null) { // Handle individual values foreach (ConfigNode.Value pair in dataNode.values) { string typeName = pair.value.Remove(pair.value.IndexOf(":")); string value = pair.value.Substring(typeName.Length + 1); Type type = ConfigNodeUtil.ParseTypeValue(typeName); if (type == typeof(string)) { data[pair.name] = value; } else if (type.Name == "List`1") { BaseParser parser = BaseParser.NewParser(type); if (parser == null) { throw new Exception("Couldn't read list of values of type '" + type.GetGenericArguments().First().Name + "'."); } data[pair.name] = parser.ParseExpressionGeneric("", value, null); } else { // Get the ParseValue method MethodInfo parseValueMethod = typeof(ConfigNodeUtil).GetMethods().Where(m => m.Name == "ParseSingleValue").Single(); parseValueMethod = parseValueMethod.MakeGenericMethod(new Type[] { type }); // Invoke the ParseValue method data[pair.name] = parseValueMethod.Invoke(null, new object[] { pair.name, value, false }); } } // Handle config nodes foreach (ConfigNode childNode in dataNode.GetNodes()) { configNodes[childNode.name] = childNode; } } } catch (Exception e) { LoggingUtil.LogError(this, "Error loading PersistentDataStore from persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_LOAD, e, "PersistentDataStore"); } }
public override void OnLoad(ConfigNode node) { try { Load(); } catch (Exception e) { LoggingUtil.LogError(this, "Error loading BiomeTracker data from custom file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_LOAD, e, "BiomeTracker"); } }
public override void OnSave(ConfigNode node) { try { base.OnSave(node); foreach (KeyValuePair <string, VesselInfo> p in vessels) { VesselInfo vi = p.Value; // First find the vessel by id Vessel vessel = FlightGlobals.Vessels.Find(v => v != null && v.id == vi.id); if (HighLogic.LoadedScene == GameScenes.FLIGHT) { // If not found, attempt to find it by hash if (vessel == null) { vessel = FlightGlobals.Vessels.Find(v => v != null && v.GetHashes().Contains(vi.hash)); } // If found, verify the hash else { IEnumerable <uint> hashes = vessel.GetHashes(); if (hashes.Any() && !hashes.Contains(vi.hash)) { LoggingUtil.LogVerbose(this, "Setting hash for " + vi.id + " on save from " + vi.hash + " to " + hashes.FirstOrDefault()); vi.hash = hashes.FirstOrDefault(); } } } if (vessel != null) { ConfigNode child = new ConfigNode("VESSEL"); child.AddValue("key", p.Key); child.AddValue("id", vi.id); child.AddValue("hash", vi.hash); node.AddNode(child); } } } catch (Exception e) { LoggingUtil.LogError(this, "Error saving ContractVesselTracker to persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_SAVE, e, "ContractVesselTracker"); } }
protected override void OnLoad(ConfigNode node) { try { subType = node.GetValue("subtype"); contractType = string.IsNullOrEmpty(subType) ? null : ContractType.GetContractType(subType); title = ConfigNodeUtil.ParseValue <string>(node, "title", contractType != null ? contractType.title : subType); description = ConfigNodeUtil.ParseValue <string>(node, "description", contractType != null ? contractType.description : ""); synopsis = ConfigNodeUtil.ParseValue <string>(node, "synopsis", contractType != null ? contractType.synopsis : ""); completedMessage = ConfigNodeUtil.ParseValue <string>(node, "completedMessage", contractType != null ? contractType.completedMessage : ""); notes = ConfigNodeUtil.ParseValue <string>(node, "notes", contractType != null ? contractType.notes : ""); hash = ConfigNodeUtil.ParseValue <int>(node, "hash", contractType != null ? contractType.hash : 0); foreach (ConfigNode child in node.GetNodes("BEHAVIOUR")) { ContractBehaviour behaviour = ContractBehaviour.LoadBehaviour(child, this); behaviours.Add(behaviour); } // If the contract type is null, then it likely means that it was uninstalled if (contractType == null) { LoggingUtil.LogWarning(this, "Error loading contract for contract type '" + subType + "'. The contract type either failed to load or was uninstalled."); try { SetState(State.Failed); } catch { } return; } } catch (Exception e) { LoggingUtil.LogError(this, "Error loading contract from persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.CONTRACT_LOAD, e, this); try { SetState(State.Failed); } catch { } } }
public override void OnSave(ConfigNode node) { try { base.OnSave(node); foreach (ScienceSubject s in trackedSubjects) { node.AddValue("subject", s.id); } } catch (Exception e) { LoggingUtil.LogError(this, "Error saving ScienceReporter to persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_SAVE, e, "ScienceReporter"); } }
public override void OnSave(ConfigNode node) { try { foreach (ConfiguredContract contract in contracts.Where(c => c.ContractState == Contract.State.Offered)) { ConfigNode child = new ConfigNode("CONTRACT"); node.AddNode(child); contract.Save(child); } } catch (Exception e) { LoggingUtil.LogError(this, "Error saving ContractPreLoader to persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_SAVE, e, "ContractPreLoader"); } }
public override void OnLoad(ConfigNode node) { try { base.OnLoad(node); foreach (string id in node.GetValuesList("subject")) { ScienceSubject s = ResearchAndDevelopment.GetSubjectByID(id); if (s != null) { trackedSubjects.Add(s); } } } catch (Exception e) { LoggingUtil.LogError(this, "Error loading ScienceReporter from persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_LOAD, e, "ScienceReporter"); } }
public override void OnLoad(ConfigNode node) { try { base.OnLoad(node); ConfigNode dataNode = node.GetNode("DATA"); if (dataNode != null) { // Handle individual values foreach (ConfigNode.Value pair in dataNode.values) { string typeName = pair.value.Remove(pair.value.IndexOf(":")); string value = pair.value.Substring(typeName.Length + 1, pair.value.Length - typeName.Length - 1); Type type = Type.GetType(typeName); if (type == typeof(string)) { data[pair.name] = pair.value; } else { data[pair.name] = type.InvokeMember("Parse", System.Reflection.BindingFlags.InvokeMethod, null, null, new string[] { value }); } } // Handle config nodes foreach (ConfigNode childNode in dataNode.GetNodes()) { configNodes[childNode.name] = childNode; } } } catch (Exception e) { LoggingUtil.LogError(this, "Error loading PersistentDataStore from persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_LOAD, e, "PersistentDataStore"); } }
public override void OnLoad(ConfigNode node) { try { base.OnLoad(node); foreach (ConfigNode child in node.GetNodes("VESSEL")) { string key = child.GetValue("key"); Guid id = new Guid(child.GetValue("id")); uint hash = ConfigNodeUtil.ParseValue <uint>(child, "hash", 0); StartCoroutine(CompleteVesselLoad(key, id)); vessels[key] = new VesselInfo(id, hash); } } catch (Exception e) { LoggingUtil.LogError(this, "Error loading ContractVesselTracker from persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_LOAD, e, "ContractVesselTracker"); } }
public override void OnSave(ConfigNode node) { try { node.AddValue("lastMCButton", lastMCButton); node.AddValue("DisplayOfferedOrbits", DisplayOfferedOrbits); node.AddValue("DisplayOfferedWaypoints", DisplayOfferedWaypoints); node.AddValue("DisplayActiveOrbits", DisplayActiveOrbits); node.AddValue("DisplayActiveWaypoints", DisplayActiveWaypoints); foreach (ContractGroupDetails details in contractGroupDetails.Values.Where(d => d.group != null)) { ConfigNode groupNode = new ConfigNode("CONTRACT_GROUP"); node.AddNode(groupNode); groupNode.AddValue("group", details.group.name); groupNode.AddValue("enabled", details.enabled); } foreach (StockContractDetails details in stockContractDetails.Values.Where(d => d.contractType != null)) { ConfigNode stateNode = new ConfigNode("CONTRACT_STATE"); node.AddNode(stateNode); stateNode.AddValue("type", details.contractType.Name); stateNode.AddValue("enabled", details.enabled); } } catch (Exception e) { LoggingUtil.LogError(this, "Error saving ContractConfiguratorSettings to persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_SAVE, e, "ContractConfiguratorSettings"); } }
public override void OnLoad(ConfigNode node) { try { base.OnLoad(node); foreach (ConfigNode child in node.GetNodes("VESSEL")) { string key = child.GetValue("key"); Guid id = new Guid(child.GetValue("id")); uint hash = ConfigNodeUtil.ParseValue <uint>(child, "hash", 0); Vessel vessel = FlightGlobals.Vessels.Find(v => v != null && v.id == id); if (vessel == null || vessel.state == Vessel.State.DEAD) { id = Guid.Empty; } else if (hash == 0 && HighLogic.LoadedScene == GameScenes.FLIGHT) { hash = vessel.GetHashes().FirstOrDefault(); LoggingUtil.LogVerbose(this, "Setting hash for " + id + " on load to: " + hash); } if (id != Guid.Empty) { vessels[key] = new VesselInfo(id, hash); } } } catch (Exception e) { LoggingUtil.LogError(this, "Error loading ContractVesselTracker from persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_LOAD, e, "ContractVesselTracker"); } }
public void OnGUI() { DebugWindow.OnGUI(); ExceptionLogWindow.OnGUI(); }
public bool Initialize(ContractType contractType) { LoggingUtil.LogLevel origLogLevel = LoggingUtil.logLevel; try { this.contractType = contractType; if (contractType.trace) { LoggingUtil.logLevel = LoggingUtil.LogLevel.VERBOSE; } LoggingUtil.LogDebug(this, "Initializing contract: " + contractType); // Set stuff from contract type subType = contractType.name; hash = contractType.hash; AutoAccept = contractType.autoAccept; // Set the contract expiry if (contractType.maxExpiry == 0.0f) { LoggingUtil.LogDebug(this, contractType.name + ": Setting expirty to none"); SetExpiry(); expiryType = DeadlineType.None; } else { SetExpiry(contractType.minExpiry, contractType.maxExpiry); // Force set the expiry, in stock this is normally done on Contract.Offer() dateExpire = GameTime + TimeExpiry; } // Set the contract deadline if (contractType.deadline == 0.0f) { deadlineType = Contract.DeadlineType.None; } else { SetDeadlineDays(contractType.deadline, null); } // Set rewards SetScience(contractType.rewardScience, contractType.targetBody); SetReputation(contractType.rewardReputation, contractType.failureReputation, contractType.targetBody); SetFunds(contractType.advanceFunds, contractType.rewardFunds, contractType.advanceFunds + contractType.failureFunds, contractType.targetBody); // Copy text from contract type title = contractType.title; synopsis = contractType.synopsis; completedMessage = contractType.completedMessage; notes = contractType.notes; // Set the agent if (contractType.agent != null) { agent = contractType.agent; } else { agent = AgentList.Instance.GetSuitableAgentForContract(this); } // Set description if (string.IsNullOrEmpty(contractType.description) && agent != null) { // Generate the contract description description = TextGen.GenerateBackStories("ConfiguredContract", agent.Name, contractType.topic, contractType.subject, random.Next(), true, true, true); } else { description = contractType.description; } // Generate behaviours behaviours = new List <ContractBehaviour>(); if (!contractType.GenerateBehaviours(this)) { return(false); } // Generate parameters bool paramsGenerated = contractType.GenerateParameters(this); bodiesLoaded = false; contractType.contractBodies = ContractBodies; if (!paramsGenerated) { return(false); } // Do a very late research bodies check try { contractType.ResearchBodiesCheck(this); } catch (ContractRequirementException) { return(false); } // Copy in the requirement nodes requirements = new List <ContractRequirement>(); foreach (ContractRequirement requirement in contractType.Requirements) { requirements.Add(requirement); } LoggingUtil.LogDebug(this, "Initialized contract: " + contractType); return(true); } catch (Exception e) { LoggingUtil.LogError(this, "Error initializing contract " + contractType); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.CONTRACT_GENERATION, e, contractType == null ? "unknown" : contractType.FullName); return(false); } finally { LoggingUtil.logLevel = origLogLevel; } }
protected override void OnLoad(ConfigNode node) { try { subType = node.GetValue("subtype"); contractType = ContractType.GetContractType(subType); title = ConfigNodeUtil.ParseValue <string>(node, "title", contractType != null ? contractType.title : subType); description = ConfigNodeUtil.ParseValue <string>(node, "description", contractType != null ? contractType.description : ""); synopsis = ConfigNodeUtil.ParseValue <string>(node, "synopsis", contractType != null ? contractType.synopsis : ""); completedMessage = ConfigNodeUtil.ParseValue <string>(node, "completedMessage", contractType != null ? contractType.completedMessage : ""); notes = ConfigNodeUtil.ParseValue <string>(node, "notes", contractType != null ? contractType.notes : ""); hash = ConfigNodeUtil.ParseValue <int>(node, "hash", contractType != null ? contractType.hash : 0); targetBody = ConfigNodeUtil.ParseValue <CelestialBody>(node, "targetBody", null); // Load the unique data ConfigNode dataNode = node.GetNode("UNIQUE_DATA"); if (dataNode != null) { // Handle individual values foreach (ConfigNode.Value pair in dataNode.values) { string typeName = pair.value.Remove(pair.value.IndexOf(":")); string value = pair.value.Substring(typeName.Length + 1); Type type = ConfigNodeUtil.ParseTypeValue(typeName); // Prevents issues with vessels not getting loaded in some scenes (ie. VAB) if (type == typeof(Vessel)) { type = typeof(Guid); } if (type == typeof(string)) { uniqueData[pair.name] = value; } else { // Get the ParseValue method MethodInfo parseValueMethod = typeof(ConfigNodeUtil).GetMethods().Where(m => m.Name == "ParseSingleValue").Single(); parseValueMethod = parseValueMethod.MakeGenericMethod(new Type[] { type }); // Invoke the ParseValue method uniqueData[pair.name] = parseValueMethod.Invoke(null, new object[] { pair.name, value, false }); } } } foreach (ConfigNode child in node.GetNodes("BEHAVIOUR")) { ContractBehaviour behaviour = ContractBehaviour.LoadBehaviour(child, this); behaviours.Add(behaviour); } foreach (ConfigNode child in node.GetNodes("REQUIREMENT")) { ContractRequirement requirement = ContractRequirement.LoadRequirement(child); requirements.Add(requirement); } // If the contract type is null, then it likely means that it was uninstalled if (contractType == null) { LoggingUtil.LogWarning(this, "Error loading contract for contract type '" + subType + "'. The contract type either failed to load or was uninstalled."); try { if (ContractState == State.Active || ContractState == State.Offered) { SetState(ContractState == State.Active ? State.Failed : State.Withdrawn); } } catch { } return; } OnContractLoaded.Fire(this); } catch (Exception e) { LoggingUtil.LogError(this, "Error loading contract from persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.CONTRACT_LOAD, e, this); try { SetState(State.Failed); } catch { } } }
protected override void OnSave(ConfigNode node) { try { node.SetValue("type", "ConfiguredContract"); node.AddValue("subtype", subType); if (!string.IsNullOrEmpty(title)) { node.AddValue("title", title.Replace("\n", "&br;")); } if (!string.IsNullOrEmpty(description)) { node.AddValue("description", description.Replace("\n", "&br;")); } if (!string.IsNullOrEmpty(synopsis)) { node.AddValue("synopsis", synopsis.Replace("\n", "&br;")); } if (!string.IsNullOrEmpty(completedMessage)) { node.AddValue("completedMessage", completedMessage.Replace("\n", "&br;")); } if (!string.IsNullOrEmpty(notes)) { node.AddValue("notes", notes.Replace("\n", "&br;")); } node.AddValue("hash", hash); if (targetBody != null) { node.AddValue("targetBody", targetBody.name); } // Store the unique data if (uniqueData.Any()) { ConfigNode dataNode = new ConfigNode("UNIQUE_DATA"); node.AddNode(dataNode); foreach (KeyValuePair <string, object> p in uniqueData.Where(p => p.Value != null)) { PersistentDataStore.StoreToConfigNode(dataNode, p.Key, p.Value); } } foreach (ContractBehaviour behaviour in behaviours) { ConfigNode child = new ConfigNode("BEHAVIOUR"); behaviour.Save(child); node.AddNode(child); } // Store requirements if (requirements == null) { requirements = new List <ContractRequirement>(); if (contractType != null) { foreach (ContractRequirement requirement in contractType.Requirements) { requirements.Add(requirement); } } } foreach (ContractRequirement requirement in requirements) { ConfigNode child = new ConfigNode("REQUIREMENT"); if (child.nodes.Count > 0) { requirement.Save(child); node.AddNode(child); } } } catch (Exception e) { LoggingUtil.LogError(this, "Error saving contract '" + subType + "' to persistance file!"); LoggingUtil.LogException(e); ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.CONTRACT_SAVE, e, this); SetState(State.Failed); } }