Menu

[r1]: / Basic-Debugger / ProjectDialog.cs  Maximize  Restore  History

Download this file

84 lines (73 with data), 2.9 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;
using System.Xml;
using Microsoft.Win32;
namespace Basic_Debugger
{
public partial class ProjectDialog : Form
{
public ProjectDialog(MainForm m)
{
InitializeComponent();
_m = m;
_location.Text = _m.defaultFolder;
}
MainForm _m;
public bool Finished = false;
private void _changeLocation_Click(object sender, EventArgs e)
{
_folder.ShowNewFolderButton = true;
_folder.RootFolder = Environment.SpecialFolder.MyDocuments;
_folder.Description = "Select the root for the project folder";
_folder.ShowDialog();
_location.Text = _folder.SelectedPath;
}
private void _save_Click(object sender, EventArgs e)
{
if (!Directory.Exists(_location.Text + "\\" + _name.Text))
{
Directory.CreateDirectory(_location.Text + "\\" + _name.Text);
DirectoryInfo d = new DirectoryInfo(_location.Text + "\\" + _name.Text);
Directory.CreateDirectory(d.FullName + "\\bin");
StreamWriter writer = new StreamWriter(d.FullName + "\\" + _name.Text + ".bat");
writer.Write("PRINT \"Hello World!\"");
writer.Flush();
writer.Close();
XmlTextWriter w = new XmlTextWriter(d.FullName + "\\" + _name.Text + ".qproj", Encoding.Unicode);
w.Formatting = Formatting.Indented;
w.Indentation = 5;
w.WriteStartElement("Project");
w.WriteStartElement("Name");
w.WriteString(_name.Text);
w.WriteEndElement();
w.WriteStartElement("Subs");
w.WriteEndElement();
w.WriteStartElement("Files");
w.WriteEndElement();
w.WriteEndElement();
w.Flush();
w.Close();
_m._project.Location = d.FullName;
_m._project.Name = _name.Text;
Finished = true;
RegistryKey r = Registry.CurrentUser.OpenSubKey("Software", true).CreateSubKey("QBasic.Net");
string[] s = r.GetValueNames();
int l = 0, t = 0;
for (int I = 0; I < s.Length; I++)
{
if (int.TryParse(s[I].Replace("RecentProject", ""), out t))
l++;
}
this.Close();
}
else
MessageBox.Show("Project already exists, please change the name or open a preexisting project.");
}
}
}
MongoDB Logo MongoDB