Пример #1
0
        private void AddReferenceItem(Project Project, Types.ASM.FileInfo ASMInfo, int GlobalLineIndex)
        {
            var item = new ListViewItem(GlobalLineIndex.ToString());

            item.SubItems.Add("");
            item.SubItems.Add("");

            if (ASMInfo.FindTrueLineSource(GlobalLineIndex, out string filename, out int localLineIndex, out Types.ASM.SourceInfo SourceInfo))
            {
                item.SubItems[0].Text = (localLineIndex + 1).ToString();
                item.SubItems[1].Text = filename;

                if (Project != null)
                {
                    var element = Project.GetElementByFilename(filename);
                    if (element != null)
                    {
                        if (element.DocumentInfo != null)
                        {
                            item.Tag = element.DocumentInfo;
                        }

                        if (element.Document != null)
                        {
                            if ((localLineIndex >= 0) &&
                                (localLineIndex < element.Document.SourceControl.LinesCount))
                            {
                                item.SubItems[2].Text = element.Document.SourceControl.GetLine(localLineIndex).Text;
                            }
                        }
                        else
                        {
                            // fetch line from file
                            string textFromElement = Core.Searching.GetDocumentInfoText(element.DocumentInfo);

                            string line = FindLineInsideText(textFromElement, localLineIndex);

                            item.SubItems[2].Text = line;
                        }
                    }
                }
                else
                {
                    var doc = Core.Navigating.FindDocumentInfoByPath(filename);
                    if (doc != null)
                    {
                        item.Tag = doc;
                    }
                    if ((doc != null) &&
                        (doc.BaseDoc != null))
                    {
                        if ((localLineIndex >= 0) &&
                            (localLineIndex < doc.BaseDoc.SourceControl.LinesCount))
                        {
                            item.SubItems[2].Text = doc.BaseDoc.SourceControl.GetLine(localLineIndex).Text;
                        }
                    }
                }
            }
            listResults.Items.Add(item);
        }