Exemplo n.º 1
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();

		}
Exemplo n.º 2
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);
        }