Exemplo n.º 1
0
        public void ToggleBreakPoint(int line)
        {
            if (line >= 0 && line < this.Document.TotalNumberOfLines)
            {
                ICSharpCode.TextEditor.Document.LineSegment lineseg = this.Document.GetLineSegment(line);
                // walk through the line and make sure the first word is not a comment
                bool okToAdd = false;
                for (int i = 0; i < lineseg.Words.Count; i++)
                {
                    if (lineseg.Words[i].Type == ICSharpCode.TextEditor.Document.TextWordType.Word)
                    {
                        if (lineseg.Words[i].Color != System.Drawing.Color.Green)
                        {
                            okToAdd = true;
                        }
                        break;
                    }
                }
                if (!okToAdd)
                {
                    return;
                }

                ICSharpCode.TextEditor.Document.Bookmark existing_mark = null;
                foreach (ICSharpCode.TextEditor.Document.Bookmark mark in this.Document.BookmarkManager.Marks)
                {
                    if (mark.LineNumber == line)
                    {
                        existing_mark = mark;
                        break;
                    }
                }

                if (existing_mark != null)
                {
                    this.Document.BookmarkManager.RemoveMark(existing_mark);
                }
                else
                {
                    ICSharpCode.TextEditor.Document.Bookmark breakpoint = new BreakPoint(this.Document, new ICSharpCode.TextEditor.TextLocation(0, line));
                    this.Document.BookmarkManager.AddMark(breakpoint);
                }

                RepaintBookmarks();
            }
        }
 public BookmarkEventArgs(ICSharpCode.TextEditor.Document.Bookmark bookmark)
 {
     this.bookmark = bookmark;
 }
 public static bool AcceptAllBookmarks(ICSharpCode.TextEditor.Document.Bookmark mark)
 {
     return(true);
 }
Exemplo n.º 4
0
        private void GridChangedFiles_SelectionChanged(object sender, EventArgs e)
        {
            if (GridChangedFiles.SelectedRows.Count == 0) return;

            Patch patch = (Patch)GridChangedFiles.SelectedRows[0].DataBoundItem;
            CurrentPatch = patch;

            if (patch == null) return;

            ChangesList.Text = "";
            FileToPatchEdit.Text = "";
            PatchedFileEdit.Text = "";

            try
            {
                PatchedFileEdit.Text = patch.FileTextB;

                string syntax = "XML";
                if (patch.FileNameB.LastIndexOf('.') > 0)
                {
                    string extension = patch.FileNameB.Substring(patch.FileNameB.LastIndexOf('.') + 1).ToUpper();

                    switch (extension)
                    {
                        case "BAS":
                        case "VBS":
                        case "VB":
                            syntax = "VBNET";
                            break;
                        case "CS":
                            syntax = "C#";
                            break;
                        case "CMD":
                        case "BAT":
                            syntax = "BAT";
                            break;
                        case "C":
                        case "RC":
                        case "IDL":
                        case "H":
                        case "CPP":
                            syntax = "C#";
                            break;
                        default:
                            break;
                    }
                }
                PatchedFileEdit.SetHighlighting(syntax);
                PatchedFileEdit.IsIconBarVisible = true;

                PatchedFileEdit.Document.BookmarkManager.Clear();
                foreach (int n in patch.BookMarks)
                {
                    ICSharpCode.TextEditor.Document.Bookmark b = new ICSharpCode.TextEditor.Document.Bookmark(PatchedFileEdit.Document, new ICSharpCode.TextEditor.TextLocation(0, n));
                    PatchedFileEdit.Document.BookmarkManager.AddMark(b);
                }
                PatchedFileEdit.Refresh();

                FileToPatchEdit.SetHighlighting(syntax);
                FileToPatchEdit.LoadFile(patchManager.DirToPatch + patch.FileNameA, true, true);
                FileToPatchEdit.SetHighlighting(syntax);
                FileToPatchEdit.Refresh();
                FileToPatchEdit.IsReadOnly = true;
            }
            catch
            {
                FileToPatchEdit.Text = "";
                FileToPatchEdit.Refresh();
            }
            ChangesList.Text = patch.Text;
            //PatchedFileEdit.Text = changedFile.New;
        }