Esempio n. 1
0
        static public List <NewFolding> GetFoldingRanges(TextDocument document, List <NewFolding> list)
        {
            Stack <Match> stack = new Stack <Match>();

            foreach (Match m in PragmaRegion.Matches(document.Text))
            {
                if (m.Groups[1].Value == "#region")
                {
                    TextRange range = TextRange.FromMatch(m);

                    int len = m.Groups[1].Index - m.Groups[0].Index;

                    stack.Push(m);
                }
                else
                {
                    TextRange range = TextRange.FromMatch(m);
                    Match     peeek = stack.Peek();
                    TextRange peek  = TextRange.FromMatch(peeek);

                    int len = peeek.Groups[1].Index - peeek.Groups[0].Index;

                    XLog.WriteG("Position: ", "{0}", peek.Position);

                    peek.ShrinkRight(len);

                    NewFolding nf = new NewFolding((int)peek.Position, (int)range.EndPosition);

                    nf.DefaultClosed = true;

                    if (peeek.Groups[2].Value == string.Empty)
                    {
                        nf.Name = "‘…’";
                    }
                    else
                    {
                        nf.Name = string.Format("Pragma Region “{0}”", peeek.Groups[2].Value.Trim());
                    }
                    //					Global.statG();
                    XLog.WriteC("folding", "{0}, {1}", nf.StartOffset, nf.EndOffset);
                    if (document.GetLineByOffset(nf.StartOffset) == document.GetLineByOffset(nf.EndOffset))
                    {
                        continue;
                    }
                    else
                    {
                        list.Add(nf);
                    }
                    stack.Pop();
                }
            }
            list.Sort(SortRange);
            //			if (list.Count >0) list.Remove(list[list.Count-1]);
            return(list);
        }
Esempio n. 2
0
 // SO ITSANEXAMPLE;_
 //http://webdesign.about.com/od/localization/l/blhtmlcodes-ascii.htm
 public CharacterEntityConversions()
 {
     this.Add("…", "&#133;");
     this.Add("‘", "&#145;");
     this.Add("’", "&#146;");
     this.Add("“", "&#147;");
     this.Add("”", "&#148;");
     this.Add("–", "&#150;");
     this.Add("—", "&#151;");
     this.Add("«", "&#171;");
     this.Add("¬", "&#172;");
     this.Add("®", "&#174;");
     this.Add("¯", "&#175;");
     this.Add("°", "&#176;");
     this.Add("±", "&#177;");
     XLog.WriteC("entities loaded\n", "");
     //		ConversionChars.Add("","&#;");
 }