示例#1
0
            public virtual void Remove(Breakpoint entry)
            {
                if (g.IsDebugging)
                {
                    // Tell the program that we're clearing a breakpoint
                    g.LogDebug("CPROJECT::BreakpointCollection::Remove: Clear breakpoint from debugger");
                    string filerelpath = CProject.Breakpoint.FixPath(CProject.PathGetRelative(Path.GetFullPath(entry.file.RelativePath), Path.GetDirectoryName(Path.GetFullPath(g.Project.DebugExe))));
                    frmMain.stc_DebugQueue.Add("BRKCLR " + filerelpath + " " + Convert.ToString(entry.LineNumber + 1) + "\n");
                }

                this.List.Remove(entry);
            }
示例#2
0
        public frmCondBreak(CProject.Breakpoint breakpt)
        {
            this.breakpt = breakpt;

            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
示例#3
0
        public frmMassImport(CProject.Directory parent_dir)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.parent_dir = parent_dir;

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
示例#4
0
		private void cmdOK_Click(object sender, System.EventArgs e) {
			if (lvTemplates.SelectedItems.Count == 0) {
				MessageBox.Show(this, "Please select a project type.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				return;
			}

			// Verify the project type is licensed
			//if (lvTemplates.SelectedItems[0].Tag.ToString() == "0" && g.Config.ActivationHasTGE == false) {
			//	MessageBox.Show(this, "Error: You are not licensed to create TGE projects.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			//	return;
			//} else if (lvTemplates.SelectedItems[0].Tag.ToString() == "1" && g.Config.ActivationHasTSE == false) {
			//	MessageBox.Show(this, "Error: You are not licensed to create TSE projects.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			//	return;
			if (lvTemplates.SelectedItems[0].Tag.ToString() == "2" && g.Config.ActivationHasT2D == false) {
				MessageBox.Show(this, "Error: You are not licensed to create T2D projects.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				return;
			}

			if (txtProjectName.Text.Trim() == "" || txtProjectPath.Text.Trim() == "") {
				MessageBox.Show(this, "Please enter a project name and a root path.", "TSDev", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				return;
			}
			
			if (!Directory.Exists(Path.GetDirectoryName(txtProjectPath.Text))) {
				MessageBox.Show(this, "Project root path folder does not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				return;
			}

			if (this.chkAutoImport.Checked == true && this.txtFilter.Text.Trim() == "") {
				MessageBox.Show(this, "Please specify a valid file filter.", "TSDev", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				return;
			}

			g.Main.CreateProject(txtProjectName.Text.Trim(), Path.GetDirectoryName(txtProjectPath.Text.Trim()), Convert.ToInt16(lvTemplates.SelectedItems[0].Tag));

			if (this.chkAutoImport.Checked) {
				ImportDirectory(Path.GetDirectoryName(txtProjectPath.Text), null);
				g.Main.InitProject();
			}

			CProject.SaveProject(this.txtProjectPath.Text, g.Project);

			g.Config.LastProjectRoot = Path.GetDirectoryName(txtProjectPath.Text);

			this.Close();

		}
示例#5
0
        public static void CreateProject(CWProject project, string saveto)
        {
            CProject newproject = new CProject();

            newproject.DebugAutoInsert = project.debugger_oneclick_enabled;
            newproject.DebugMainCs     = project.debugger_oneclick_maincs;
            newproject.DebugEnabled    = project.debugger_enabled;
            newproject.DebugExe        = project.debugger_exe;
            newproject.DebugParams     = project.debugger_params;
            newproject.DebugPasswd     = project.debugger_passwd;
            newproject.DebugPort       = project.debugger_port;
            newproject.ProjectName     = project.name;
            newproject.ProjectPath     = project.path;
            newproject.ProjectType     = (short)project.type;

            // Save the project
            CProject.SaveProject(saveto, newproject);
        }
示例#6
0
            public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
            {
                OpenFileDialog ofd = new OpenFileDialog();

                ofd.Title           = "Select Script File";
                ofd.Filter          = "TorqueScript Files (*.cs)|*.cs";
                ofd.CheckFileExists = true;
                DialogResult result = ofd.ShowDialog();

                if (result == DialogResult.Cancel)
                {
                    return(value);
                }
                else
                {
                    return(CProject.PathGetRelative(ofd.FileName, g.Project.ProjectPath));
                }
            }
示例#7
0
            public virtual void Add(Breakpoint entry)
            {
                // Check if the breakpoint already exists and remove it
                if (HasBreakpointAt(entry.file, entry.LineNumber))
                {
                    RemoveAtLine(entry.file, entry.LineNumber);
                }

                if (g.IsDebugging)
                {
                    // Tell the debugger we're adding a breakpoint
                    g.LogDebug("CPROJECT::BreakpointCollection::Add: Send breakpoint to debugger");
                    string filerelpath = CProject.Breakpoint.FixPath(CProject.PathGetRelative(Path.GetFullPath(entry.file.RelativePath), Path.GetDirectoryName(Path.GetFullPath(g.Project.DebugExe))));
                    frmMain.stc_DebugQueue.Add("BRKSET " + filerelpath + " " + Convert.ToString(entry.LineNumber + 1) + " false " + entry.PassCount.ToString() + " " + entry.Conditional + "\n");
                }

                this.List.Add(entry);
            }
示例#8
0
        public int FindToken(string word, string prevtok, out CProject.File out_file)
        {
            out_file = null;

            // Find it in the file listing first
            foreach(CProject.File file in g.Project.FileList) {
                if (file.TokenList.ContainsKey(word.ToLower())) {
                    // Got it!
                    out_file = file;
                    return ((CProject.TokenKey)file.TokenList[word.ToLower()]).LineNumber;
                }
            }

            // Now search active objects, seeing if this is an object
            // we can jump to.
            if (g.Project.TokenObjList.ContainsKey(word.ToLower())) {
                // Yes, it appears this is a valid object...
                CProject.TokenObject tokobj = (CProject.TokenObject)g.Project.TokenObjList[word.ToLower()];
                if (tokobj.ObjectFileDecl != null) {
                    out_file = tokobj.ObjectFileDecl;
                    return tokobj.ObjectDeclOffset;
                } else {
                    return -1;
                }
            }

            // Check to see if the *previous* token wasn't an object...
            // ... which would mean that the *current* token is a function
            // definition inside an object
            if (g.Project.TokenObjList.ContainsKey(prevtok.ToLower())) {
                // Yes, it appears this is so... see if the thingy is a valid function
                CProject.TokenObject tokobj = (CProject.TokenObject)g.Project.TokenObjList[prevtok.ToLower()];

                if (!tokobj.ObjectFunctions.ContainsKey(word.ToLower()))
                    return -1;

                // Retrieve the function file information
                CProject.TokenObject.ObjectDescr func = (CProject.TokenObject.ObjectDescr)tokobj.ObjectFunctions[word.ToLower()];
                out_file = func.FuncFile;
                return func.FuncOffset;
            }

            return -1;
        }
示例#9
0
        public frmProperties(CProject proj, CProject.File file, int proptype)
        {
            //
            // Required for Windows Form Designer support
            //

            if (proptype == 0)
                this.file = file;
            else
                this.proj = proj;

            this.proptype = proptype;

            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
示例#10
0
        public static void SaveProject(string filename, CProject project)
        {
            g.LogDebug("CPROJECT::SaveProject: Enter");

            try {
                g.LogDebug("CPROJECT::SaveProject: Saving to " + filename);
                FileStream      fstream   = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None);
                BinaryFormatter fmtBinary = new BinaryFormatter();

                g.LogDebug("CPROJECT::SaveProject: Serializing");
                fmtBinary.Serialize(fstream, project);

                g.LogDebug("CPROJECT::SaveProject: Closing");
                fstream.Close();
            } catch (Exception exc) {
                g.LogDebug("CPROJECT::SaveProject: Failed: " + exc.Message);
                MessageBox.Show("An error occurred while attempting to save your project:\n\n" + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
示例#11
0
        public frmProperties(CProject proj, CProject.File file, int proptype)
        {
            //
            // Required for Windows Form Designer support
            //


            if (proptype == 0)
            {
                this.file = file;
            }
            else
            {
                this.proj = proj;
            }

            this.proptype = proptype;

            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
示例#12
0
        public bool CommitSave(CProject.File file)
        {
            Directory.SetCurrentDirectory(g.Project.ProjectPath);
            try {
                // Set the isPendingReload flag
                g_curFile.isPendingReload = true;
                txtEditor.Document.SaveFile(file.RelativePath, LineEndStyle.CarriageReturnNewline);
            } catch (Exception exc) {
                MessageBox.Show("An error occurred while attempting to save your file:\n\n" + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                // Reset the pending reload
                g_curFile.isPendingReload = false;
                return false;
            }

            this.isDirty = false;

            // Tokenize file
            CProject.TokenizerQueue tq = new CProject.TokenizerQueue();
            tq.code = txtEditor.Document.Text;
            tq.file = this.g_curFile;

            g.Project._Queue(tq);

            DropdownMake();
            DropdownSelectCurrent();

            // PLUGINS
            foreach (CWPlugin plugin in g.Plugins) {
                try {
                    plugin.Plugin.CWFileAfterSave(g_curFile.ToCWFile());
                } catch (Exception exc) {
                    g.PluginException(exc, plugin);
                }
            }

            return true;
        }
示例#13
0
        public UCEditor(CProject.File file, bool isSaved)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.g_curFile = file;
            this.isSaved = isSaved;

            if (!file.isText) {
                this._DropDownMake = new _dDropdownMake(DropdownMake);
                g.Config.LoadColorData(txtEditor);
            } else {
                // Disable completion for text files
                bDisableAllCompletion = true;
                bDisableAdvancedCompletion = true;
                cboCurFileFuncs.Visible = false;
            }

            // If we're a foreign file, disable "advanced" completion,
            // (so basically, anything not engine-function)
            if (file.isForeign) {
                bDisableAdvancedCompletion = true;
                cboCurFileFuncs.Visible = false;
            }

            //this.Owner = g.Main;

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
示例#14
0
            public void RemoveFileRefs(CProject.File file)
            {
                Monitor.Enter(ObjectFunctions);
                Monitor.Enter(ObjectProperties);

                Hashtable _temp_ht = (Hashtable)ObjectFunctions.Clone();

                IDictionaryEnumerator enumer = _temp_ht.GetEnumerator();

                while(enumer.MoveNext()) {
                    if (((ObjectDescr)enumer.Value).FuncFile.Equals(file))
                        ObjectFunctions.Remove(enumer.Key);
                }

                if ((ObjectFileDecl != null) && ObjectFileDecl.Equals(file)) {
                    ObjectFileDecl = null;
                    ObjectDeclOffset = -1;
                }

                Monitor.Exit(ObjectFunctions);
                Monitor.Exit(ObjectProperties);
            }
示例#15
0
        private void ImportDirectory(string dir, CProject.Directory parent_dir)
        {
            string [] subdirs = Directory.GetDirectories(dir, "*");

            foreach(string file_entry in this.txtExts.Text.ToLower().Replace(" ", "").Split(';')) {
                foreach(string file in Directory.GetFiles(dir, file_entry)) {
                    if ((File.GetAttributes(file) & FileAttributes.Hidden) == FileAttributes.Hidden)
                        continue;

                    g.Main.AddExistingFile(file, parent_dir);
                }
            }

            foreach(string subdir in subdirs) {
                DirectoryInfo di = new DirectoryInfo(subdir);

                if ((di.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                    continue;

                string[] dir_name = subdir.Split('\\');
                CProject.Directory d_subdir = new CProject.Directory(dir_name[dir_name.Length - 1], parent_dir, false);
                g.Project.DirList.Add(d_subdir);

                ImportDirectory(subdir, d_subdir);
            }
        }
示例#16
0
        public void RemoveObjectsInFile(CProject.File file)
        {
            g.LogDebug("CPROJECT::RemoveObjectsInFile: Enter - " + file.RelativePath);

            foreach(CProject.TokenObject tokobj in this.TokenObjList.Values)
                tokobj.RemoveFileRefs(file);
        }
示例#17
0
 public bool HasBreakpointAt(CProject.File file, int LineNum)
 {
     return HasIdentical(new CProject.Breakpoint(file, LineNum));
 }
示例#18
0
            public Breakpoint this[CProject.File file, int LineNum]
            {
                get {
                    foreach(Breakpoint brk in this.List) {
                        if (brk.file == file && brk.LineNumber == LineNum)
                            return brk;
                    }

                    return null;
                }
            }
示例#19
0
 public Breakpoint(CProject.File file, int LineNumber, int PassCount, string Conditional)
 {
     this.file = file;
     this.LineNumber = LineNumber;
     this.Enabled = true;
     this.PassCount = PassCount;
     this.Conditional = Conditional;
 }
示例#20
0
 public Breakpoint(CProject.File file, int LineNumber, int PassCount)
 {
     this.file = file;
     this.LineNumber = LineNumber;
     this.Enabled = true;
     this.PassCount = PassCount;
 }
示例#21
0
 public Breakpoint(CProject.File file, int LineNumber)
 {
     this.file = file;
     this.LineNumber = LineNumber;
     this.Enabled = true;
 }
示例#22
0
 public void _Queue(CProject.TokenizerQueue tq)
 {
     g.LogDebug("CPROJECT::_Queue: Enqueing " + tq.file.RelativePath);
     this.__tokenizer_queue.Add(tq);
 }
示例#23
0
 public void RemoveAtLine(CProject.File file, int LineNum)
 {
     foreach(Breakpoint brk in this.List) {
         if (brk.file == file && brk.LineNumber == LineNum) {
             Remove(brk);
             return;
         }
     }
 }
示例#24
0
        public static void SaveProject(string filename, CProject project)
        {
            g.LogDebug("CPROJECT::SaveProject: Enter");

            try {
                g.LogDebug("CPROJECT::SaveProject: Saving to " + filename);
                FileStream fstream = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None);
                BinaryFormatter fmtBinary = new BinaryFormatter();

                g.LogDebug("CPROJECT::SaveProject: Serializing");
                fmtBinary.Serialize(fstream, project);

                g.LogDebug("CPROJECT::SaveProject: Closing");
                fstream.Close();
            } catch (Exception exc) {
                g.LogDebug("CPROJECT::SaveProject: Failed: " + exc.Message);
                MessageBox.Show("An error occurred while attempting to save your project:\n\n" + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
示例#25
0
        private void cmdOK_Click(object sender, EventArgs e)
        {
            // If we have a filename and a template selected, we're gold
            if (txtSaveTo.Text.Trim() == "")
            {
                MessageBox.Show("Please select a filename to save your file as.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            else if (lvTemplates.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select a template to create the new file from", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            // Construct a relative path
            string fileRelativePath = CProject.PathGetRelative(txtSaveTo.Text, g.Project.ProjectPath);

            if (fileRelativePath == "")
            {
                fileRelativePath = txtSaveTo.Text;
            }

            // Check if the file already exists in the project
            if (g.Project.FileList.ContainsFile(fileRelativePath))
            {
                // If it's open, close it
                g.Main.CloseFile(g.Project.FileList.GetFile(fileRelativePath), false, false);

                // Remove it from the file list
                g.Project.FileList.Remove(g.Project.FileList.GetFile(fileRelativePath));
            }

            // Open the template file
            StreamReader templateFile = new StreamReader(lvTemplates.SelectedItems[0].Tag.ToString().Split('|')[1]);

            // Chop off the first line by doing some backasswards string manipulation
            string template = templateFile.ReadToEnd().Split(new string[] { "\r\n" }, 2, StringSplitOptions.None)[1];

            templateFile.Close();

            // Write the template
            template = template.Replace("{{PROJECT_NAME}}", g.Project.ProjectName);
            template = template.Replace("{{FILE_RELATIVE_PATH}}", fileRelativePath);
            template = template.Replace("{{FILE_ABSOLUTE_PATH}}", txtSaveTo.Text);
            template = template.Replace("{{SYSUSER}}", Environment.UserName);
            template = template.Replace("{{SYSMACHINE}}", Environment.MachineName);
            template = template.Replace("{{CW_VERSION}}", Application.ProductVersion);
            template = template.Replace("{{DATE}}", DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToShortTimeString());

            // Create the destination file and write the template
            StreamWriter destinationFile = new StreamWriter(txtSaveTo.Text);

            destinationFile.Write(template);
            destinationFile.Close();

            // Create a file
            CProject.File newFile = new CProject.File(Path.GetFileName(txtSaveTo.Text), fileRelativePath, false, false, _parentDir);
            newFile.isDirty = true;

            // Add to the file list
            g.Project.FileList.Add(newFile);

            // Make the project dirty
            frmMain.stc_bIsProjectDirty = true;

            // Open the file and re-init the left bar
            g.Main.OpenFile(newFile, 0, false);
            g.Main.InitProject();

            this.Close();
        }
示例#26
0
        private static UCEditor GetEditor(CProject.File File)
        {
            if (File == null)
                return null;

            foreach (PrimaryTab<UCEditor> editor in g.Editors) {
                if (editor.Control.g_curFile == File)
                    return editor.Control;
            }

            return null;
        }
示例#27
0
        public static void CreateProject(CWProject project, string saveto)
        {
            CProject newproject = new CProject();
            newproject.DebugAutoInsert = project.debugger_oneclick_enabled;
            newproject.DebugMainCs = project.debugger_oneclick_maincs;
            newproject.DebugEnabled = project.debugger_enabled;
            newproject.DebugExe = project.debugger_exe;
            newproject.DebugParams = project.debugger_params;
            newproject.DebugPasswd = project.debugger_passwd;
            newproject.DebugPort = project.debugger_port;
            newproject.ProjectName = project.name;
            newproject.ProjectPath = project.path;
            newproject.ProjectType = (short)project.type;

            // Save the project
            CProject.SaveProject(saveto, newproject);
        }
示例#28
0
        private Hashtable MakeObjectDeclarations(string code, CProject.File file, Hashtable curlist)
        {
            // Private function for enumerating all object declarations
            // which are declared like "new TypeOfObject(ObjectName) { }" ...
            // Skip objects that don't have a name.

            /*Regex rx = new Regex(@"^\s*\bnew\b\s*(\b[A-Z][A-Z0-9]*\b)\s*\((\b[A-Z_][A-Z0-9_]*\b)\)(\s*\n)?" +
                @"(" +
                @"(?<inner>" +
                @"(?>" +
                @"\{(?<LEVEL>)" +
                @"|" +
                @"\};(?<-LEVEL>)" +
                @"|" +
                @"(?!\{|\};)." +
                @")*" +
                @"(?(LEVEL)(?!))" +
                @"))?"
                , RegexOptions.IgnoreCase | RegexOptions.Multiline);*/

            Regex rx = new Regex(@"^\s*\bnew\b\s*(\b[A-Z][A-Z0-9]*\b)\s*\((\b[A-Z_][A-Z0-9_]*\b)\)(\s*\n)?", RegexOptions.IgnoreCase | RegexOptions.Multiline);

            foreach(Match mt in rx.Matches(code)) {
                // Enumerate each match and try to compare it to an active object

                //System.Windows.Forms.MessageBox.Show(mt.Groups["inner"].Value.ToLower());

                CProject.TokenObject tokobj;
                if (curlist.ContainsKey(mt.Groups[2].Value.ToLower()))
                    tokobj = (CProject.TokenObject)curlist[mt.Groups[2].Value.ToLower()];
                else {
                    tokobj = new CProject.TokenObject();
                    tokobj.ObjectName = mt.Groups[2].Value;
                    tokobj.isInternal = false;
                    curlist.Add(mt.Groups[2].Value.ToLower(), tokobj);
                }

                tokobj.ObjectType = mt.Groups[1].Value;
                tokobj.ObjectFileDecl = file;
                tokobj.ObjectDeclOffset = mt.Groups[2].Index;
            }

            return curlist;
        }
示例#29
0
        public Hashtable MakeObjectListing(string code, CProject.File filedecl, Hashtable ht)
        {
            // Construct listing of objects and their functions
            Regex rx = new Regex(@"(^(\s*///\s*(.*?)\n){0,5})?^\s*\bfunction\b\s*(\b[A-Z_][A-Z0-9_]*\b)::(\b[A-Z][A-Z0-9]*\b)\s*\((.*?)\)", RegexOptions.IgnoreCase | RegexOptions.Multiline);

            //Hashtable ht = new Hashtable();

            foreach(Match mt in rx.Matches(code)) {
                CProject.TokenObject tokobj;
                if (ht.ContainsKey(mt.Groups[4].Value.ToLower()))
                    tokobj = (CProject.TokenObject)ht[mt.Groups[4].Value.ToLower()];
                else {
                    tokobj = new CProject.TokenObject();
                    tokobj.ObjectName = mt.Groups[4].Value;
                    tokobj.isInternal = false;
                    ht.Add(mt.Groups[4].Value.ToLower(), tokobj);
                }

                if (!tokobj.ObjectFunctions.ContainsKey(mt.Groups[5].Value.ToLower())) {
                    // Create a function definition if none exists already
                    CProject.TokenObject.ObjectDescr objdescr = new CProject.TokenObject.ObjectDescr();
                    objdescr.FuncName = mt.Groups[5].Value;
                    objdescr.FuncOffset = mt.Groups[5].Index;
                    objdescr.FuncFile = filedecl;

                    // Set description
                    string descr = mt.Groups[1].Value.Replace("///", "").Replace("\t", "").Replace("\r", "").TrimStart('\n');
                    foreach(string line in descr.Split('\n')) {
                        if (line.Trim() == "")
                            continue;

                        objdescr.FuncDescr += line.Trim() + "<br />";
                    }

                    // Grab all the function parameters by splitting it at the comma
                    // and stick them in the appropriate array
                    if (mt.Groups[4].Value != "")
                        objdescr.FuncParams = mt.Groups[6].Value.Replace(" ", "").Split(',');
                    else
                        objdescr.FuncParams = null;

                    // Add it to the hashtable
                    tokobj.ObjectFunctions.Add(mt.Groups[5].Value.ToLower(), objdescr);
                }
            }

            return MakeObjectDeclarations(code, filedecl, ht);;
        }
示例#30
0
        public frmNewItem(CProject.Directory ParentDirectory)
        {
            InitializeComponent();

            _parentDir = ParentDirectory;
        }
示例#31
0
        public Hashtable MakeObjectListingFromFile(string filename, CProject.File file, Hashtable ht)
        {
            try {
                StreamReader reader = new StreamReader(filename);
                string file_contents = reader.ReadToEnd();

                reader.Close();

                return this.MakeObjectListing(file_contents, file, ht);
            } catch /*(Exception exc)*/ { /*System.Windows.Forms.MessageBox.Show(exc.Message);*/ return ht; };
        }
示例#32
0
        private void cmdNext_Click(object sender, EventArgs e)
        {
            if (step == 1)
            {
                // Going to step 2
                if (optAutoDbg.Checked)
                {
                    // Check to see if the file specified is filled in
                    // and exists
                    if (txtMainCS.Text.Trim() == "")
                    {
                        MessageBox.Show(this, "Please select a valid main.cs file to continue.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    else if (!File.Exists(this.txtMainCS.Text))
                    {
                        MessageBox.Show(this, "The main.cs file you specified does not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                }
                pnlStep1.Visible = false;
                pnlStep2.Visible = true;

                // Set the next text and enable the previous button
                cmdNext.Text        = "&Finish";
                cmdPrevious.Enabled = true;
                step = 2;
            }
            else if (step == 2)
            {
                // Finishing up; Check if the debugger they specified
                // exists
                if (txtDebugExe.Text.Trim() == "" || File.Exists(txtDebugExe.Text) == false)
                {
                    MessageBox.Show(this, "The debugger executable you specified does not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                else if (txtDebugPasswd.Text.Trim() == "")
                {
                    MessageBox.Show(this, "Please fill in a debugger password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                else if (txtDebugPort.Text.Trim() == "")
                {
                    MessageBox.Show(this, "Please fill in a debugger port", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                // Write this info to the project
                if (g.Project != null)
                {
                    g.Project.DebugExe    = CProject.PathGetRelative(txtDebugExe.Text, g.Project.ProjectPath);
                    g.Project.DebugPasswd = txtDebugPasswd.Text;
                    g.Project.DebugPort   = Convert.ToInt32(txtDebugPort.Text);
                    g.Project.DebugParams = txtDebugParams.Text;

                    if (optAutoDbg.Checked)
                    {
                        g.Project.DebugMainCs     = CProject.PathGetRelative(txtMainCS.Text, g.Project.ProjectPath);
                        g.Project.DebugAutoInsert = true;
                    }
                    else
                    {
                        g.Project.DebugMainCs     = "";
                        g.Project.DebugAutoInsert = false;
                    }

                    g.Project.DebugEnabled = true;
                }

                this.Close();
            }
        }