コード例 #1
0
ファイル: Template.cs プロジェクト: ratsil/bethe.ingenie
		public void TextSplit()
		{
			if (bSplitted)
				return;
			Roll cRoll = (Roll)_aAtoms.FirstOrDefault(o => o is Roll);
			if (null != cRoll)
			{
				cRoll.EffectOnScreen += new Container.EventDelegate(cRoll_EffectOnScreen);
				cRoll.EffectOffScreen += new Container.EventDelegate(cRoll_EffectOffScreen);
				List<Effect> aEffectsInRoll = cRoll.EffectsGet();
				cSourceText = (Text)aEffectsInRoll.FirstOrDefault(o => o is Text);
				if (null != cSourceText)
				{
					cRoll.EffectRemove(cSourceText);
					TextSplitting cTS = new TextSplitting(cSourceText.sText, Preferences.nMaxTextWidth, cSourceText.cFont);
					aSplittedText = cTS.Split();
					aSplittedEffects = new List<Text>();
					foreach (string sLine in aSplittedText)
					{
						Text cT = new Text();
						cT.sText = sLine;
						cT.nLayer = cSourceText.nLayer;
						//cT.bOpacity = cT.bOpacity;
						cT.cDock = cSourceText.cDock;
						cT.cFont = cSourceText.cFont;
						aSplittedEffects.Add(cT);
						cRoll.EffectAdd(cT);
					}
					//aEffectsInRoll.Remove(cSourceText);
					//aEffectsInRoll.AddRange(aSplittedEffects);
					
					bSplitted = true;
				}
			}
		}
コード例 #2
0
ファイル: Template.cs プロジェクト: ratsil/bethe.ingenie
		public void PrompterRestartFrom(int nLine)
		{
			Roll cOldRoll = (Roll)_aAtoms.FirstOrDefault(o => o is Roll);
			Roll cNewRoll = new Roll();
			cNewRoll.EffectOnScreen += new Container.EventDelegate(cRoll_EffectOnScreen);
			cNewRoll.EffectOffScreen += new Container.EventDelegate(cRoll_EffectOffScreen);
			if (null != cOldRoll)
			{
				cOldRoll.Stop();
				_aAtoms.Remove(cOldRoll);
				_aAtoms.Add(cNewRoll);
				cNewRoll.nLayer = cOldRoll.nLayer;
				cNewRoll.nSpeed = cOldRoll.nSpeed;
				cNewRoll.nLayer = cOldRoll.nLayer;
				cNewRoll.stArea = cOldRoll.stArea;
				cNewRoll.cHide = cOldRoll.cHide;
				cNewRoll.cShow = cOldRoll.cShow;
				cNewRoll.bOpacity = cOldRoll.bOpacity;
				cNewRoll.cDock = cOldRoll.cDock;
				cNewRoll.eDirection = cOldRoll.eDirection;
				List<Effect> aEffectsInRoll = cNewRoll.EffectsGet();
				for (int nI = nLine - 1; aSplittedEffects.Count > nI; nI++)
				{
					if (aSplittedEffects[nI].eStatus == Atom.Status.Idle || aSplittedEffects[nI].eStatus == Atom.Status.Prepared)
						cNewRoll.EffectAdd(aSplittedEffects[nI]);  //aEffectsInRoll.Add(aSplittedEffects[nI]);
					else
					{
						Text cT = new Text();
						cT.sText = aSplittedText[nI];
						cT.nLayer = cSourceText.nLayer;
						//cT.bOpacity = cT.bOpacity;
						cT.cDock = cSourceText.cDock;
						cT.cFont = cSourceText.cFont;
						aSplittedEffects[nI] = cT;
						cNewRoll.EffectAdd(cT);
						//aEffectsInRoll.Add(cT);
					}
				}
				nOnScreen = nOffScreen = nLine - 1;
				cNewRoll.Prepare();
				cNewRoll.Start();
			}
		}
コード例 #3
0
ファイル: Template.cs プロジェクト: ratsil/bethe.ingenie
        public TemplatePrompter(string sFile)
            : base(sFile, COMMAND.unknown)
        {
			bSplitted = false;
			aSplittedText = null;
			aSplittedEffects = null;
			cSourceText = null;
			nOnScreen = 0;
			nOffScreen = 0;
        }
コード例 #4
0
ファイル: Template.cs プロジェクト: ratsil/bethe.ingenie
 public void TextCreate(string sText)
 {
     Text cText = new Text();
     cText.cFont = new Font() { sName = "Arial", nSize = 1, nFontStyle = 1, cBorder = new Border(), cColor = new Color(), nWidth = 0 };
     cText.sText = sText;
     _aAtoms.Add(cText);
 }
コード例 #5
0
ファイル: Effects.cs プロジェクト: ratsil/bethe.ingenie
        public bool TryAddText(string sText)
        {
            Item[] aTexts = _aItems.Where(o => o.cEffect is Text).ToArray();
            Text cTextLast, cText = null; ;
            if (null != aTexts && 0 < aTexts.Length)
            {
                cTextLast = (Text)aTexts.OrderByDescending(o => o.nOrder).ToArray()[0].cEffect;
                cText = new Text() { sText = sText };
                cText.cFont = new Font() { sName = cTextLast.cFont.sName, nSize = cTextLast.cFont.nSize, nFontStyle = cTextLast.cFont.nFontStyle, nWidth = cTextLast.cFont.nWidth };
                cText.cFont.cColor = new Color() { nAlpha = cTextLast.cFont.cColor.nAlpha, nBlue = cTextLast.cFont.cColor.nBlue, nGreen = cTextLast.cFont.cColor.nGreen, nRed = cTextLast.cFont.cColor.nRed };
                cText.cFont.cBorder = new Border() { nWidth = cTextLast.cFont.cBorder.nWidth, cColor = new Color() { nAlpha = cTextLast.cFont.cBorder.cColor.nAlpha, nBlue = cTextLast.cFont.cBorder.cColor.nBlue, nGreen = cTextLast.cFont.cBorder.cColor.nGreen, nRed = cTextLast.cFont.cBorder.cColor.nRed } };

                EffectAdd(cText);
                return true;
            }
            return false;
        }
