Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(nameTextBox.Text))
            {
                GeneralUtil.Error("You must give your VDF a name");
                return;
            }

            if (String.IsNullOrEmpty(pathTextBox.Text))
            {
                GeneralUtil.Error("You must give a save path for the VDF");
                return;
            }

            if (!Directory.Exists(Path.GetDirectoryName(pathTextBox.Text)))
            {
                GeneralUtil.Error("The directory where you'd like to save the VDF doesn't exist");
                return;
            }

            VDF vdf = new VDF(nameTextBox.Text);

            vdf.Save(pathTextBox.Text);

            Editor editor = new Editor(menuForm, recent);

            editor.OpenVDF(vdf);
            editor.SetPath(pathTextBox.Text);
            recent.AddItem(pathTextBox.Text);
            recent.Save();
            menuForm.RefreshRecentItems();
            editor.Show();
            closedByUser = false;
            Close();
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Log.LogInfo("Opening VDF file");
            DialogResult result = openDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                Log.LogInfo("Opening: " + openDialog.FileName);

                if (!File.Exists(openDialog.FileName))
                {
                    GeneralUtil.Error("File not found.");
                    return;
                }

                Editor editor = new Editor(this, recentItems);
                editor.OpenVDF(openDialog.FileName);
                recentItems.AddItem(openDialog.FileName);
                recentItems.Save();
                RefreshRecentItems();
                editor.Show();
                Hide();
            }
            else
            {
                Log.LogInfo("VDF Opening cancelled");
            }
        }
Example #3
0
        private void openSelectedButton_Click(object sender, EventArgs e)
        {
            if (!File.Exists((string)listBox1.SelectedItem))
            {
                GeneralUtil.Error("File not found.");
                return;
            }

            Editor editor = new Editor(this, recentItems);

            editor.OpenVDF((string)listBox1.SelectedItem);
            recentItems.AddItem((string)listBox1.SelectedItem);
            recentItems.Save();
            RefreshRecentItems();
            editor.Show();
            Hide();
        }
Example #4
0
        private void addCatagoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string catagoryName = "Catagory";

            ShowInputDialog(ref catagoryName, "Catagory name");

            if (string.IsNullOrEmpty(catagoryName))
            {
                GeneralUtil.Error("The catagory name must not be empty.");
                return;
            }

            VDFCatagory catagory = new VDFCatagory(catagoryName);

            vdf.AddCatagory(catagory);

            LoadVDF();
        }