コード例 #1
0
ファイル: Preferences.cs プロジェクト: ratsil/bethe.ingenie
 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
0
ファイル: Preferences.cs プロジェクト: ratsil/bethe.ingenie
		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
0
ファイル: Preferences.cs プロジェクト: ratsil/bethe.ingenie
                static public Text Parse(XmlNode cXmlNode)
                {
                    Text cRetVal = new Text();
                    XmlNode cNodeFont = cXmlNode.NodeGet("font");
                    cRetVal.cFont = new System.Drawing.Font(cNodeFont.AttributeValueGet("name"), cNodeFont.AttributeGet<int>("size"), cNodeFont.AttributeGet<System.Drawing.FontStyle>("style"));
					cRetVal.nTopOffset = cNodeFont.AttributeGet<short>("offset", false);
					if (cRetVal.nTopOffset == short.MaxValue)
						cRetVal.nTopOffset = 0;
                    cXmlNode = cNodeFont.NodeGet("color");
                    cRetVal.stColor = System.Drawing.Color.FromArgb(cXmlNode.AttributeGet<byte>("alpha"), cXmlNode.AttributeGet<byte>("red"), cXmlNode.AttributeGet<byte>("green"), cXmlNode.AttributeGet<byte>("blue"));
                    if (null != (cXmlNode = cNodeFont.NodeGet("border", false)))
                    {
                        cRetVal.nBorderWidth = cXmlNode.AttributeValueGet("width").ToFloat();
                        cXmlNode = cXmlNode.NodeGet("color");
                        cRetVal.stColorBorder = System.Drawing.Color.FromArgb(cXmlNode.AttributeGet<byte>("alpha"), cXmlNode.AttributeGet<byte>("red"), cXmlNode.AttributeGet<byte>("green"), cXmlNode.AttributeGet<byte>("blue"));
                    }
                    return cRetVal;
                }
コード例 #4
0
ファイル: Effects.cs プロジェクト: ratsil/bethe.ingenie
		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;
        }
コード例 #5
0
ファイル: Roll.cs プロジェクト: ratsil/bethe.ingenie
        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;
			}
        }