예제 #1
0
        public JsonEditor(string Path)
        {
            InitializeComponent();
            Serializer.SaveSettings();
            StartUp();

            initSelContextMenu();
            initHighlightContextMenu();
            this.Path               = Path;
            this.FormClosing       += exitHandling;
            Editor_TextBox.MouseUp += Editor_TextBox_RightClicked;

            FileInfo info = new FileInfo(Path);

            this.Text = info.Name;
            this.Find_TextBox.Visible        = false;
            this.FindNext_Button.Visible     = false;
            this.toolStripSeparator2.Visible = false;
            this.Replace_TextBox.Visible     = false;
            this.ReplaceDropDown.Visible     = false;


            //tabstops
            this.tB_line.TabStop         = false;
            this.lintPanel.TabStop       = false;
            this.Find_TextBox.AcceptsTab = false;
            this.Editor_TextBox.TabStop  = false;
            string formattedText = "";

            string unformattedText = File.ReadAllText(Path);

            try
            {
                JToken jt = JToken.Parse(unformattedText);
                formattedText       = jt.ToString(Formatting.Indented);
                Editor_TextBox.Text = formattedText;
            }
            catch (Exception)
            {
                Editor_TextBox.Text = unformattedText;
            }
            CheckJSON(this.Editor_TextBox.Text);

            this.FontSize_TextBox.TextChanged += new System.EventHandler(this.FontSize_TextBox_TextChanged);

            JsonProps.increment(this);
            this.Load += EditorLoading;

            HandleTools();
        }
예제 #2
0
 private void exitHandling(object sender, EventArgs e)
 {
     Serializer.SaveSettings();
     JsonProps.decrement(this);
 }