コード例 #6
0
ファイル: Template.cs プロジェクト: ratsil/bethe.ingenie
		private void ParseXML()
		{
            if ("" == sFile) // т.е. файл не неправильный, а его просто нет
                return;
			_aAtoms.Clear();
			if (!System.IO.File.Exists(sFile))
				throw new Exception("отсутствует указанный файл шаблона [FL:" + sFile + "]"); //TODO LANG
			XmlDocument cXMLTemplate = new XmlDocument();
			string sXML = System.IO.File.ReadAllText(sFile);
			sXML = ProcessMacros(sXML);

			cXMLTemplate.Load(new System.IO.StringReader(sXML));
			XmlNode cXmlNode = cXMLTemplate.GetElementsByTagName("template")[0];

			if (0 < cXmlNode.Attributes.Count)
			{
				foreach (XmlAttribute cAttr in cXmlNode.Attributes)
					switch (cAttr.Name)
					{
						case "destroy":
							try
							{
								eDestroyType = (Template.DESTROY_TYPE)Enum.Parse(typeof(Template.DESTROY_TYPE), System.Text.RegularExpressions.Regex.Replace(cAttr.Value.Trim(), "\\W", "_"), true);
							}
							catch
							{
								throw new Exception("указан некорректный тип удаления [" + cAttr.Name + "=" + cAttr.Value + "][TPL:" + cXmlNode.BaseURI + "]"); //TODO LANG
							}
							break;
					}
			}
			XmlNodeList aChildNodes = cXmlNode.ChildNodes;
			Atom cAtom;
            this.aInclusions = null;
            List<Inclusion> aInclusions = new List<Inclusion>();
			for (int nIndx = 0; nIndx < aChildNodes.Count; nIndx++)
			{
				cAtom = null;
				switch (aChildNodes[nIndx].Name)
				{
					case "show":
                        #region show
						if (0 < aChildNodes[nIndx].Attributes.Count)
						{
                            foreach (XmlAttribute cAttr in aChildNodes[nIndx].Attributes)
                            {
                                switch (cAttr.Name)
                                {
                                    case "exists":
                                        try
                                        {
                                            eOnExists = (Template.EXISTS_BEHAVIOR)Enum.Parse(typeof(Template.EXISTS_BEHAVIOR), System.Text.RegularExpressions.Regex.Replace(cAttr.Value.Trim(), "\\W", "_"), true);
                                        }
                                        catch
                                        {
                                            throw new Exception("указан некорректный тип замещения [" + cAttr.Name + "=" + cAttr.Value + "][TPL:" + cXmlNode.BaseURI + "]"); //TODO LANG
                                        }
                                        break;
                                    case "lifetime":
                                        try
                                        {
                                            eLifeTime = (Template.LIFETIME)Enum.Parse(typeof(Template.LIFETIME), cAttr.Value.Trim(), true);
                                        }
                                        catch
                                        {
                                            try
                                            {
                                                nLifeTimeSeconds = cAttr.Value.Trim().ToInt32();
                                                eLifeTime = LIFETIME.Seconds;
                                            }
                                            catch
                                            {
                                                nLifeTimeSeconds = -1;
                                            }
                                            if (0 > nLifeTimeSeconds)
                                                throw new Exception("указана некорректная продолжительность существования [" + cAttr.Name + "=" + cAttr.Value + "][TPL:" + cXmlNode.BaseURI + "]"); //TODO LANG
                                        }
                                        break;
                                    case "misprepared":
                                        try
                                        {
                                            bMispreparedShow = cAttr.Value.Trim().ToBool();
                                        }
                                        catch
                                        {
                                            throw new Exception("указано некорректное значение поведения при нецелевой подготовке [" + cAttr.Name + "=" + cAttr.Value + "][TPL:" + cXmlNode.BaseURI + "]"); //TODO LANG
                                        }
                                        break;
                                }
                            }
						}
                        #endregion
						break;
                    case "include":
                    case "inclusion":
                    case "template":
                        Inclusion cInclusion = new Inclusion(this);
                        cInclusion.LoadXML(aChildNodes[nIndx]);
                        aInclusions.Add(cInclusion);
                        break;
					case "plugin":
						cAtom = new Plugin();
						break;
					case "video":
						cAtom = new Video();
						break;
					case "audio":
						cAtom = new Audio();
						break;
					case "animation":
						cAtom = new Animation();
						break;
					case "clock":
						cAtom = new Clock();
						break;
					case "text":
						cAtom = new Text();
						break;
					case "playlist":
						cAtom = new Playlist();
						break;
					case "roll":
						cAtom = new Roll();
						break;
				}
				if (null != cAtom)
				{
					cAtom.cTemplate = this;
                    cAtom.LoadXML(aChildNodes[nIndx]);
					if (!(cAtom is Effect) || ((Effect)cAtom).cShow.bShow)
						_aAtoms.Add(cAtom);
				}
                if(0 < aInclusions.Count)
                    this.aInclusions = aInclusions.ToArray();
			}
		}