Exemple #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();
        }
Exemple #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);
        }