本文整理汇总了C#中System.Xml.XmlNodeReader.IsStartElement方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNodeReader.IsStartElement方法的具体用法?C# XmlNodeReader.IsStartElement怎么用?C# XmlNodeReader.IsStartElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlNodeReader
的用法示例。
在下文中一共展示了XmlNodeReader.IsStartElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
/// <summary>
/// Loads the image editors into the application from the editors.xml file.
/// </summary>
public static void Load()
{
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + XML_FILE))
{
XmlDocument xdoc = new XmlDocument();
xdoc.Load(AppDomain.CurrentDomain.BaseDirectory + XML_FILE);
XmlNodeList xeditors = xdoc.SelectNodes(EDITOR_XPATH);
foreach (XmlNode xeditor in xeditors)
{
Editor editor = new Editor();
XmlNodeReader xreader = new XmlNodeReader(xeditor);
while (xreader.Read())
{
if (xreader.IsStartElement())
{
switch (xreader.Name)
{
case EDITOR_NAME:
xreader.Read();
editor.Name = xreader.Value;
break;
case EDITOR_APPLICATION:
xreader.Read();
editor.Application = xreader.Value;
break;
case EDITOR_ARGUMENTS:
xreader.Read();
editor.Arguments = xreader.Value;
break;
}
}
}
xreader.Close();
if (!string.IsNullOrEmpty(editor.Name) &&
!string.IsNullOrEmpty(editor.Application) &&
!string.IsNullOrEmpty(editor.Arguments))
{
EditorCollection.Add(editor);
}
}
}
}
示例2: Iswin7
/// <summary>
/// 判断是否为WIN7 以及32或64位
/// </summary>
/// <param name="imagex">imagex文件名,默认传imagex字段</param>
/// <param name="wimfile">WIM文件路径</param>
/// <returns>不是WIN7系统:0,Windows 7 STARTER(表示为32位系统镜像):1,Windows 7 HOMEBASIC(表示为64位系统镜像):2</returns>
public static int Iswin7(string imagex, string wimfile)
{
ProcessManager.SyncCMD("\"" + WTGModel.applicationFilesPath + "\\" + imagex + "\"" + " /info \"" + wimfile + "\" /xml > " + "\"" + WTGModel.logPath + "\\wiminfo.xml\"");
XmlDocument xml = new XmlDocument();
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
System.Xml.XmlNodeReader reader = null;
string strFilename = WTGModel.logPath + "\\wiminfo.xml";
if (!File.Exists(strFilename))
{
//MsgManager.getResString("Msg_wiminfoerror")
//WIM文件信息获取失败\n将按WIN8系统安装
Log.WriteLog("Iswin7.log", strFilename + "文件不存在");
//MessageBox.Show(strFilename + MsgManager.getResString("Msg_wiminfoerror", MsgManager.ci));
return 0;
}
try
{
doc.Load(strFilename);
reader = new System.Xml.XmlNodeReader(doc);
while (reader.Read())
{
if (reader.IsStartElement("NAME"))
{
//从找到的这个依次往下读取节点
System.Xml.XmlNode aa = doc.ReadNode(reader);
if (aa.InnerText == "Windows 7 STARTER")
{
return 1;
}
else if (aa.InnerText == "Windows 7 HOMEBASIC")
{
return 2;
}
else { return 0; }
}
}
}
catch (Exception ex)
{
Log.WriteLog("Iswin7.log", strFilename + "\n" + ex.ToString());
//MessageBox.Show(strFilename + MsgManager.getResString("Msg_wiminfoerror", MsgManager.ci) + ex.ToString());
return 0;
}
return 0;
}