当前位置: 首页>>代码示例>>C#>>正文


C# ktString.Prepend方法代码示例

本文整理汇总了C#中KacTalk.ktString.Prepend方法的典型用法代码示例。如果您正苦于以下问题:C# ktString.Prepend方法的具体用法?C# ktString.Prepend怎么用?C# ktString.Prepend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KacTalk.ktString的用法示例。


在下文中一共展示了ktString.Prepend方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LogPlain

        /// <summary>
        /// Log the information as plain text
        /// </summary>
        /// <param name="Info">The text/information that should be logged</param>
        protected void LogPlain(ktString Info)
        {
            if (!m_Enabled) { return; }

            if (ktDebug.WrapLevel > 0)
            {
                if ( OnDebug != null )
                {
                    OnDebug(Info);
                }
                Info.Prepend(ktDebug.GetPrefix());
                /*				Info.Replace( "\n", "<ktDebug::Wrap::n>", true );
                                Info.Replace( "<ktDebug::Wrap::n>", "\n" + Prefix, true );*/
            }

            Console.WriteLine(Info);
        }
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:21,代码来源:ktDebug.cs

示例2: AsXML


//.........这里部分代码省略.........

                // Add end...
                StartElm += ">";
                EndElm += ">";

                // If the list has a value
                if (m_Node.Value != null)
                {
                    // Special, just for blocks...
                    if (m_Node.Value.GetType() == typeof(ktBlock))
                    {
                        ktList L = ((ktBlock)m_Node.Value).Lines;
                        if (L != null)
                        {
                            // Get it...
                            Content = ktXML.FromList(L).AsXML(IncludeDeclaration, m_Prefix + Prefix);
                        }
                    }
                    else if ((m_Node.Value.GetType() == typeof(ktToken)) &&
                              (((ktToken)m_Node.Value).Type == ktTokenType.Block))
                    {
                        if (((ktToken)m_Node.Value).Block == null)
                        {
                            goto EndOfNode;
                        }
                        ktList L = ((ktToken)m_Node.Value).Block.Lines;
                        if (L != null)
                        {
                            // Get it...
                            Content = ktXML.FromList(L).AsXML(IncludeDeclaration, m_Prefix + Prefix);
                        }
                    }
                    else
                    {
                        // Get it...
                        Content = m_Node.Value.ToString();
                    }
                }
                // No node info...
            }
            else
            {
                // Use default...
                StartElm = Prefix + "<POST>";
                EndElm = "</POST>";
            }

            EndOfNode:

            // Little "hack" if it,s the "first level"
            if (Prefix.IsEmpty())
            {
                First = false;
            }

            // Go thrugh the child nodes
            foreach (ktXML N in this)
            {
                // If it's the first
                if (First)
                {
                    // If content isn't empty
                    if (!Content.IsEmpty())
                    {
                        // Add approiate prefixes...
                        Content = Prefix + m_Prefix + Content + "\n"/* + Prefix*/;
                    }
                    // No more first...
                    First = false;
                }

                // Get the childs xml-structure (extended prefix and no XML-decl.)
                Content += N.AsXML(false, Prefix + m_Prefix) + "\n";
            }

            // Remove trialing newlines
            Content.Trim(ktStripType.trailing, "\n");

            // If the "content"/structure contains newlines or elements
            if ((!Content.IsEmpty()) && (Content.Contains("\n") || Content.Contains("<")))
            {
                // Add newline after start-element
                StartElm = StartElm + "\n";

                // hum... Add newline if the content doesn't end with one!?
                if ((!Content.StartsWith("\n")) && (Content.Last() != '\n'))
                {
                    Prefix.Prepend("\n");
                }

                // Add Prefix before end-element and a newline after..
                EndElm = Prefix + EndElm + "\n";
            }

            // Put together start content/childs and end element...
            XML += StartElm + Content + EndElm;

            // Done.. Return the structure
            return XML;// + Get_R();
        }
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:101,代码来源:ktXML.cs

示例3: SetPattern

        // Set the pattern to use
        public bool SetPattern(ktString Pattern)
        {
            RegexOptions Opt = new RegexOptions();

            switch (m_Mode)
            {
                case ktRE_Mode.PERL:
                    {
                        ktString OPattern = new ktString(Pattern);
                        char Delim = Pattern.First();
                        Pattern.RemoveFirst();

                        int Pos = Find(Pattern, @"[^\\]" + Delim.ToString());
                        if (Pos < 0)
                        {
                            throw new ktError("ktRegEx::SetPattern() : The pattern isn't Perl compatible (" + OPattern + ")", ktERR.NOTFOUND);
                        }
                        else
                        {
                            Pos++;
                        }

                        ktString Modifiers = Pattern.SubStr(Pos + 1);
                        Pattern.Remove((uint)Pos);

                        for (uint I = 0; I < Modifiers.Len(); I++)
                        {
                            //						Console.Write( Modifiers[I].ToString() + ";" );
                            switch (Modifiers[I])
                            {
                                case 'i':
                                    {
                                        Opt = Opt | RegexOptions.IgnoreCase;
                                        break;
                                    }
                                case 'm':
                                    {
                                        Opt = Opt | RegexOptions.Multiline;
                                        break;
                                    }
                                case 'x':
                                    {
                                        Opt = Opt | RegexOptions.IgnorePatternWhitespace;
                                        break;
                                    }
                                case 'A':
                                    {
                                        if (Pattern.First() != '^')
                                        {
                                            Pattern.Prepend("^");
                                        }
                                        break;
                                    }/*
                            case 'i': {
                                Opt = Opt | RegexOptions.IgnoreCase;
                                break;
                             }*/
                            }
                        }

                        break;
                    }
                case ktRE_Mode.Plain:
                    {
                        break;
                    }
                default:
                    {
                        throw new ktError("ktRegExp::SetPattern(): The mode '" + GetModeAsString() +
                                "' is not implementet yet!",
                            ktERR.NOTIMP);
                    }
            }

            // Set the pattern
            m_Pattern = Pattern;

            // Take care of the (if any) exception
            try
            {
                // Create the (internal) regex object
                m_P = new Regex(m_Pattern.GetValue(), Opt);
            }
            catch (ktError Ex)
            {
                SetError("Couldn't set pattern and create a new (internal) Regex object" +
                         Ex.Message, ktERR.REGEX_COULDNT_SET_PATTERN);
                return false;
            }
            catch (Exception Ex)
            {
                SetError("Couldn't set pattern and create a new (internal) Regex object" +
                         Ex.Message, ktERR.REGEX_COULDNT_SET_PATTERN);
                return false;
            }

            return true;
        }
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:99,代码来源:ktRegExp.cs


注:本文中的KacTalk.ktString.Prepend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。