Example #1
0
        private void ExportProject(ExportTarget Target)
        {
            ExportProjectSectionOptions spriteSection;
            ExportProjectSectionOptions tileSection;

            using (var exportDialog = new ExportProjectDialog())
            {
                if (exportDialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                spriteSection = exportDialog.SpriteOptions;
                tileSection   = exportDialog.TilesOptions;
            }

            switch (Target)
            {
            case Enums.ExportTarget.Editor:
                string content = GenerateProjectCode(spriteSection, tileSection);
                if (string.IsNullOrWhiteSpace(content))
                {
                    return;
                }
                TextEditor editor = new TextEditor(currentProject.Name, content);
                editor.MdiParent = this;
                editor.Show();
                break;

            case Enums.ExportTarget.Clipboard:
                string contentc = GenerateProjectCode(spriteSection, tileSection);
                if (string.IsNullOrWhiteSpace(contentc))
                {
                    return;
                }
                Clipboard.SetText(contentc);
                MessageBox.Show("Content copied to clipboard");
                break;

            case Enums.ExportTarget.File:

                string contentf = GenerateProjectCode(spriteSection, tileSection);
                if (string.IsNullOrWhiteSpace(contentf))
                {
                    return;
                }
                using (var dlg = new SaveFileDialog {
                    FileName = currentProject.Name + ".zxbas", Filter = "Basic files (.zxbas)|*.zxbas|Basic files (.bas)|*.bas"
                })
                {
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        File.WriteAllText(dlg.FileName, contentf);
                    }
                }

                break;
            }
        }
Example #2
0
        public void ExportToProFile()
        {
            ExportProjectDialog expDlg = new ExportProjectDialog();

            EnvDTE.Solution sln = dteObject.Solution;
            ProSolution prosln = CreateProFileSolution(sln);

            if (prosln.ProFiles.Count <= 0)
            {
                Messages.DisplayWarningMessage(SR.GetString("ExportProject_NoProjectsToExport"));
                return;
            }

            expDlg.ProFileSolution = prosln;
            expDlg.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            MainWinWrapper ww = new MainWinWrapper(dteObject);
            if (expDlg.ShowDialog(ww) == DialogResult.OK)
            {
                WriteProSolution(prosln, expDlg.OpenFiles);

                // create all the project .pro files
                foreach (ProFileContent profile in prosln.ProFiles)
                {
                    if (profile.Export)
                    {
                        Project project = HelperFunctions.VCProjectToProject(profile.Project);
                        string priFile = null;
                        if (expDlg.CreatePriFile)
                            priFile = ExportToPriFile(project);
                        else
                        {
                            ProFileContent priContent = CreatePriFileContent(project, profile.Project.ProjectDirectory);
                            profile.Options.AddRange(priContent.Options);
                        }
                        WriteProFile(profile, profile.Project.ProjectDirectory + profile.Project.Name + ".pro", priFile, expDlg.OpenFiles);
                    }
                }
            }
        }
Example #3
0
        private void ExportCommandExecuted(object obj)
        {
            var w = new ExportProjectDialog(ConnectionParameters);

            w.ShowDialog();
        }