示例#1
0
        void deployBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (currentScript == null)
                {
                    LoadCurrentDoc();
                }

                if (currentScript != null) //may not necessarily be loaded successfully

                {
                    using (var dialog = new DeploymentInput())
                        if (DialogResult.OK == dialog.ShowModal())
                        {
                            EditItem(currentScript);

                            npp.SaveDocuments(GetProjectDocuments());

                            string selectedTargetVersion = dialog.SelectedVersion.Version;
                            string path = CSScriptHelper.Isolate(currentScript, dialog.AsScript, selectedTargetVersion, dialog.AsWindowApp, dialog.AsDll);

                            if (path != null)
                            {
                                if (!CSScriptHelper.IsUsingCSScriptCore)
                                {
                                    string pluginClrVersion = "v" + Environment.Version.ToString();

                                    if (dialog.AsScript && !pluginClrVersion.StartsWith(selectedTargetVersion)) //selectedTargetVersion may not include the build number
                                    {
                                        MessageBox.Show("Distribution package targets CLR version, which is different from the default version.\r\nPlease verify that the script is compatible with the selected CLR version.", "CS-Script");
                                    }
                                }
                                Process.Start("explorer.exe", path);
                            }
                        }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "CS-Script");
            }
        }
示例#2
0
        void deployBtn_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                if (currentScript == null)
                {
                    LoadCurrentDoc();
                }

                if (currentScript != null) //may not necessarily be loaded successfully

                {
                    using (var dialog = new DeploymentInput())
                        if (DialogResult.OK == dialog.ShowModal())
                        {
                            EditItem(currentScript);

                            npp.SaveDocuments(GetProjectDocuments());

                            var result = CSScriptHelper.Isolate(currentScript, dialog.AsScript, dialog.AsWindowApp, dialog.AsDll);
                            if (result != null)
                            {
                                Process.Start("explorer.exe", $"\"{result}\"");
                            }
                        }
                }
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(ex.ToString(), "CS-Script");
            }
            Cursor.Current = Cursors.Default;
        }