Beispiel #1
0
        private void MenuFileSaveAs_Click(object sender, EventArgs e)
        {
            if (SaveDialog.ShowDialog() != DialogResult.OK) { return; }

            JSONFile jf = new JSONFile(SaveDialog.FileName);
            jf.Save(SaveDialog.FileName, rootObject, this.format);

            settings.LastFilePath = SaveDialog.FileName;
            this.Text = "JSONTools - " + settings.LastFilePath;
        }
Beispiel #2
0
        private void MenuFileSave_Click(object sender, EventArgs e)
        {
            if (rootObject.ChildObjects.Count == 0)
            {
                MessageBox.Show("There is no data to save.  Add some data to the file and then try again.");
                return;
            }
            #region Figure out File Path
            string saveFile = null;
            if (!string.IsNullOrEmpty(SaveDialog.FileName))
            {
                saveFile = SaveDialog.FileName;
            }
            else if (!string.IsNullOrEmpty(FileDialog.FileName))
            {
                saveFile = FileDialog.FileName;
            }
            else
            {
                if (SaveDialog.ShowDialog() != DialogResult.OK) { return; }
                saveFile = SaveDialog.FileName;
            }
            #endregion

            #region Make Backup File
            if (MenuPrefBackup.Checked && File.Exists(saveFile))
            {
                File.Copy(saveFile, saveFile + ".bak", true);
            }
            #endregion

            JSONFile jf = new JSONFile(saveFile);
            jf.Save(saveFile, rootObject, this.format);

            settings.LastFilePath = saveFile;
            this.Text = "JSONTools - " + settings.LastFilePath;
            hasChanged = false;
        }
Beispiel #3
0
        private void LoadFile(string FileName)
        {
            JSONFile file = new JSONFile(FileName);
            rootObject = file.Open();
            rootObject.NodeMenu = this.NodeMenu;
            rootObject.BuildTree(Tree);
            CurrentObject = rootObject;
            UpdateTabs();

            settings.LastFilePath = FileDialog.FileName;
            this.Text = "JSONTools - " + settings.LastFilePath;
            hasChanged = false;
        }