本文整理汇总了C#中System.Xml.XmlNode.NodesGet方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.NodesGet方法的具体用法?C# XmlNode.NodesGet怎么用?C# XmlNode.NodesGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlNode
的用法示例。
在下文中一共展示了XmlNode.NodesGet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadXML
override protected void LoadXML(XmlNode cXmlNode)
{
if (null == cXmlNode || _bInitialized)
return;
_sRestartFile = cXmlNode.AttributeValueGet("restart", false);
XmlNode[] aNodeChilds = cXmlNode.NodesGet("process", false);
if (null != aNodeChilds)
{
List<Process> aProcesses = new List<Process>();
for (int nIndx = 0; aNodeChilds.Length > nIndx; nIndx++)
{
aProcesses.Add(new Process()
{
sName = aNodeChilds[nIndx].AttributeValueGet("name"),
sOwner = aNodeChilds[nIndx].AttributeValueGet("owner"),
sArguments = aNodeChilds[nIndx].AttributeValueGet("arguments", false)
});
}
_aProcesses = aProcesses.ToArray();
}
XmlNode cXNBlender = cXmlNode.NodeGet("blender", false);
if (null != cXNBlender)
{
_cBlender = new Blender() { sPath = cXNBlender.AttributeValueGet("path"), sTasks = cXNBlender.AttributeValueGet("tasks"), nQueue = (cXNBlender.AttributeValueGet("queue", false) ?? "1").ToByte() };
if (!System.IO.File.Exists(_cBlender.sPath) || !System.IO.Directory.Exists(_cBlender.sTasks))
throw new Exception("cannot find blender executable or tasks folder[" + _cBlender.sPath +"][" + _cBlender.sTasks + "]");
}
}
示例2: MakeComposites
private void MakeComposites(XmlNode cXmlNode, string sDefaultID, Composite cRetVal)
{
XmlNode[] aNodes = cXmlNode.NodesGet("item", false);
string sID = cXmlNode.AttributeValueGet("id", false);
if (null == sID)
sID = sDefaultID;
if (!aNodes.IsNullOrEmpty())
{
foreach (XmlNode cXN in aNodes)
MakeComposites(cXN, sID, cRetVal);
return;
}
Preferences.Item.Text cPreferencesItem = (Preferences.Item.Text)_cPreferences[sID];
string sText = cXmlNode.InnerText;
sText = sText.RemoveNewLines();
if (0 == _nWidthOfSpace)
_nWidthOfSpace = (ushort)(BTL.Play.Text.Measure("SSS SSS", cPreferencesItem.cFont, 0).nWidth - BTL.Play.Text.Measure("SSSSSS", cPreferencesItem.cFont, 0).nWidth);
List<EffectVideo> aEffects = new List<EffectVideo>();
ushort nIdent = 0;
Text cText = new BTL.Play.Text(sText, cPreferencesItem.cFont, cPreferencesItem.nBorderWidth) { bCUDA = false, stColor = cPreferencesItem.stColor, stColorBorder = cPreferencesItem.stColorBorder };
ushort nMaxWidth = _cPreferences.stArea.nWidth;
if (nMaxWidth < cText.stArea.nWidth)
{
List<string> aSplited = new List<string>();
int nk = 0;
bool bLastLetter = false, bLastDigit = false; //, bLastLetter = false;
for (int ni = 0; sText.Length > ni; ni++)
{
if (0 != ni && ((!bLastDigit && !bLastLetter && Char.IsLetterOrDigit(sText[ni])) || (bLastLetter && !(Char.IsLetter(sText[ni]))) || (bLastDigit && !(Char.IsDigit(sText[ni])))))
{
aSplited.Add(sText.Substring(nk, ni - nk));
nk = ni;
}
bLastLetter = Char.IsLetter(sText[ni]);
bLastDigit = Char.IsDigit(sText[ni]);
}
foreach (string sStr in aSplited)
{
cText = new BTL.Play.Text(sStr, cPreferencesItem.cFont, cPreferencesItem.nBorderWidth) { bCUDA = false, stColor = cPreferencesItem.stColor, stColorBorder = cPreferencesItem.stColorBorder };
Text cTextPrev = null; ;
int ni = 0;
nk = 1;
if (nMaxWidth < cText.stArea.nWidth)
{
while (ni + nk < sStr.Length)
{
cText = new BTL.Play.Text(sStr.Substring(ni, nk), cPreferencesItem.cFont, cPreferencesItem.nBorderWidth) { bCUDA = false, stColor = cPreferencesItem.stColor, stColorBorder = cPreferencesItem.stColorBorder };
while (nMaxWidth > cText.stArea.nWidth && (ni + nk < sStr.Length))
{
nk++;
cTextPrev = cText;
cText = new BTL.Play.Text(sStr.Substring(ni, nk), cPreferencesItem.cFont, cPreferencesItem.nBorderWidth) { bCUDA = false, stColor = cPreferencesItem.stColor, stColorBorder = cPreferencesItem.stColorBorder };
}
ni += nk - 1;
nk = 1;
if (ni + nk == sStr.Length)
cTextPrev = cText;
aEffects.Add(cTextPrev);
}
}
else
aEffects.Add(cText);
}
}
else
aEffects.Add(cText);
nIdent = 0;
for(int nIndx = 0; aEffects.Count > nIndx; nIndx++)
{
if (cRetVal.stArea.nWidth + aEffects[nIndx].stArea.nWidth + nIdent > nMaxWidth)
break;
aEffects[nIndx].stArea = new Area(aEffects[nIndx].stArea.nLeft, (short)(aEffects[nIndx].stArea.nTop + cPreferencesItem.nTopOffset), aEffects[nIndx].stArea.nWidth, aEffects[nIndx].stArea.nHeight);
cRetVal.EffectAdd(aEffects[nIndx], nIdent);
nIdent = _nWidthOfSpace;
}
}