本文整理汇总了C#中ConfigNode.HasNode方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigNode.HasNode方法的具体用法?C# ConfigNode.HasNode怎么用?C# ConfigNode.HasNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigNode
的用法示例。
在下文中一共展示了ConfigNode.HasNode方法的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: Preset
/// <summary>
/// Creates a new Preset from the given ConfigNode
/// </summary>
/// <param name="node">ConfigNode to create the object from</param>
public Preset(ConfigNode node)
{
node.TryGetValue("name", ref _name);
node.TryGetValue("description", ref _description);
node.TryGetValue("textureLibrary", ref _textureLibrary);
node.TryGetValue("sizeID", ref _sizeID);
node.TryGetValue("cutSpeed", ref _cutSpeed);
node.TryGetValue("timer", ref _timer);
node.TryGetValue("mustGoDown", ref _mustGoDown);
node.TryGetValue("deployOnGround", ref _deployOnGround);
node.TryGetValue("spares", ref _spares);
node.TryGetValue("caseName", ref _caseName);
node.TryGetValue("bodyName", ref _bodyName);
if (node.HasNode("MAIN")) { _main = new ChuteParameters(node.GetNode("MAIN")); }
if (node.HasNode("SECONDARY")) { _secondary = new ChuteParameters(node.GetNode("SECONDARY")); }
}
示例3: HasComponents
public static bool HasComponents(ConfigNode cfg)
{
if (cfg.HasNode("KRES"))
{
ConfigNode node = cfg.GetNode("KRES");
return node.HasValue("generated") && node.nodes.Count > 0;
}
return false;
}
示例4: Load
//Settings Functions Follow
internal void Load(ConfigNode node)
{
if (node.HasNode(configNodeName))
{
ConfigNode DFsettingsNode = node.GetNode(configNodeName);
fixtimecounts = Utilities.GetNodeValue(DFsettingsNode, "fixtimecounts", fixtimecounts);
}
}
示例5: Load
public void Load(ConfigNode node)
{
if (node.HasNode("KOLONIZATION"))
{
SettingsNode = node.GetNode("KOLONIZATION");
_LogInfo = SetupLogInfo();
//Reset cache
KolonizationManager.Instance.ResetCache();
}
else
{
_LogInfo = new List<KolonizationEntry>();
}
}
示例6: Load
public void Load(ConfigNode node)
{
if (node.HasNode("PLANETARY_LOGISTICS"))
{
SettingsNode = node.GetNode("PLANETARY_LOGISTICS");
_LogInfo = SetupLogInfo();
//Reset cache
PlanetaryLogisticsManager.Instance.ResetCache();
}
else
{
_LogInfo = new List<PlanetaryLogisticsEntry>();
}
}
示例7: Save
internal void Save(ConfigNode node)
{
ConfigNode settingsNode;
if (node.HasNode(configNodeName))
{
settingsNode = node.GetNode(configNodeName);
settingsNode.ClearData();
}
else
{
settingsNode = node.AddNode(configNodeName);
}
settingsNode.AddValue("fixtimecounts", false);
}
示例8: 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();
}
示例9: Save
public void Save(ConfigNode node)
{
if (node.HasNode("LIFE_SUPPORT_SETTINGS"))
{
SettingsNode = node.GetNode("LIFE_SUPPORT_SETTINGS");
}
else
{
SettingsNode = node.AddNode("LIFE_SUPPORT_SETTINGS");
}
foreach (LifeSupportStatus r in _StatusInfo)
{
var rNode = new ConfigNode("STATUS_DATA");
rNode.AddValue("KerbalName", r.KerbalName);
rNode.AddValue("LastMeal", r.LastMeal);
rNode.AddValue("IsGrouchy", r.IsGrouchy);
rNode.AddValue("LastUpdate", r.LastUpdate);
SettingsNode.AddNode(rNode);
}
foreach (VesselSupplyStatus r in _VesselInfo)
{
var rNode = new ConfigNode("VESSEL_DATA");
rNode.AddValue("VesselId", r.VesselId);
rNode.AddValue("VesselName", r.VesselName);
rNode.AddValue("SuppliesLeft", r.SuppliesLeft);
rNode.AddValue("NumCrew", r.NumCrew);
rNode.AddValue("LastFeeding", r.LastFeeding);
rNode.AddValue("LastUpdate", r.LastUpdate);
SettingsNode.AddNode(rNode);
}
//Reset cache
LifeSupportManager.Instance.ResetCache();
}
示例10: Load
public void Load(ConfigNode node)
{
if (node.HasNode("LIFE_SUPPORT_SETTINGS"))
{
SettingsNode = node.GetNode("LIFE_SUPPORT_SETTINGS");
_StatusInfo = SetupStatusInfo();
_VesselInfo = SetupVesselInfo();
//Reset cache
LifeSupportManager.Instance.ResetCache();
}
else
{
_StatusInfo = new List<LifeSupportStatus>();
_VesselInfo = new List<VesselSupplyStatus>();
}
}
示例11: Apply
public void Apply(ConfigNode node)
{
if (node.HasNode("EXPERIMENT"))
experiment = node.GetNode("EXPERIMENT");
}
示例12: foreach
// Post Apply
void IParserEventSubscriber.PostApply(ConfigNode node)
{
// Load the Killer Ocean, if it is there
if (hazardousOcean != null)
{
ocean.gameObject.AddComponent<HazardousOcean>().heatCurve = hazardousOcean;
}
// Apply the Ocean
ocean.transform.parent = generatedBody.pqsVersion.transform;
// Add the ocean PQS to the secondary renders of the CelestialBody Transform
PQSMod_CelestialBodyTransform transform = generatedBody.pqsVersion.GetComponentsInChildren<PQSMod_CelestialBodyTransform>(true).FirstOrDefault(mod => mod.transform.parent == generatedBody.pqsVersion.transform);
transform.planetFade.secondaryRenderers.Add(ocean.gameObject);
// Names!
ocean.name = generatedBody.pqsVersion.name + "Ocean";
ocean.gameObject.name = generatedBody.pqsVersion.name + "Ocean";
ocean.transform.name = generatedBody.pqsVersion.name + "Ocean";
// Set up the ocean PQS
ocean.parentSphere = generatedBody.pqsVersion;
// Load mods
if (!node.HasNode("Mods"))
goto Debug;
List<PQSMod> patchedMods = new List<PQSMod>();
// Get all loaded types
List<Type> types = Injector.ModTypes;
// Load mods manually because of patching
foreach (ConfigNode mod in node.GetNode("Mods").nodes)
{
// get the mod type
if (types.All(t => t.Name != mod.name))
continue;
Type loaderType = types.FirstOrDefault(t => t.Name == mod.name);
string testName = mod.name != "LandControl" ? "PQSMod_" + mod.name : "PQSLandControl";
Type modType = types.FirstOrDefault(t => t.Name == testName);
if (loaderType == null || modType == null)
{
Debug.LogError("MOD NULL: Loadertype " + mod.name + " with mod type " + testName + " and null? " + (loaderType == null) + (modType == null));
continue;
}
// Do any PQS Mods already exist on this PQS matching this mod?
IEnumerable<PQSMod> existingMods = ocean.GetComponentsInChildren<PQSMod>(true).Where(m => m.GetType() == modType &&
m.transform.parent == ocean.transform);
// Create the loader
object loader = Activator.CreateInstance(loaderType);
// Reflection, because C# being silly... :/
MethodInfo createNew = loaderType.GetMethod("Create", new Type[] { typeof(PQS) });
MethodInfo create = loaderType.GetMethod("Create", new Type[] { modType, typeof(PQS) });
if (existingMods.Any())
{
// Attempt to find a PQS mod we can edit that we have not edited before
PQSMod existingMod = existingMods.FirstOrDefault(m => !patchedMods.Contains(m) && (mod.HasValue("name") ? m.name == mod.GetValue("name") : true));
if (existingMod != null)
{
create.Invoke(loader, new object[] { existingMod, ocean });
Parser.LoadObjectFromConfigurationNode(loader, mod);
patchedMods.Add(existingMod);
Logger.Active.Log("PQSLoader.PostApply(ConfigNode): Patched PQS Mod => " + modType);
}
else
{
createNew.Invoke(loader, new object[] { ocean });
Parser.LoadObjectFromConfigurationNode(loader, mod);
Logger.Active.Log("PQSLoader.PostApply(ConfigNode): Added PQS Mod => " + modType);
}
}
else
{
createNew.Invoke(loader, new object[] { ocean });
Parser.LoadObjectFromConfigurationNode(loader, mod);
Logger.Active.Log("PQSLoader.PostApply(ConfigNode): Added PQS Mod => " + modType);
}
}
Debug:
// == DUMP OCEAN MATERIALS == //
Utility.DumpObjectProperties(ocean.surfaceMaterial, " ---- Ocean Material (Post Ocean Loader) ---- ");
Utility.GameObjectWalk(ocean.gameObject);
}
示例13: Load
//Settings Functions Follow
internal void Load(ConfigNode node)
{
if (node.HasNode(configNodeName))
{
ConfigNode DFsettingsNode = node.GetNode(configNodeName);
DFsettingsNode.TryGetValue("DFwindowPosX", ref DFwindowPosX);
DFsettingsNode.TryGetValue("DFwindowPosY", ref DFwindowPosY);
DFsettingsNode.TryGetValue("CFwindowPosX", ref CFwindowPosX);
DFsettingsNode.TryGetValue("CFwindowPosY", ref CFwindowPosY);
DFsettingsNode.TryGetValue("DFKACwindowPosX", ref DFKACwindowPosX);
DFsettingsNode.TryGetValue("DFKACwindowPosY", ref DFKACwindowPosY);
DFsettingsNode.TryGetValue("ECreqdForFreezer", ref ECreqdForFreezer);
DFsettingsNode.TryGetValue("fatalOption", ref fatalOption);
DFsettingsNode.TryGetValue("comatoseTime", ref comatoseTime);
DFsettingsNode.TryGetValue("UseAppLauncher", ref UseAppLauncher);
DFsettingsNode.TryGetValue("debugging", ref debugging);
DFsettingsNode.TryGetValue("ToolTips", ref ToolTips);
DFsettingsNode.TryGetValue("AutoRecoverFznKerbals", ref AutoRecoverFznKerbals);
DFsettingsNode.TryGetValue("KSCcostToThawKerbal", ref KSCcostToThawKerbal);
DFsettingsNode.TryGetValue("ECReqdToFreezeThaw", ref ECReqdToFreezeThaw);
DFsettingsNode.TryGetValue("GlykerolReqdToFreeze", ref GlykerolReqdToFreeze);
DFsettingsNode.TryGetValue("RegTempReqd", ref RegTempReqd);
DFsettingsNode.TryGetValue("RegTempFreeze", ref RegTempFreeze);
DFsettingsNode.TryGetValue("RegTempMonitor", ref RegTempMonitor);
DFsettingsNode.TryGetValue("heatamtMonitoringFrznKerbals", ref heatamtMonitoringFrznKerbals);
DFsettingsNode.TryGetValue("heatamtThawFreezeKerbal", ref heatamtThawFreezeKerbal);
DFsettingsNode.TryGetValue("TempinKelvin", ref TempinKelvin);
DFsettingsNode.TryGetValue("defaultTimeoutforCrewXfer", ref defaultTimeoutforCrewXfer);
DFsettingsNode.TryGetValue("cryopodResettimeDelay", ref cryopodResettimeDelay);
DFsettingsNode.TryGetValue("DFWindowWidth", ref DFWindowWidth);
DFsettingsNode.TryGetValue("CFWindowWidth", ref CFWindowWidth);
DFsettingsNode.TryGetValue("KACWindowWidth", ref KACWindowWidth);
DFsettingsNode.TryGetValue("ECLowWarningTime", ref ECLowWarningTime);
DFsettingsNode.TryGetValue("EClowCriticalTime", ref EClowCriticalTime);
DFsettingsNode.TryGetValue("StripLightsActive", ref StripLightsActive);
DFsettingsNode.TryGetValue("internalFrzrCamCode", ref internalFrzrCamCode);
DFsettingsNode.TryGetValue("internalNxtFrzrCamCode", ref internalNxtFrzrCamCode);
DFsettingsNode.TryGetValue("internalPrvFrzrCamCode", ref internalPrvFrzrCamCode);
Utilities.Log_Debug("DFSettings load complete");
}
}
示例14: OnLoad
public override void OnLoad(ConfigNode node)
{
if (!node.HasNode("PROPELLANT") && node.HasValue("resourceName"))
{
ConfigNode c = new ConfigNode("PROPELLANT");
c.AddValue("name", node.GetValue("resourceName"));
c.AddValue("ratio", "1.0");
if (node.HasValue("resourceFlowMode"))
c.AddValue("resourceFlowMode", node.GetValue("resourceFlowMode"));
node.AddNode(c);
}
base.OnLoad(node);
G = 9.80665f;
fuelFlow = (double)thrusterPower / (double)atmosphereCurve.Evaluate(0f) * invG;
}
示例15: LandClassLoader
void IParserEventSubscriber.PostApply(ConfigNode node)
{
// Load the LandClasses manually, to support patching
if (node.HasNode("landClasses"))
{
// Already patched classes
List<PQSLandControl.LandClass> patchedClasses = new List<PQSLandControl.LandClass>();
if (_mod.landClasses != null)
_mod.landClasses.ToList().ForEach(c => landClasses.Add(new LandClassLoader(c)));
// Go through the nodes
foreach (ConfigNode lcNode in node.GetNode("landClasses").nodes)
{
// The Loader
LandClassLoader loader = null;
// Are there existing LandClasses?
if (landClasses.Count > 0)
{
// Attempt to find a LandClass we can edit that we have not edited before
loader = landClasses.Where(m => !patchedClasses.Contains(m.landClass) && (lcNode.HasValue("name") ? m.landClass.landClassName == lcNode.GetValue("name") : false))
.FirstOrDefault();
// Load the Loader (lol)
if (loader != null)
{
Parser.LoadObjectFromConfigurationNode(loader, lcNode);
if (loader.delete.value)
landClasses.Remove(loader);
else
patchedClasses.Add(loader.landClass);
}
}
// If we can't patch a LandClass, create a new one
if (loader == null)
{
loader = Parser.CreateObjectFromConfigNode(typeof(LandClassLoader), lcNode) as LandClassLoader;
}
// Add the Loader to the List
landClasses.Add(loader);
}
}
// Load the Scatters manually, to support patching
if (node.HasNode("scatters"))
{
// Already patched scatters
List<PQSLandControl.LandClassScatter> patchedScatters = new List<PQSLandControl.LandClassScatter>();
if (_mod.scatters != null)
_mod.scatters.ToList().ForEach(s => scatters.Add(new LandClassScatterLoader(s)));
// Go through the nodes
foreach (ConfigNode scatterNode in node.GetNode("scatters").nodes)
{
// The Loader
LandClassScatterLoader loader = null;
// Are there existing Scatters?
if (scatters.Count > 0)
{
// Attempt to find a Scatter we can edit that we have not edited before
loader = scatters.Where(m => !patchedScatters.Contains(m.scatter) && (scatterNode.HasValue("name") ? m.scatter.scatterName == scatterNode.GetValue("name") : false))
.FirstOrDefault();
// Load the Loader (lol)
if (loader != null)
{
Parser.LoadObjectFromConfigurationNode(loader, scatterNode);
if (loader.delete.value)
scatters.Remove(loader);
else
patchedScatters.Add(loader.scatter);
}
}
// If we can't patch a Scatter, create a new one
if (loader == null)
{
loader = Parser.CreateObjectFromConfigNode(typeof(LandClassScatterLoader), scatterNode) as LandClassScatterLoader;
}
// Add the Loader to the List
scatters.Add(loader);
}
}
if (scatters.Count > 0)
_mod.scatters = scatters.Select(s => s.scatter).ToArray();
if (landClasses.Count > 0)
_mod.landClasses = landClasses.Select(c => c.landClass).ToArray();
// Assign each scatter amount with their corresponding scatter
foreach (PQSLandControl.LandClass landClass in _mod.landClasses)
{
foreach (PQSLandControl.LandClassScatterAmount amount in landClass.scatter)
{
int i = 0;
while (i < _mod.scatters.Length)
//.........这里部分代码省略.........