예제 #1
0
 /// <summary>
 /// Birden fazla taga bir öğreyi bbkoda bağlar
 /// </summary>
 /// <param name="bbcodes">BBKod dizisi</param>
 /// <param name="info">BBKod bilgisi</param>
 public void SetMultipleTag(string[] bbcodes, BBCodeInfo info)
 {
     for (int i = 0; i < bbcodes.Length; i++)
     {
         this.SetTag(bbcodes[i], info);
     }
 }
예제 #2
0
        /// <summary>
        /// Belirtilen BBKod bilgisini dönderir.
        /// </summary>
        /// <param name="bbcode">BBKod</param>
        /// <returns>Yoksa varsayılan veya null döner</returns>
        public BBCodeInfo GetTag(string bbcode)
        {
            BBCodeInfo info = null;

            if (this.BBCodes.TryGetValue(bbcode, out info))
            {
                return(info);
            }
            //Eğer yoksa varsayılan tagı ara
            this.BBCodes.TryGetValue("*", out info);
            return(info);
        }
        public override TextEvulateResult Render(TextElement tag, object vars)
        {
            this.bbCodeEvulator = this.Evulator.CustomDataSingle as BBCodeEvulator;
            TextEvulateResult result = new TextEvulateResult()
            {
                Result = TextEvulateResultEnum.EVULATE_DEPTHSCAN
            };
            var dict = this.GetDictionary(tag);

            currentInfo = this.bbCodeEvulator.GetTag(tag.ElemName);
            if (currentInfo == null)
            {
                return(result);
            }
            if (currentInfo.CustomEvulator != null)
            {
                customEvulatorHandler = Activator.CreateInstance(currentInfo.CustomEvulator) as BaseEvulator;
                customEvulatorHandler.SetEvulator(this.Evulator);
                result = customEvulatorHandler.Render(tag, vars);
            }
            else if ((currentInfo.Flags & BBCodeInfoFlags.InnerTextOnly) != 0 && currentInfo.Enabled && !tag.AutoClosed)
            {
                dict["Text"] = tag.InnerText();
                var validateResult = currentInfo.Validate(dict, tag);
                if (validateResult != null && validateResult.Cancel)
                {
                    result.TextContent = null;
                }
                else
                {
                    result.TextContent = currentInfo.TagFormat.Apply(dict);
                }

                result.Result = TextEvulateResultEnum.EVULATE_TEXT;
                printed       = true;
            }
            return(result);
        }
예제 #4
0
 /// <summary>
 /// Bir tagı bbkoda bağlar
 /// </summary>
 /// <param name="bbcode">BBKod</param>
 /// <param name="info">BBKod bilgisi</param>
 public void SetTag(string bbcode, BBCodeInfo info)
 {
     this.BBCodes[bbcode] = info;
 }