本文整理汇总了C#中XmlDbRow.Exists方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDbRow.Exists方法的具体用法?C# XmlDbRow.Exists怎么用?C# XmlDbRow.Exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlDbRow
的用法示例。
在下文中一共展示了XmlDbRow.Exists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public override bool Parse(XmlDbRow row, SimPersonality personality, ref string error)
{
if (!base.Parse(row, personality, ref error)) return false;
if (!row.Exists("Name"))
{
error = "Name missing";
return false;
}
else if (!row.Exists("Default"))
{
error = "Default missing";
return false;
}
else
{
CASAgeGenderFlags ageGender;
if (!ParserFunctions.TryParseEnum<CASAgeGenderFlags>(row.GetString("AgeGender"), out ageGender, CASAgeGenderFlags.None))
{
error = "Unknown AgeGender " + row.GetString("AgeGender");
return false;
}
mAge = ageGender & CASAgeGenderFlags.AgeMask;
if (mAge == CASAgeGenderFlags.None)
{
mAge = CASAgeGenderFlags.AgeMask;
}
mGender = ageGender & CASAgeGenderFlags.GenderMask;
if (mGender == CASAgeGenderFlags.None)
{
mGender = CASAgeGenderFlags.GenderMask;
}
StringToSpeciesList converter = new StringToSpeciesList();
mSpecies = converter.Convert(row.GetString("Species"));
if (mSpecies == null)
{
error = converter.mError;
return false;
}
if (mSpecies.Count == 0)
{
mSpecies.Add(CASAgeGenderFlags.Human);
}
}
mName = row.GetString("Name");
SetValue (row.GetBool("Default"));
return true;
}
示例2: CareerTransfer
public CareerTransfer(XmlDbRow row, Dictionary<string, Dictionary<int, CareerLevel>> careerLevels, string careerName)
: base(row, careerLevels, null)
{
mStringKey = "NRaas.CareerTransfer:" + row.GetString("EventType");
if (row.Exists("TransferCareer"))
{
string guid = row.GetString("TransferCareer");
ParserFunctions.TryParseEnum<OccupationNames>(guid, out mTransferCareer, OccupationNames.Undefined);
if (mTransferCareer == OccupationNames.Undefined)
{
mTransferCareer = unchecked((OccupationNames)ResourceUtils.HashString64(guid));
}
}
if (row.Exists("TransferBranch"))
{
mTransferBranch = row.GetString("TransferBranch");
}
if (row.Exists("TransferLevelAbsolute"))
{
mAbsoluteLevel = row.GetInt("TransferLevelAbsolute");
}
if (row.Exists("TransferLevelRelative"))
{
string relativeLevel = row.GetString("TransferLevelRelative");
List<string> relativeLevels = new List<string>(relativeLevel.Split(new char[] { ':' }));
mRelativeLevelMin = int.Parse(relativeLevels[0]);
if (relativeLevels.Count > 1)
{
mRelativeLevelMax = int.Parse(relativeLevels[1]);
}
else
{
if (mRelativeLevelMin > 0)
{
mRelativeLevelMax = mRelativeLevelMin;
mRelativeLevelMin = 0;
}
}
}
}
示例3: Parse
public bool Parse(XmlDbRow row, StoryProgressionObject manager, IUpdateManager updater, string prefix, ref string error)
{
if ((!string.IsNullOrEmpty(prefix)) && (!Parse(row, manager, updater, null, ref error)))
{
return false;
}
if (row.Exists(prefix + "RecruitAllowSteal"))
{
mAllowSteal = row.GetBool(prefix + "RecruitAllowSteal");
}
if (mActorRecruit == null)
{
mActorRecruit = new SimScenarioFilter();
}
if (!mActorRecruit.Parse(row, manager, updater, prefix + "RecruitActor", false, ref error))
{
return false;
}
if (mTargetRecruit == null)
{
mTargetRecruit = new SimScenarioFilter();
}
if (!mTargetRecruit.Parse(row, manager, updater, prefix + "RecruitTarget", false, ref error))
{
return false;
}
return true;
}
示例4: MoodletTest
public MoodletTest(XmlDbRow row)
{
string name = row.GetString("GUID");
if (!row.Exists("BuffName"))
{
BooterLogger.AddError(name + " BuffName Missing");
}
else
{
foreach (string buffStr in row.GetStringList("BuffName", ','))
{
BuffNames buff;
if (ParserFunctionsEx.Parse(buffStr, out buff))
{
mBuffs.Add(buff);
}
else
{
BooterLogger.AddError(name + " Unknown BuffName: " + buffStr);
}
}
}
if (row.Exists("Origin"))
{
foreach (string originStr in row.GetStringList("Origin", ','))
{
Origin origin;
if (ParserFunctionsEx.Parse(originStr, out origin))
{
mOrigins.Add(origin);
}
else
{
BooterLogger.AddError(name + " Unknown Origin: " + origin);
}
mOrigins.Add(origin);
}
}
}
示例5: Parse
public override bool Parse(XmlDbRow row, SimPersonality personality, ref string error)
{
if (!base.Parse(row, personality, ref error)) return false;
if (!row.Exists("Name"))
{
error = "Name missing";
return false;
}
else if (!row.Exists("Default"))
{
error = "Default missing";
return false;
}
mName = row.GetString("Name");
SetValue (row.GetBool("Default"));
return true;
}
示例6: ImpregnateSymptom
public ImpregnateSymptom(XmlDbRow row)
: base(row)
{
if (BooterLogger.Exists(row, "Clone", Guid))
{
mClone = row.GetBool("Clone");
}
if (BooterLogger.Exists(row, "AllowCloseRelations", Guid))
{
mAllowCloseRelations = row.GetBool("AllowCloseRelations");
}
if (row.Exists("HandlePlantSim"))
{
mHandlePlantSim = row.GetBool("HandlePlantSim");
}
}
示例7: ITUNSettings
public ITUNSettings(string name, XmlDbRow row)
: this(name)
{
mFlags = Flags.None;
if (row.Exists("Autonomous"))
{
mAutonomous = row.GetBool("Autonomous");
mFlags |= Flags.Autonomous;
}
if (row.Exists("UserDirected"))
{
mUserDirected = row.GetBool("UserDirected");
mFlags |= Flags.UserDirected;
}
if (row.Exists("AgeSpecies"))
{
mAgeSpecies = row.GetEnum<CASAGSAvailabilityFlags>("AgeSpecies", CASAGSAvailabilityFlags.None);
if (mAgeSpecies == CASAGSAvailabilityFlags.None)
{
BooterLogger.AddError("Unknown AgeSpecies: " + row.GetString("AgeSpecies"));
}
else
{
mFlags |= Flags.AgeSpecies;
mAgeSpeciesList = null;
}
}
if (row.Exists("Availability"))
{
mAvailability = row.GetEnum<Availability.FlagField>("Availability", Availability.FlagField.None);
if (mAvailability == Availability.FlagField.None)
{
BooterLogger.AddError("Unknown Availability: " + row.GetString("Availability"));
}
else
{
mFlags |= Flags.Availability;
}
}
if (row.Exists("Advertised"))
{
ParseAdvertised(row.GetStringList("Advertised", ','));
}
}
示例8: ParseAccumulator
protected bool ParseAccumulator(XmlDbRow row, string prefix, List<AccumulatorLoadValue> accumulators, ref string error)
{
for (int i = 0; i < 10; i++)
{
string key = prefix + i;
if (!row.Exists(key)) break;
string value = row.GetString(key);
if (string.IsNullOrEmpty(value))
{
error = prefix + i + " empty";
return false;
}
string[] values = value.Split(',');
if (values.Length != 2)
{
error = prefix + i + " not properly formatted";
return false;
}
string name = values[0].Trim();
bool reset = false;
int accumulator = 0;
if (values[1].Trim().ToLower() == "reset")
{
reset = true;
}
else
{
if (!int.TryParse(values[1].Trim(), out accumulator))
{
error = prefix + i + " second parameter not integer";
return false;
}
}
mAccumulators.Add(new AccumulatorLoadValue(name, accumulator, reset));
}
return true;
}
示例9: ParseBuffs
protected bool ParseBuffs(XmlDbRow row, string prefix1, string prefix2, Dictionary<BuffNames,Origin> buffs, ref string error)
{
if ((!string.IsNullOrEmpty(prefix2)) && (!ParseBuffs(row, prefix1, null, buffs, ref error)))
{
return false;
}
string prefix = prefix1 + prefix2;
int index = 0;
while (true)
{
if (!row.Exists(prefix + "Buff" + index)) break;
BuffNames buff;
if (!ParserFunctions.TryParseEnum<BuffNames>(row.GetString(prefix + "Buff" + index), out buff, BuffNames.Undefined))
{
error = prefix + "Buff" + index + " unknown";
return false;
}
if (buffs.ContainsKey(buff))
{
error = prefix + "Buff " + buff + " already found";
return false;
}
if (!row.Exists(prefix + "Origin" + index))
{
error = prefix + "Origin" + index + " missing";
return false;
}
Origin origin;
if (!ParserFunctions.TryParseEnum<Origin>(row.GetString(prefix + "Origin" + index), out origin, Origin.None))
{
error = prefix + "Origin" + index + " unknown";
return false;
}
buffs.Add(buff, origin);
index++;
}
return true;
}
示例10: Parse
public override bool Parse(XmlDbRow row)
{
if (!base.Parse(row)) return false;
List<string> subFieldNames = new List<string>();
int count = 1;
while (true)
{
string suffix = null;
if (count > 1)
{
suffix = count.ToString();
}
string subFieldName = row.GetString("SubFieldName" + suffix);
if (string.IsNullOrEmpty(subFieldName))
{
break;
}
subFieldNames.Add(subFieldName);
count++;
}
if (subFieldNames.Count == 0)
{
BooterLogger.AddError("SubFieldName missing for " + mParentType + "." + mFieldName);
return false;
}
FieldInfo subField = GetFieldInfo();
if (subField == null)
{
BooterLogger.AddError("Unknown Field for " + mParentType.ToString() + "." + mFieldName);
return false;
}
NestedStore parentStore = this;
for (int i = 0; i < subFieldNames.Count - 1; i++)
{
FieldInfo newField = subField.FieldType.GetField(subFieldNames[i], BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
if (newField == null)
{
BooterLogger.AddError("Unknown SubField for " + subField.FieldType.ToString() + "." + subFieldNames[i]);
return false;
}
NestedStore newStore = new NestedStore(newField, null);
parentStore.mChild = newStore;
subField = newField;
parentStore = newStore;
}
string finalFieldName = subFieldNames[subFieldNames.Count - 1];
FieldInfo finalField = subField.FieldType.GetField(finalFieldName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
if (finalField == null)
{
BooterLogger.AddError("Unknown SubField for " + subField.FieldType.ToString() + "." + finalFieldName);
return false;
}
ValueStore child = null;
if (row.Exists("Index"))
{
int index = row.GetInt("Index", -1);
if (index < 0)
{
BooterLogger.AddError("Invalid Index for " + mParentType + "." + mFieldName);
return false;
}
child = new ArrayValueStore(finalField, index, null);
}
else
{
child = new ValueStore(finalField, null);
}
parentStore.mChild = child;
return child.ParseValue(row);
}
示例11: ParseValue
public bool ParseValue(XmlDbRow row)
{
if (!row.Exists("Value"))
{
BooterLogger.AddError("Value missing for " + mParentType + "." + mFieldName);
return false;
}
FieldInfo field = GetFieldInfo();
if (field == null)
{
BooterLogger.AddError("Unknown Field for " + mParentType + "." + mFieldName);
return false;
}
ITunableConvertOption fieldOption = TunableTypeOption.GetFieldOption(GetParsingType(field));
if (fieldOption != null)
{
try
{
mValue = fieldOption.Clone(GetTunableFieldInfo()).Convert(row.GetString("Value"), true);
return true;
}
catch (Exception e)
{
Common.Exception(mParentType + "." + mFieldName + Common.NewLine + row.GetString("Value"), e);
return false;
}
}
else
{
BooterLogger.AddError("Unhandled Field type : " + field.FieldType + " (" + mParentType + "." + mFieldName + ")");
return false;
}
}
示例12: Parse
public bool Parse(XmlDbRow row, StoryProgressionObject manager, IUpdateManager updater, string prefix, bool errorIfNone, ref string error)
{
mDisallowRelated = row.GetBool(prefix + "DisallowRelated");
if (row.Exists(prefix + "StandardFilter"))
{
mEnabled = true;
if (!ParserFunctions.TryParseEnum<StandardFilter>(row.GetString(prefix + "StandardFilter"), out mStandardFilter, StandardFilter.None))
{
error = prefix + "StandardFilter invalid";
return false;
}
}
string customTest = row.GetString(prefix + "CustomTest");
mCustomTest = new Common.MethodStore(customTest, new Type[] { typeof(Parameters), typeof(SimDescription), typeof(SimDescription) });
if ((mCustomTest == null) && (!string.IsNullOrEmpty(customTest)))
{
error = prefix + "CustomTest Invalid";
return false;
}
switch (mStandardFilter)
{
case StandardFilter.ExistingFriend:
case StandardFilter.ExistingEnemy:
case StandardFilter.Nemesis:
if (!row.Exists(prefix + "StandardIgnoreBusy"))
{
error = prefix + "StandardIgnoreBusy missing";
return false;
}
mStandardIgnoreBusy = row.GetBool(prefix + "StandardIgnoreBusy");
break;
}
switch (mStandardFilter)
{
case StandardFilter.ExistingFriend:
case StandardFilter.ExistingEnemy:
RelationshipLevel standardLevel;
if (ParserFunctions.TryParseEnum<RelationshipLevel>(row.GetString(prefix + "StandardGate"), out standardLevel, RelationshipLevel.Neutral))
{
mStandardGate = (int)standardLevel;
}
else
{
RelationshipLevel defGate = RelationshipLevel.Neutral;
if (mStandardFilter == StandardFilter.ExistingFriend)
{
defGate = RelationshipLevel.Friend;
}
else
{
defGate = RelationshipLevel.Enemy;
}
mStandardGate = row.GetInt(prefix + "StandardGate", (int)defGate);
}
break;
case StandardFilter.ExistingFlirt:
case StandardFilter.ExistingOrAnyFlirt:
if (!row.Exists(prefix + "StandardDisallowPartner"))
{
error = prefix + "StandardDisallowPartner missing";
return false;
}
break;
}
// The default for DisallowPartner can be altered by the calling system, don't overwrite it
if (row.Exists(prefix + "StandardDisallowPartner"))
{
mStandardDisallowPartner = row.GetBool(prefix + "StandardDisallowPartner");
}
switch (mStandardFilter)
{
case StandardFilter.AnyFlirt:
case StandardFilter.ExistingOrAnyFlirt:
if (!row.Exists(prefix + "AllowAffair"))
{
error = prefix + "AllowAffair missing";
return false;
}
break;
}
if (row.Exists(prefix + "AllowOpposing"))
{
mAllowOpposing = row.GetBool(prefix + "AllowOpposing");
}
else
{
mAllowOpposing = true;
//.........这里部分代码省略.........
示例13: Parse
public override bool Parse(XmlDbRow row, string prefix, bool firstPass, ref string error)
{
mDelta = row.GetInt(prefix + "PropagateDelta", -25);
if (row.Exists(prefix + "PropagateEnemy"))
{
if (!ParserFunctions.TryParseEnum<WhichSim>(row.GetString(prefix + "PropagateEnemy"), out mEnemySim, WhichSim.Actor))
{
error = prefix + "PropagateEnemy unknown";
return false;
}
}
SimScenarioFilter.RelationshipLevel relationLevel;
if (ParserFunctions.TryParseEnum<SimScenarioFilter.RelationshipLevel>(row.GetString(prefix + "PropagateRelationshipGate"), out relationLevel, SimScenarioFilter.RelationshipLevel.Neutral))
{
mRelationshipGate = (int)relationLevel;
}
else
{
mRelationshipGate = row.GetInt(prefix + "PropagateRelationshipGate", mRelationshipGate);
}
return base.Parse(row, prefix, firstPass, ref error);
}
示例14: Parse
public override bool Parse(XmlDbRow row, ref string error)
{
mName = new WeightOption.NameOption(row);
mBail = new IntegerOption.OptionValue(-1);
if (row.Exists("Bail"))
{
if (!mBail.Parse(row, "Bail", Manager, this, ref error))
{
return false;
}
}
mChance = new IntegerOption.OptionValue();
if (!mChance.Parse(row, "Chance", Manager, this, ref error))
{
return false;
}
mSuccess = new WeightScenarioHelper(Origin.FromBurglar);
if (!mSuccess.Parse(row, Manager, this, "Success", ref error))
{
return false;
}
return base.Parse(row, ref error);
}
示例15: Parse
public override bool Parse(XmlDbRow row, ref string error)
{
mName = new WeightOption.NameOption(row);
if (!row.Exists("AllowGoToJail"))
{
error = "AllowGoToJail missing";
return false;
}
mAllowGoToJail = row.GetBool("AllowGoToJail");
mBail = new IntegerOption.OptionValue(-1);
if (row.Exists("Bail"))
{
if (!mBail.Parse(row, "Bail", Manager, this, ref error))
{
return false;
}
}
if (!row.Exists("AllowInjury"))
{
error = "AllowInjury missing";
return false;
}
mAllowInjury = row.GetBool("AllowInjury");
mSneakinessScoring = row.GetString("SneakinessScoring");
mInvestigate = new InvestigationHelper();
if (!mInvestigate.Parse(row, Manager, this, ref error))
{
return false;
}
mSuccess = new WeightScenarioHelper(Origin.FromFire);
if (!mSuccess.Parse(row, Manager, this, "Success", ref error))
{
return false;
}
mFailure = new WeightScenarioHelper(Origin.FromFire);
if (!mFailure.Parse(row, Manager, this, "Failure", ref error))
{
return false;
}
return base.Parse(row, ref error);
}