本文整理汇总了C#中System.Xml.XmlNode.AttributeValueGet方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.AttributeValueGet方法的具体用法?C# XmlNode.AttributeValueGet怎么用?C# XmlNode.AttributeValueGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlNode
的用法示例。
在下文中一共展示了XmlNode.AttributeValueGet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
static public Item Parse(XmlNode cXmlNode)
{
Item cRetVal;
switch(cXmlNode.AttributeValueGet("type", false))
{
case "text":
case null:
cRetVal = Text.Parse(cXmlNode);
break;
default:
throw new Exception("uknown item type");
}
cRetVal.sID = cXmlNode.AttributeValueGet("id", false);
cRetVal.bCuda = ("true" == cXmlNode.AttributeValueGet("cuda", false).ToLower());
return cRetVal;
}
示例2: 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 + "]");
}
}
示例3: LoadXML
override public void LoadXML(XmlNode cXmlNode)
{
if (null == cXmlNode)
return;
base.LoadXML(cXmlNode);
if((sFile = cXmlNode.AttributeValueGet("file", false)).IsNullOrEmpty())
throw new Exception("указано некорректное значение атрибута file плагина [TPL:" + cXmlNode.BaseURI + "]"); //TODO LANG
if((sClass = cXmlNode.AttributeValueGet("class", false)).IsNullOrEmpty())
throw new Exception("указано некорректное значение атрибута class плагина [TPL:" + cXmlNode.BaseURI + "]"); //TODO LANG
if (null != (cXmlNode = cXmlNode.NodeGet("data", false)))
sData = cXmlNode.OuterXml;
}
示例4: 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;
}
}