示例#1
0
        //------------------------------------------------------------
        private void SetResults(List <CTag> Results)
        {
            txtResults_C.Clear();
            txtResults_H.Clear();
            txtResults_IDL.Clear();
            txtResults_Unknown.Clear();

            int Count = Results.Count;

            if (Count > 0)
            {
                CTag Tag_File = Results[0];
                CTag Tag_Line = Results[0];
                for (int idx = 0; idx < Count; idx++)
                {
                    CTag tag = Results[idx];
                    if (tag.File.Length > Tag_File.File.Length)
                    {
                        Tag_File = tag;
                    }
                    if (tag.Line > Tag_Line.Line)
                    {
                        Tag_Line = tag;
                    }

                    String Line = HidePrefix(tag.File) + "\t" + tag.Line.ToString() + "\t" + tag.Name + "\n";
                    switch (Path.GetExtension(tag.File))
                    {
                    case ".c":
                    case ".cpp":
                        txtResults_C.AppendText(Line);
                        break;

                    case ".h":
                    case ".hpp":
                        txtResults_H.AppendText(Line);
                        break;

                    case ".idl":
                        txtResults_IDL.AppendText(Line);
                        break;

                    default:
                        txtResults_Unknown.AppendText(Line);
                        break;
                    }
                }

                Size Size_File = TextRenderer.MeasureText(HidePrefix(Tag_File.File), txtResults_C.Font);
                Size Size_Line = TextRenderer.MeasureText(Tag_Line.Line.ToString(), txtResults_C.Font);
                _TabStops        = new int[] { Size_File.Width + 10, Size_Line.Width + 10 };
                Status_Text.Text = "Locations found: " + Count.ToString();
            }
            else
            {
                _TabStops        = null;
                Status_Text.Text = "No matches found!";
            }
            SetAllPages(tabResults);
        }
示例#2
0
 //************************************************************
 public void LoadFile(string FileName)
 {
     if (File.Exists(FileName))
     {
         using (StreamReader fs = File.OpenText(FileName))
         {
             while (fs.Peek() >= 0)
             {
                 CTag tag = new CTag(fs.ReadLine());
                 if (!tag.IsComment)
                 {
                     _Tags.Add(tag);
                     if (_Prefix == null)
                     {
                         _Prefix = tag.File;
                     }
                     else
                     {
                         if (!tag.File.StartsWith(_Prefix))
                         {
                             string Path = tag.File;
                             int    idx  = 0;
                             int    len  = Path.Length;
                             if (len < _Prefix.Length)
                             {
                                 len = _Prefix.Length;
                             }
                             while (idx < len)
                             {
                                 if (_Prefix[idx] != Path[idx])
                                 {
                                     break;
                                 }
                                 idx++;
                             }
                             _Prefix = _Prefix.Substring(0, idx);
                         }
                     }
                 }
             }
             fs.Close();
         }
     }
 }