Example #1
0
        private void RunSqlMetal(string filename)
        {
            string sqlMetalArgs;

            if (_useCompactEdition)
            {
                string dbname = _sqlConnectionManager.
                                GetSqlServrCeDbName(_connectionString, true);

                dbname = Path.ChangeExtension(dbname, ".sdf");

                if (!File.Exists(dbname))
                {
                    MessageBox.Show(String.Format("{0}: {1}",
                                                  Resources.DbFileNotFoundMessage,
                                                  dbname),
                                    Resources.DbFileNotFoundTitle,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);

                    return;
                }

                sqlMetalArgs = String.Format("/dbml:\"{0}\" \"{1}\"",
                                             filename, dbname);
            }
            else
            {
                sqlMetalArgs = String.Format("/conn:\"{0}\" /dbml:\"{1}\"",
                                             _connectionString, filename);
            }

            if (_viewsCheckBox.Checked)
            {
                sqlMetalArgs += " /views";
            }
            if (_functionsCheckBox.Checked)
            {
                sqlMetalArgs += " /functions";
            }
            if (_sprocsCheckBox.Checked)
            {
                sqlMetalArgs += " /sprocs";
            }

            RunProcessContext context = new RunProcessContext();

            context.ExePath     = _sqlMetalPath;
            context.ProcessArgs = sqlMetalArgs;
            context.HeaderText  =
                String.Format("{0}: ", Resources.SqlMetalStarted);
            context.FooterText =
                String.Format("{0}: ", Resources.SqlMetalComplete);

            _output.ClearOutputViews();
            _output.Text = Resources.OutputWindowRunSqlMetal;
            _output.RunProcessInternal(context);

            _applicationManager.NotifyFileSystemChange();
        }
Example #2
0
        private bool CompileFile(BuildCommand compileCommand)
        {
            if (_output == null)
            {
                return(false);
            }

            if (compileCommand == null)
            {
                _output.AddLineToOutputView(String.Format(
                                                "------ {0}: {1}",
                                                Resources.BuildErrors,
                                                Resources.ErrorBuildToolInvalid));

                _output.AdjustOutputWidth();
                _mainForm.SetStatusBarMessage(Resources.BuildErrors);
                return(false);
            }

            if (Directory.GetCurrentDirectory() !=
                compileCommand.SourceInfo.DirectoryName)
            {
                Directory.SetCurrentDirectory(
                    compileCommand.SourceInfo.DirectoryName);

                _applicationManager.NotifyFileSystemChange();
            }

            RunProcessContext context = new RunProcessContext();

            context.ExePath     = compileCommand.Path;
            context.ProcessArgs = compileCommand.Args;
            context.HeaderText  = compileCommand.StartText;
            context.FooterText  = compileCommand.FinishText;
            context.LineParser  = compileCommand.BuildTool.LineParser;
            context.ExitCode    = 0;

            Dictionary <String, List <String> > actionCommands =
                _buildToolManager.GetActionCommands(compileCommand.SourceText);

            _output.Text = String.Format("{0} {1}",
                                         Resources.OutputWindowCompile,
                                         compileCommand.BuildTool.DisplayName);

            bool res = RunShellCommands(
                String.Format("{0} ", Resources.PreCompileTask),
                actionCommands[Constants.ACTION_CMD_DO_PRE_COMPILE]);

            _applicationManager.NotifyFileSystemChange();

            if (res)
            {
                res = _output.RunProcessInternal(context);
            }

            if (context.ExitCode != compileCommand.SuccessCode)
            {
                res = false;
            }

            if (res)
            {
                res = RunShellCommands(
                    String.Format("{0} ", Resources.PostCompileTask),
                    actionCommands[Constants.ACTION_CMD_DO_POST_COMPILE]);
            }

            _applicationManager.NotifyFileSystemChange();

            if (res)
            {
                _mainForm.SetStatusBarMessage(Resources.BuildSuccess);
            }
            else
            {
                _mainForm.SetStatusBarMessage(Resources.BuildErrors);
            }

            return(res);
        }
Example #3
0
        private bool RunFile(BuildCommand runCommand)
        {
            if (_output == null)
            {
                return(false);
            }

            if (runCommand == null)
            {
                _output.AddLineToOutputView(String.Format(
                                                "------ {0}: {1}",
                                                Resources.BuildErrors,
                                                Resources.ErrorBuildToolInvalid));

                _output.AdjustOutputWidth();
                _mainForm.SetStatusBarMessage(Resources.BuildErrors);
                return(false);
            }

            if (Directory.GetCurrentDirectory() !=
                runCommand.SourceInfo.DirectoryName)
            {
                Directory.SetCurrentDirectory(
                    runCommand.SourceInfo.DirectoryName);

                _applicationManager.NotifyFileSystemChange();
            }

            if (runCommand.Cancel)
            {
                _output.AddLineToOutputView(
                    String.Format(
                        Resources.ProgramTarget,
                        runCommand.TargetInfo.FullName));

                _output.AddLineToOutputView(
                    String.Format(
                        Resources.ProgramNotExecutable,
                        runCommand.TargetInfo.Extension));

                _output.AdjustOutputWidth();
                _mainForm.SetStatusBarMessage(Resources.BuildHalted);
                return(runCommand.CancelResult);
            }

            RunProcessContext context = new RunProcessContext();

            context.ExePath     = runCommand.Path;
            context.ProcessArgs = runCommand.Args;
            context.HeaderText  = runCommand.StartText;
            context.FooterText  = runCommand.FinishText;
            context.LineParser  = runCommand.BuildTool.LineParser;
            context.ExitCode    = 0;

            Dictionary <String, List <String> > actionCommands =
                _buildToolManager.GetActionCommands(runCommand.SourceText);

            _output.Text = String.Format("{0} {1}",
                                         Resources.OutputWindowRun,
                                         runCommand.BuildTool.DisplayName);

            bool useWindow =
                (actionCommands[Constants.ACTION_CMD_RUN_IN_OWN_WINDOW].Count > 0);

            bool res = RunShellCommands(
                String.Format("{0} ", Resources.PreRunTask),
                actionCommands[Constants.ACTION_CMD_DO_PRE_RUN]);

            _applicationManager.NotifyFileSystemChange();

            if (res)
            {
                if (useWindow)
                {
                    res = _output.RunProcessExternal(context);
                }
                else
                {
                    res = _output.RunProcessInternal(context);
                }
            }

            if (res)
            {
                res = RunShellCommands(
                    String.Format("{0} ", Resources.PostRunTask),
                    actionCommands[Constants.ACTION_CMD_DO_POST_RUN]);
            }

            _applicationManager.NotifyFileSystemChange();

            _mainForm.SetStatusBarMessage(
                String.Format(Resources.ProgramReturn, context.ExitCode));

            return(res);
        }