Esempio n. 1
0
        /// <summary>
        /// テキスト効果の設定
        /// </summary>
        /// <param name="condition"></param>
        /// <param name="matche"></param>
        void _SetTextEffect( LineCondition condition, Match matche )
        {
            // 文字色の設定
            if( condition.Effect.Foreground != null )
            {
                FormattedText.SetForegroundBrush( condition.Effect.Foreground, matche.Index, matche.Length );
            }
            // 背景色の設定
            if( condition.Effect.Background != null )
            {
                var	backgroundInfo	= new BackgroundInfo()
                {
                    Index		= matche.Index,
                    Length		= matche.Length,
                    ColorBrush	= condition.Effect.Background,
                };

                m_backgroundInfos.Add( backgroundInfo );
            }
            // フォントサイズの設定
            if( condition.Effect.FontScale != -1 )
            {
                FormattedText.SetFontSize( FontSize * condition.Effect.FontScale, matche.Index, matche.Length );
            }
            // フォント幅の設定
            if( condition.Effect.FontWeight != null )
            {
                FormattedText.SetFontWeight( (FontWeight)condition.Effect.FontWeight, matche.Index, matche.Length );
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 読み込み
        /// </summary>
        /// <param name="tailerElement"></param>
        public void Load( XmlElement tailerElement )
        {
            // 属性
            foreach( XmlAttribute attribute in tailerElement.Attributes )
            {
                var	attributeName	= attribute.Name.ToLower();

                switch( attributeName )
                {
                case	"name":
                    Name	= attribute.Value;
                    break;
                case	"filepath":
                    FilePath	= attribute.Value;
                    break;
                case	"encoding":
                    Encoding	= Encoding.GetEncoding( attribute.Value );
                    break;
                case	"updateperiod":
                    UpdatePeriod	= new TimeSpan( 0, 0, 0, 0, int.Parse(attribute.Value) );
                    break;
                case	"maxline":
                    MaxLine	= int.Parse( attribute.Value );
                    break;
                case	"link":
                    _GetUri( attribute.Value );
                    break;
                default:
                    Debug.Assert( false, "未知の属性 attributeName={0}", attributeName );
                    break;
                }
            }

            // 要素
            foreach( XmlNode childNode in tailerElement.ChildNodes )
            {
                var	elementName	= childNode.Name.ToLower();

                switch( elementName )
                {
                case	"condition":
                    var	condition	= new LineCondition();
                    condition.Load( childNode as XmlElement );
                    Conditions.Add( condition );
                    break;
                default:
                    Debug.Assert( false, "未知の要素 elementName={0}", elementName );
                    break;
                }
            }
        }