コード例 #1
0
        private void SearchForSubtask()
        {
            int  i     = 0;
            bool found = false;

            foreach (char c in Editor_TextBox.Text)
            {
                if (c == ':')
                {
                    string subtaskNum = JSON_Reader.GetSubtaskNum(i, Editor_TextBox.Text);
                    if (subtaskNum.Replace(" ", "").Replace(",", "") == Find_TextBox.Text.Replace(" ", "").Replace(",", ""))
                    {
                        found = true;

                        int startHighlighht = Editor_TextBox.Text.LastIndexOf("\"", i - 2);
                        Editor_TextBox.SelectionStart = i;
                        Editor_TextBox.Select(i, -(i - startHighlighht));
                        Editor_TextBox.ScrollToCaret();
                        HideFindButton();
                        searchSubtask = false;
                        break;
                    }
                }
                i++;
            }
            if (!found)
            {
                ConsoleHandler.append_Force_CanRepeat("That subtask was not found");
            }
        }
コード例 #2
0
        private void LintPanel_MouseClick(object sender, MouseEventArgs e)
        {
            if (jsonError)
            {
                try
                {
                    string error = JSON_Reader.GetJSON_Error(Editor_TextBox.Text);
                    ConsoleHandler.force_append_Notice(error);
                    //Line number
                    string[] split      = error.Split(',');
                    string[] line       = split[split.Length - 2].Split(' ');
                    int      lineNumber = Int32.Parse(line[line.Length - 1].Replace(".", "").Replace(",", ""));

                    //Position in line
                    string[] pos     = split[split.Length - 1].Split(' ');
                    int      linePos = Int32.Parse(pos[pos.Length - 1].Replace(".", "").Replace(",", ""));

                    //Scroll to the line above error
                    int index = Editor_TextBox.GetFirstCharIndexFromLine(lineNumber - 3) + linePos;
                    Editor_TextBox.Select(index, 1);
                    Editor_TextBox.ScrollToCaret();

                    int numChars = (Editor_TextBox.GetFirstCharIndexFromLine(lineNumber - 1)) - (Editor_TextBox.GetFirstCharIndexFromLine(lineNumber - 2));

                    //highlight line with error
                    index = Editor_TextBox.GetFirstCharIndexFromLine(lineNumber - 2) + linePos;
                    Editor_TextBox.Focus();
                    Editor_TextBox.Select(index, numChars - 2);
                }
                catch
                {
                    ConsoleHandler.append_CanRepeat("Something went wrong... Unable to find the bad json");
                }
            }
        }
コード例 #3
0
        private void EditorLoading(object sender, EventArgs e)
        {
            tB_line.Font = Editor_TextBox.Font;
            Editor_TextBox.Select();
            AddLineNumbers();

            bool close = false;

            if (close)
            {
                this.Close();
            }
        }
コード例 #4
0
        public JsonEditor_Instance()
        {
            InitializeComponent();
            SetHideEvents();
            Editor_TextBox.Select();
            AddLineNumbers();

            Find_Button.KeyDown                += Find_TB_KeyDown;
            Replace_TB.KeyDown                 += Find_TB_KeyDown;
            SearchOptions_Panel.KeyDown        += Find_TB_KeyDown;
            SearchOptions_Button.KeyDown       += Find_TB_KeyDown;
            Editor_TextBox.MouseUp             += Editor_TextBox_RightClicked;
            Weapons_Button.DropDownItemClicked += Weapons_Button_Click;
            //path and filename have NOT been set yet. Use FinishedLoading()
        }
コード例 #5
0
 private void TB_line_MouseDown(object sender, MouseEventArgs e)
 {
     Editor_TextBox.Select();
     tB_line.DeselectAll();
 }
コード例 #6
0
 private void Editor_TextBox_FontChanged(object sender, EventArgs e)
 {
     tB_line.Font = Editor_TextBox.Font;
     Editor_TextBox.Select();
     AddLineNumbers();
 }