本文整理汇总了C#中Cyberware.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Cyberware.Load方法的具体用法?C# Cyberware.Load怎么用?C# Cyberware.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cyberware
的用法示例。
在下文中一共展示了Cyberware.Load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
/// <summary>
/// Load the Character from an XML file.
/// </summary>
public bool Load()
{
XmlDocument objXmlDocument = new XmlDocument();
objXmlDocument.Load(_strFileName);
XmlNode objXmlCharacter = objXmlDocument.SelectSingleNode("/character");
XmlNodeList objXmlNodeList;
try
{
_blnIgnoreRules = Convert.ToBoolean(objXmlCharacter["ignorerules"].InnerText);
}
catch
{
_blnIgnoreRules = false;
}
try
{
_blnCreated = Convert.ToBoolean(objXmlCharacter["created"].InnerText);
}
catch
{
}
ResetCharacter();
// Get the game edition of the file if possible and make sure it's intended to be used with this version of the application.
try
{
if (objXmlCharacter["gameedition"].InnerText != string.Empty && objXmlCharacter["gameedition"].InnerText != "SR4")
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_IncorrectGameVersion_SR5"), LanguageManager.Instance.GetString("MessageTitle_IncorrectGameVersion"), MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
}
catch
{
}
// Get the name of the settings file in use if possible.
try
{
_strSettingsFileName = objXmlCharacter["settings"].InnerText;
}
catch
{
}
// Load the character's settings file.
if (!_objOptions.Load(_strSettingsFileName))
return false;
try
{
_decEssenceAtSpecialStart = Convert.ToDecimal(objXmlCharacter["essenceatspecialstart"].InnerText, GlobalOptions.Instance.CultureInfo);
// fix to work around a mistake made when saving decimal values in previous versions.
if (_decEssenceAtSpecialStart > EssenceMaximum)
_decEssenceAtSpecialStart /= 10;
}
catch
{
}
// Metatype information.
_strMetatype = objXmlCharacter["metatype"].InnerText;
try
{
_strMovement = objXmlCharacter["movement"].InnerText;
}
catch
{
}
_intMetatypeBP = Convert.ToInt32(objXmlCharacter["metatypebp"].InnerText);
_strMetavariant = objXmlCharacter["metavariant"].InnerText;
try
{
_strMetatypeCategory = objXmlCharacter["metatypecategory"].InnerText;
}
catch
{
}
try
{
_intMutantCritterBaseSkills = Convert.ToInt32(objXmlCharacter["mutantcritterbaseskills"].InnerText);
}
catch
{
}
// General character information.
_strName = objXmlCharacter["name"].InnerText;
try
{
_strMugshot = objXmlCharacter["mugshot"].InnerText;
}
catch
{
//.........这里部分代码省略.........
示例2: Load
/// <summary>
/// Load the Character from an XML file.
/// </summary>
public bool Load()
{
XmlDocument objXmlDocument = new XmlDocument();
objXmlDocument.Load(_strFileName);
XmlNode objXmlCharacter = objXmlDocument.SelectSingleNode("/character");
XmlNodeList objXmlNodeList;
try
{
_blnIgnoreRules = Convert.ToBoolean(objXmlCharacter["ignorerules"].InnerText);
}
catch
{
_blnIgnoreRules = false;
}
try
{
_blnCreated = Convert.ToBoolean(objXmlCharacter["created"].InnerText);
}
catch
{
}
ResetCharacter();
// Get the game edition of the file if possible and make sure it's intended to be used with this version of the application.
try
{
if (objXmlCharacter["gameedition"].InnerText != string.Empty && objXmlCharacter["gameedition"].InnerText != "SR5")
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_IncorrectGameVersion_SR4"), LanguageManager.Instance.GetString("MessageTitle_IncorrectGameVersion"), MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
}
catch
{
}
// Get the name of the settings file in use if possible.
try
{
_strSettingsFileName = objXmlCharacter["settings"].InnerText;
}
catch
{
}
// Load the character's settings file.
if (!_objOptions.Load(_strSettingsFileName))
return false;
try
{
_decEssenceAtSpecialStart = Convert.ToDecimal(objXmlCharacter["essenceatspecialstart"].InnerText, GlobalOptions.Instance.CultureInfo);
// fix to work around a mistake made when saving decimal values in previous versions.
if (_decEssenceAtSpecialStart > EssenceMaximum)
_decEssenceAtSpecialStart /= 10;
}
catch
{
}
try
{
_strVersionCreated = objXmlCharacter["createdversion"].InnerText;
}
catch
{
}
// Metatype information.
_strMetatype = objXmlCharacter["metatype"].InnerText;
try
{
_strWalk = objXmlCharacter["walk"].InnerText;
_strRun = objXmlCharacter["run"].InnerText;
_strSprint = objXmlCharacter["sprint"].InnerText;
}
catch
{
}
_intMetatypeBP = Convert.ToInt32(objXmlCharacter["metatypebp"].InnerText);
_strMetavariant = objXmlCharacter["metavariant"].InnerText;
try
{
_strMetatypeCategory = objXmlCharacter["metatypecategory"].InnerText;
}
catch
{
}
try
{
_intMutantCritterBaseSkills = Convert.ToInt32(objXmlCharacter["mutantcritterbaseskills"].InnerText);
}
catch
{
//.........这里部分代码省略.........
示例3: Load
/// <summary>
/// Load the VehicleMod from the XmlNode.
/// </summary>
/// <param name="objNode">XmlNode to load.</param>
public void Load(XmlNode objNode, bool blnCopy = false)
{
_guiID = Guid.Parse(objNode["guid"].InnerText);
_strName = objNode["name"].InnerText;
_strCategory = objNode["category"].InnerText;
_strLimit = objNode["limit"].InnerText;
_strSlots = objNode["slots"].InnerText;
_intRating = Convert.ToInt32(objNode["rating"].InnerText);
_strMaxRating = objNode["maxrating"].InnerText;
objNode.TryGetField("weaponmountcategories", out _strWeaponMountCategories);
objNode.TryGetField("response", out _intResponse);
objNode.TryGetField("system", out _intSystem);
objNode.TryGetField("firewall", out _intFirewall);
objNode.TryGetField("signal", out _intSignal);
objNode.TryGetField("pilot", out _intPilot);
objNode.TryGetField("page", out _strPage);
_strAvail = objNode["avail"].InnerText;
_strCost = objNode["cost"].InnerText;
_strSource = objNode["source"].InnerText;
_blnIncludeInVehicle = Convert.ToBoolean(objNode["included"].InnerText);
objNode.TryGetField("installed", out _blnInstalled);
objNode.TryGetField("subsystems", out _strSubsystems);
if (objNode.InnerXml.Contains("<weapons>"))
{
XmlNodeList nodChildren = objNode.SelectNodes("weapons/weapon");
foreach (XmlNode nodChild in nodChildren)
{
Weapon objWeapon = new Weapon(_objCharacter);
objWeapon.Load(nodChild, blnCopy);
_lstVehicleWeapons.Add(objWeapon);
}
}
if (objNode.InnerXml.Contains("<cyberwares>"))
{
XmlNodeList nodChildren = objNode.SelectNodes("cyberwares/cyberware");
foreach (XmlNode nodChild in nodChildren)
{
Cyberware objCyberware = new Cyberware(_objCharacter);
objCyberware.Load(nodChild, blnCopy);
_lstCyberware.Add(objCyberware);
}
}
try
{
_nodBonus = objNode["bonus"];
}
catch
{
}
objNode.TryGetField("notes", out _strNotes);
objNode.TryGetField("discountedcost", out _blnDiscountCost);
objNode.TryGetField("extra", out _strExtra);
if (GlobalOptions.Instance.Language != "en-us")
{
XmlDocument objXmlDocument = XmlManager.Instance.Load("vehicles.xml");
XmlNode objModNode = objXmlDocument.SelectSingleNode("/chummer/mods/mod[name = \"" + _strName + "\"]");
if (objModNode != null)
{
if (objModNode["translate"] != null)
_strAltName = objModNode["translate"].InnerText;
if (objModNode["altpage"] != null)
_strAltPage = objModNode["altpage"].InnerText;
}
objModNode = objXmlDocument.SelectSingleNode("/chummer/categories/category[. = \"" + _strCategory + "\"]");
if (objModNode != null)
{
if (objModNode.Attributes["translate"] != null)
_strAltCategory = objModNode.Attributes["translate"].InnerText;
}
}
if (blnCopy)
{
_guiID = Guid.NewGuid();
}
}