本文整理汇总了C#中ConfigNode.AddValue方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigNode.AddValue方法的具体用法?C# ConfigNode.AddValue怎么用?C# ConfigNode.AddValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigNode
的用法示例。
在下文中一共展示了ConfigNode.AddValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
public void Save(ConfigNode node)
{
if (node.HasNode("KOLONIZATION"))
{
SettingsNode = node.GetNode("KOLONIZATION");
}
else
{
SettingsNode = node.AddNode("KOLONIZATION");
}
foreach (KolonizationEntry r in _LogInfo)
{
var rNode = new ConfigNode("KOLONY_ENTRY");
rNode.AddValue("BodyIndex", r.BodyIndex);
rNode.AddValue("VesselId", r.VesselId);
rNode.AddValue("LastUpdate", r.LastUpdate);
rNode.AddValue("KolonyDate", r.KolonyDate);
rNode.AddValue("GeologyResearch", r.GeologyResearch);
rNode.AddValue("BotanyResearch", r.BotanyResearch);
rNode.AddValue("KolonizationResearch", r.KolonizationResearch);
rNode.AddValue("Science", r.Science);
rNode.AddValue("Rep", r.Rep);
rNode.AddValue("Funds", r.Funds);
SettingsNode.AddNode(rNode);
}
//Reset cache
KolonizationManager.Instance.ResetCache();
}
示例2: Save
public void Save(ConfigNode node)
{
ConfigNode newNode = new ConfigNode("Resource");
newNode.AddValue("name", resource.name);
newNode.AddValue("ratio", ratio);
node.AddNode(newNode);
}
示例3: RealChuteSettings
/// <summary>
/// Loads the RealChute_Settings config to memory
/// </summary>
public RealChuteSettings()
{
ConfigNode node = new ConfigNode(), settings = new ConfigNode("REALCHUTE_SETTINGS");
Debug.Log("[RealChute]: Loading settings file.");
if (!File.Exists(RCUtils.settingsURL))
{
Debug.LogError("[RealChute]: RealChute_Settings.cfg is missing. Creating new.");
settings.AddValue("autoArm", this._autoArm);
settings.AddValue("jokeActivated", this._jokeActivated);
settings.AddValue("guiResizeUpdates", this._guiResizeUpdates);
settings.AddValue("mustBeEngineer", this._mustBeEngineer);
settings.AddValue("engineerLevel", this._engineerLevel);
node.AddNode(settings);
node.Save(RCUtils.settingsURL);
}
else
{
node = ConfigNode.Load(RCUtils.settingsURL);
bool mustSave = false;
if (!node.TryGetNode("REALCHUTE_SETTINGS", ref settings)) { SaveSettings(); return; }
if (!settings.TryGetValue("autoArm", ref this._autoArm)) { mustSave = true; return; }
if (!settings.TryGetValue("jokeActivated", ref this._jokeActivated)) { mustSave = true; return; }
if (!settings.TryGetValue("guiResizeUpdates", ref this._guiResizeUpdates)) { mustSave = true; return; }
if (!settings.TryGetValue("mustBeEngineer", ref this._mustBeEngineer)) { mustSave = true; return; }
if (!settings.TryGetValue("engineerLevel", ref this._engineerLevel)) { mustSave = true; return; }
this._presets = settings.GetNodes("PRESET");
if (mustSave) { SaveSettings(); }
}
}
示例4: saveMonoOverlay
protected void saveMonoOverlay(ConfigNode node)
{
saveOverlay(node);
node.AddValue("red", _red);
node.AddValue("green", _green);
node.AddValue("blue", _blue);
}
示例5: RealChuteSettings
/// <summary>
/// Loads the RealChute_Settings config to memory
/// </summary>
public RealChuteSettings()
{
ConfigNode node = new ConfigNode(), settings = new ConfigNode("REALCHUTE_SETTINGS");
Debug.Log("[RealChute]: Loading settings file.");
if (!System.IO.File.Exists(RCUtils.settingsURL))
{
Debug.LogWarning("[RealChute]: RealChute_Settings.cfg is missing component. Creating new version.");
settings.AddValue("autoArm", autoArm);
settings.AddValue("jokeActivated", jokeActivated);
node.AddNode(settings);
node.Save(RCUtils.settingsURL);
}
else
{
node = ConfigNode.Load(RCUtils.settingsURL);
node.TryGetNode("REALCHUTE_SETTINGS", ref settings);
bool missing = false;
if (!settings.TryGetValue("autoArm", ref _autoArm)) { missing = true; }
if (!settings.TryGetValue("jokeActivated", ref _jokeActivated)) { missing = true; }
if (missing)
{
Debug.LogWarning("[RealChute]: RealChute_Settings.cfg is missing component. Fixing settings file.");
settings.ClearValues();
settings.AddValue("autoArm", autoArm);
settings.AddValue("jokeActivated", jokeActivated);
node.ClearData();
node.AddNode(settings);
node.Save(RCUtils.settingsURL);
}
}
}
示例6: saveText
public void saveText(ConfigNode node)
{
saveMonoOverlay(node);
node.AddValue("text", _text);
node.AddValue("fontName", _fontName);
node.AddValue("fontSize", _fontSize);
}
示例7: Save
public void Save(ConfigNode node)
{
ConfigNode pNode = new ConfigNode("WING_PROPERTY");
pNode.AddValue(nameof(ID), ID);
pNode.AddValue(nameof(value), value);
node.AddNode(pNode);
}
示例8: saveOverlay
protected void saveOverlay(ConfigNode node)
{
saveImageModifier(node);
node.AddValue("x", _position.x);
node.AddValue("y", _position.y);
node.AddValue("mirror", _mirror);
node.AddValue("alpha", _alpha);
node.AddValue("textureAlpha", _textureAlpha);
node.AddValue("alphaOption", ConfigNode.WriteEnum(_alphaOption));
node.AddValue("normalScale", _normalScale);
node.AddValue("normalOption", ConfigNode.WriteEnum(_normalOption));
node.AddValue("blendMethod", ConfigNode.WriteEnum(_blendMethod));
node.AddValue("rotation", ConfigNode.WriteEnum(_rotation));
}
示例9: HandleSettings
public void HandleSettings()
{
if (!File.Exists<KineTechAnimationModuleLoader>(SETTINGS_FILE_NAME))
{
ConfigNode node = new ConfigNode();
node.AddValue("DumpDocumentationOnStartup", false);
node.Save(IOUtils.GetFilePathFor(typeof(KineTechAnimationModuleLoader), SETTINGS_FILE_NAME));
}
if (File.Exists<KineTechAnimationModuleLoader>(SETTINGS_FILE_NAME))
{
ConfigNode node = ConfigNode.Load(
IOUtils.GetFilePathFor(typeof(KineTechAnimationModuleLoader), SETTINGS_FILE_NAME));
if(node == null)
return;
//Dump Documentation
if(node.HasValue("DumpDocumentationOnStartup"))
{
bool working = false;
if(bool.TryParse(node.GetValue("DumpDocumentationOnStartup"), out working))
{
GameObject dumperObject = new GameObject("Kine-Tech Animation - ConfigDocumentationGenerator");
dumperObject.AddComponent<KConfigDocumentationGenerator>();
GameObject.DontDestroyOnLoad(dumperObject);
}
}
}
}
示例10: OnSave
protected override void OnSave(ConfigNode node)
{
foreach (string field in matchFields)
{
node.AddValue("FIELD", field);
}
}
示例11: DataBody
public DataBody(ConfigNode body, string type)
{
this.name = body.name;
this.type = type;
if (!body.TryGetValue("currentError", ref currentError))
{
currentError = 1d;
body.AddValue("currentError", currentError.ToString("0.00000"));
}
}
示例12: RealChuteSettings
/// <summary>
/// Loads the RealChute_Settings config to memory
/// </summary>
public RealChuteSettings()
{
ConfigNode node = new ConfigNode(), settings = new ConfigNode("REALCHUTE_SETTINGS");
Debug.Log("[RealChute]: Loading settings file.");
if (!File.Exists(RCUtils.settingsURL))
{
Debug.LogWarning("[RealChute]: RealChute_Settings.cfg is missing. Creating new.");
settings.AddValue("autoArm", autoArm);
settings.AddValue("jokeActivated", jokeActivated);
settings.AddValue("hideIcon", hideIcon);
node.AddNode(settings);
node.Save(RCUtils.settingsURL);
}
else
{
node = ConfigNode.Load(RCUtils.settingsURL);
if (!node.TryGetNode("REALCHUTE_SETTINGS", ref settings)) { goto missing; }
if (!settings.TryGetValue("autoArm", ref _autoArm)) { goto missing; }
if (!settings.TryGetValue("jokeActivated", ref _jokeActivated)) { goto missing; }
if (settings.TryGetValue("hideIcon", ref _hideIcon)) { goto missing; }
return;
missing:
{
Debug.LogWarning("[RealChute]: RealChute_Settings.cfg is missing component. Fixing settings file.");
settings.ClearValues();
settings.AddValue("autoArm", autoArm);
settings.AddValue("jokeActivated", jokeActivated);
settings.AddValue("hideIcon", hideIcon);
node.ClearData();
node.AddNode(settings);
node.Save(RCUtils.settingsURL);
}
}
}
示例13: Save
public void Save(ConfigNode node)
{
if (node.HasNode("PLANETARY_LOGISTICS"))
{
SettingsNode = node.GetNode("PLANETARY_LOGISTICS");
}
else
{
SettingsNode = node.AddNode("PLANETARY_LOGISTICS");
}
foreach (PlanetaryLogisticsEntry r in _LogInfo)
{
var rNode = new ConfigNode("LOGISTICS_ENTRY");
rNode.AddValue("BodyIndex", r.BodyIndex);
rNode.AddValue("ResourceName", r.ResourceName);
rNode.AddValue("StoredQuantity", r.StoredQuantity);
SettingsNode.AddNode(rNode);
}
//Reset cache
PlanetaryLogisticsManager.Instance.ResetCache();
}
示例14: Awake
public void Awake()
{
EvaDebug.DebugLog("Loaded AddonAddModule.");
ConfigNode EVA = new ConfigNode("MODULE");
EVA.AddValue("name", "EvaModule");
try
{
PartLoader.getPartInfoByName("kerbalEVA").partPrefab.AddModule(EVA);
}
catch {
}
EVA = new ConfigNode("MODULE");
EVA.AddValue("name", "EvaModule");
try {
PartLoader.getPartInfoByName("kerbalEVAfemale").partPrefab.AddModule(EVA);
} catch {
}
}
示例15: OnSave
protected override void OnSave(ConfigNode node)
{
node.AddValue ("AsteroidVesselID", AsteroidVesselID);
}