protected override void OnSave(ConfigNode configNode)
        {
            foreach (string node in map.Keys)
            {
                ConfigNode child = new ConfigNode(node);
                configNode.AddNode(child);
                foreach (ExpVal expVal in map[node])
                {
                    string typeName = PersistentDataStore.GetTypeName(expVal.type);
                    if (!child.HasValue("type"))
                    {
                        child.AddValue("type", typeName);
                    }
                    // Just start a new node if the type changes
                    else if (child.GetValue("type") != typeName)
                    {
                        child = new ConfigNode(node);
                        configNode.AddNode(child);
                        child.AddValue("type", typeName);
                    }
                    child.AddValue(expVal.key, expVal.val);
                }
            }

            foreach (string parameter in onParameterComplete.Keys)
            {
                ConfigNode child = new ConfigNode("PARAMETER_COMPLETED");
                child.AddValue("parameter", parameter);
                foreach (ExpVal expVal in onParameterComplete[parameter])
                {
                    string typeName = PersistentDataStore.GetTypeName(expVal.type);
                    if (!child.HasValue("type"))
                    {
                        child.AddValue("type", typeName);
                    }
                    child.AddValue(expVal.key, expVal.val);
                }
                configNode.AddNode(child);
            }
        }
Example #2
0
        public Tool(string configFileName, params string[] additionalConfigSections)
        {
            container = GetContainer(configFileName, additionalConfigSections);

            data = GetConfiguredType <PersistentDataStore>();
        }