本文整理汇总了C#中System.OperatingSystem.Load方法的典型用法代码示例。如果您正苦于以下问题:C# OperatingSystem.Load方法的具体用法?C# OperatingSystem.Load怎么用?C# OperatingSystem.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.OperatingSystem
的用法示例。
在下文中一共展示了OperatingSystem.Load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: mnuEditPaste_Click
private void mnuEditPaste_Click(object sender, EventArgs e)
{
if (tabCharacterTabs.SelectedTab == tabStreetGear)
{
// Lifestyle Tab.
if (tabStreetGearTabs.SelectedTab == tabLifestyle)
{
// Paste Lifestyle.
Lifestyle objLifestyle = new Lifestyle(_objCharacter);
XmlNode objXmlNode = GlobalOptions.Instance.Clipboard.SelectSingleNode("/character/lifestyle");
if (objXmlNode != null)
{
objLifestyle.Load(objXmlNode, true);
// Reset the number of months back to 1 since 0 isn't valid in Create Mode.
objLifestyle.Months = 1;
_objCharacter.Lifestyles.Add(objLifestyle);
TreeNode objLifestyleNode = new TreeNode();
objLifestyleNode.Text = objLifestyle.DisplayName;
objLifestyleNode.Tag = objLifestyle.InternalId;
if (objLifestyle.Comforts != "")
objLifestyleNode.ContextMenuStrip = cmsAdvancedLifestyle;
else
objLifestyleNode.ContextMenuStrip = cmsLifestyleNotes;
if (objLifestyle.Notes != string.Empty)
objLifestyleNode.ForeColor = Color.SaddleBrown;
objLifestyleNode.ToolTipText = objLifestyle.Notes;
treLifestyles.Nodes[0].Nodes.Add(objLifestyleNode);
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
return;
}
}
// Armor Tab.
if (tabStreetGearTabs.SelectedTab == tabArmor)
{
// Paste Armor.
Armor objArmor = new Armor(_objCharacter);
XmlNode objXmlNode = GlobalOptions.Instance.Clipboard.SelectSingleNode("/character/armor");
if (objXmlNode != null)
{
objArmor.Load(objXmlNode, true);
_objCharacter.Armor.Add(objArmor);
_objFunctions.CreateArmorTreeNode(objArmor, treArmor, cmsArmor, cmsArmorMod, cmsArmorGear);
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
return;
}
// Paste Gear.
Gear objGear = new Gear(_objCharacter);
objXmlNode = GlobalOptions.Instance.Clipboard.SelectSingleNode("/character/gear");
if (objXmlNode != null)
{
switch (objXmlNode["category"].InnerText)
{
case "Commlink":
case "Commlink Upgrade":
Commlink objCommlink = new Commlink(_objCharacter);
objCommlink.Load(objXmlNode, true);
objGear = objCommlink;
break;
case "Commlink Operating System":
case "Commlink Operating System Upgrade":
OperatingSystem objOperatingSystem = new OperatingSystem(_objCharacter);
objOperatingSystem.Load(objXmlNode, true);
objGear = objOperatingSystem;
break;
default:
Gear objNewGear = new Gear(_objCharacter);
objNewGear.Load(objXmlNode, true);
objGear = objNewGear;
break;
}
foreach (Armor objCharacterArmor in _objCharacter.Armor)
{
if (objCharacterArmor.InternalId == treArmor.SelectedNode.Tag.ToString())
{
objCharacterArmor.Gears.Add(objGear);
TreeNode objNode = new TreeNode();
objNode.Text = objGear.DisplayName;
objNode.Tag = objGear.InternalId;
objNode.ContextMenuStrip = cmsArmorGear;
_objFunctions.BuildGearTree(objGear, objNode, cmsArmorGear);
treArmor.SelectedNode.Nodes.Add(objNode);
treArmor.SelectedNode.Expand();
}
}
//.........这里部分代码省略.........
示例2: RefreshPasteStatus
/// <summary>
/// Enable/Disable the Paste Menu and ToolStrip items as appropriate.
/// </summary>
private void RefreshPasteStatus()
{
bool blnPasteEnabled = false;
bool blnCopyEnabled = false;
if (tabCharacterTabs.SelectedTab == tabStreetGear)
{
// Lifestyle Tab.
if (tabStreetGearTabs.SelectedTab == tabLifestyle)
{
if (GlobalOptions.Instance.ClipboardContentType == ClipboardContentType.Lifestyle)
blnPasteEnabled = true;
try
{
foreach (Lifestyle objLifestyle in _objCharacter.Lifestyles)
{
if (objLifestyle.InternalId == treLifestyles.SelectedNode.Tag.ToString())
{
blnCopyEnabled = true;
break;
}
}
}
catch
{
}
}
// Armor Tab.
if (tabStreetGearTabs.SelectedTab == tabArmor)
{
if (GlobalOptions.Instance.ClipboardContentType == ClipboardContentType.Armor)
blnPasteEnabled = true;
if (GlobalOptions.Instance.ClipboardContentType == ClipboardContentType.Gear || GlobalOptions.Instance.ClipboardContentType == ClipboardContentType.Commlink || GlobalOptions.Instance.ClipboardContentType == ClipboardContentType.OperatingSystem)
{
// Gear can only be pasted into Armor, not Armor Mods.
try
{
foreach (Armor objArmor in _objCharacter.Armor)
{
if (objArmor.InternalId == treArmor.SelectedNode.Tag.ToString())
{
blnPasteEnabled = true;
break;
}
}
}
catch
{
}
}
try
{
foreach (Armor objArmor in _objCharacter.Armor)
{
if (objArmor.InternalId == treArmor.SelectedNode.Tag.ToString())
{
blnCopyEnabled = true;
break;
}
}
}
catch
{
}
try
{
Gear objGear = (Gear)_objFunctions.FindEquipment(treArmor.SelectedNode.Tag.ToString(), _objCharacter.Armor, typeof(Gear));
if (objGear != null)
blnCopyEnabled = true;
}
catch
{
}
}
// Weapons Tab.
if (tabStreetGearTabs.SelectedTab == tabWeapons)
{
if (GlobalOptions.Instance.ClipboardContentType == ClipboardContentType.Weapon)
blnPasteEnabled = true;
if (GlobalOptions.Instance.ClipboardContentType == ClipboardContentType.Gear || GlobalOptions.Instance.ClipboardContentType == ClipboardContentType.Commlink || GlobalOptions.Instance.ClipboardContentType == ClipboardContentType.OperatingSystem)
{
// Check if the copied Gear can be pasted into the selected Weapon Accessory.
Gear objGear = new Gear(_objCharacter);
XmlNode objXmlNode = GlobalOptions.Instance.Clipboard.SelectSingleNode("/character/gear");
if (objXmlNode != null)
{
switch (objXmlNode["category"].InnerText)
{
case "Commlink":
case "Commlink Upgrade":
Commlink objCommlink = new Commlink(_objCharacter);
objCommlink.Load(objXmlNode, true);
objGear = objCommlink;
//.........这里部分代码省略.........
示例3: 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
{
//.........这里部分代码省略.........