当前位置: 首页>>代码示例>>C#>>正文


C# IExecutionContext.GetStringFrom方法代码示例

本文整理汇总了C#中IExecutionContext.GetStringFrom方法的典型用法代码示例。如果您正苦于以下问题:C# IExecutionContext.GetStringFrom方法的具体用法?C# IExecutionContext.GetStringFrom怎么用?C# IExecutionContext.GetStringFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IExecutionContext的用法示例。


在下文中一共展示了IExecutionContext.GetStringFrom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Do

        public override CommandResult Do(IExecutionContext context)
        {
            string absoluteInstanceName = context.GetStringFrom(InstanceName);
            string absoluteSAPassword = context.GetStringFrom(SAPassword);

            string cmdParameters = ARGUMENTS_EXE_STRING.
                Replace("{INSTANCE}", absoluteInstanceName).
                Replace("{PWD}", absoluteSAPassword).
                Replace("{USER}", "\"" + DEFAULT_INSTANCE_ACCOUNT + "\"");

            string intResultName = Guid.NewGuid().ToString("N");
            ExecuteProgram exec = new ExecuteProgram()
            {
                Arguments = "/qb " + cmdParameters,
                ProgramExePath = SetupFilePath,
                WindowType = Gin.Util.ProgramWindowType.WinForms,
                IntResultName = intResultName
            };
            exec.Do(context);
            int intResult = (int)context.GetResult(intResultName);

            context.SaveResult(ResultName, intResult);

            return CommandResult.Next;
        }
开发者ID:vgrinin,项目名称:gin,代码行数:25,代码来源:CMInstallSQLInstance.cs

示例2: Do

 public override CommandResult Do(IExecutionContext context)
 {
     string absoluteSourcePath = context.GetStringFrom(SourcePath);
     string absoluteDestPath = context.GetStringFrom(DestPath);
     File.Copy(absoluteSourcePath, absoluteDestPath, true);
     context.Log.AddLogInformation("Файл " + absoluteDestPath + " создан");
     return CommandResult.Next;
 }
开发者ID:vgrinin,项目名称:gin,代码行数:8,代码来源:CreateFile.cs

示例3: Do

        public override CommandResult Do(IExecutionContext context)
        {
            string absoluteMessageText = context.GetStringFrom(MessageText);
            context.Log.AddLogInformation(absoluteMessageText);

            return CommandResult.Next;
        }
开发者ID:vgrinin,项目名称:gin,代码行数:7,代码来源:LogMessage.cs

示例4: Do

        public override CommandResult Do(IExecutionContext context)
        {
            string argumentValueString = context.GetStringFrom(ArgumentName);
            bool argumentValue = Boolean.Parse(argumentValueString);
            context.SaveResult(ResultName, !argumentValue);

            return CommandResult.Next;
        }
开发者ID:vgrinin,项目名称:gin,代码行数:8,代码来源:InvertBoolean.cs

示例5: Do

 public override CommandResult Do(IExecutionContext context)
 {
     DestPath = context.GetStringFrom(DestPath);
     if (CreateEmpty && Directory.Exists(DestPath))
     {
         Directory.Delete(DestPath, true);
     }
     Directory.CreateDirectory(DestPath);
     return CommandResult.Next;
 }
开发者ID:vgrinin,项目名称:gin,代码行数:10,代码来源:CreateFolder.cs

示例6: Do

 public override CommandResult Do(IExecutionContext context)
 {
     string absoluteDestPath = context.GetStringFrom(DestPath);
     string absoluteSourcePath = context.GetStringFrom(SourcePath);
     bool asboluteMoveFast = context.GetBoolFrom(MoveFast);
     bool asboluteClearFirst = context.GetBoolFrom(ClearFirst);
     context.Log.AddLogInformation("Начинаем создавать папку " + absoluteDestPath);
     if (asboluteClearFirst && Directory.Exists(absoluteDestPath))
     {
         Directory.Delete(absoluteDestPath, true);
     }
     if (!Directory.Exists(absoluteDestPath))
     {
         Directory.CreateDirectory(absoluteDestPath);
     }
     IOUtil.CopyDirectory(absoluteSourcePath, absoluteDestPath, asboluteMoveFast);
     context.Log.AddLogInformation("Папка " + absoluteDestPath + " создана");
     return CommandResult.Next;
 }
开发者ID:vgrinin,项目名称:gin,代码行数:19,代码来源:CreateDirectoryContent.cs

示例7: Do

 public override CommandResult Do(IExecutionContext context, Transaction transaction)
 {
     if (transaction != null)
     {
         SingleFileStep step = transaction.CreateStep<SingleFileStep>(this);
         string absoluteDestFilePath = context.GetStringFrom(DestFilePath);
         step.Init(context, absoluteDestFilePath);
     }
     Do(context);
     return CommandResult.Next;
 }
开发者ID:vgrinin,项目名称:gin,代码行数:11,代码来源:CreateTextFile.cs

示例8: Do

 public override CommandResult Do(IExecutionContext context)
 {
     string absoluteValue;
     if (IsPathCombine)
     {
         absoluteValue = "";
         string[] parts = Value.Split('\\');
         foreach (string part in parts)
         {
             string absolutePart = context.GetStringFrom(part).Trim();
             if (absolutePart.EndsWith(":"))
             {
                 absolutePart += @"\";
             }
             absoluteValue = Path.Combine(absoluteValue, absolutePart);
         }
     }
     else
     {
         absoluteValue = context.GetStringFrom(Value);
     }
     context.SaveResult(ResultName, absoluteValue);
     return CommandResult.Next;
 }
开发者ID:vgrinin,项目名称:gin,代码行数:24,代码来源:SaveString.cs

示例9: Do

 public override CommandResult Do(IExecutionContext context)
 {
     string absoluteMessageText = context.GetStringFrom(MessageText);
     if (context.ControlContainer != null)
     {
         context.ControlContainer.Invoke(new Action(() =>
         {
             MessageBox.Show(context.ControlContainer, absoluteMessageText, "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }));
     }
     else
     {
         MessageBox.Show(absoluteMessageText, "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return CommandResult.Next;
 }
开发者ID:vgrinin,项目名称:gin,代码行数:16,代码来源:ShowMessage.cs

示例10: Do

 public override CommandResult Do(IExecutionContext context)
 {
     string absoluteProgramPath = context.GetStringFrom(ProgramExePath);
     ProcessWrapper proc = new ProcessWrapper(absoluteProgramPath, Arguments, null, WindowType);
     int result = proc.GetExitCode();
     if (IntResultName != null)
     {
         context.SaveResult(IntResultName, result);
     }
     if (StringResultName != null)
     {
         context.SaveResult(StringResultName, proc.StandardOutput);
     }
     if (StringErrorName != null)
     {
         context.SaveResult(StringErrorName, proc.StandardError);
     }
     return CommandResult.Next;
 }
开发者ID:vgrinin,项目名称:gin,代码行数:19,代码来源:ExecuteProgram.cs

示例11: Do

        public override CommandResult Do(IExecutionContext context)
        {
            string absolutePackageFilePath = context.GetStringFrom(PackageFilePath);
            string logFilePath = Path.Combine(context.ExecutedPackage.PackagePath, Guid.NewGuid().ToString("N") + ".log");
            DTSExecutor executor = new DTSExecutor(absolutePackageFilePath, logFilePath, false);
            executor.OnLogger += new LoggerEvent(context.Log.AddLogEvent);
            executor.OnProgress += new ProgressEvent(
                (percent)=>
                {
                    context.Log.SendProgress(new ExecutionProgressInfo()
                    {
                        Message = "Выполнение DTS-пакета",
                        ModuleName = "CMExecuteDTS",
                        ProgressCost = 0
                    });
                    //CheckForPendingCancel(context);
                });
            foreach (DTSGlobalVariable param in Parameters)
            {
                object absoluteVariableValue = context.GetResult(param.VariableValue);
                executor.SaveParameter(param.VariableName, absoluteVariableValue);
            }

            CancellingExecutor cnclexecutor = new CancellingExecutor(() =>
            {
                QueryCancelEventArgs args = new QueryCancelEventArgs();
                context.Log.GetPendingCancel(args);
                return args.Cancel;
            });

            cnclexecutor.Execute(() =>
            {
                executor.Execute();
            });

            return CommandResult.Next;
        }
开发者ID:vgrinin,项目名称:gin,代码行数:37,代码来源:CMExecuteDTS.cs

示例12: InitParameters

        private List<SqlParameterClass> InitParameters(IExecutionContext context)
        {
            List<SqlParameterClass> parameters = new List<SqlParameterClass>();

            string absoluteDatabaseName = context.GetStringFrom(DatabaseName);
            context.Log.AddLogInformation("DatabaseName = '" + absoluteDatabaseName + "'");
            SqlParameterClass p = context.AddSqlParameterToContext("BASENAME", absoluteDatabaseName, SqlDbType.VarChar, 255, ParameterDirection.Input);
            parameters.Add(p);

            string absoluteBackupFilePath = context.GetStringFrom(BackupFilePath);
            context.Log.AddLogInformation("BackupFilePath = '" + absoluteBackupFilePath + "'");
            string backupName = Path.GetFileNameWithoutExtension(absoluteBackupFilePath);
            p = context.AddSqlParameterToContext("NAME", backupName, SqlDbType.VarChar, 255, ParameterDirection.Input);
            parameters.Add(p);
            p = context.AddSqlParameterToContext("FULLNAME", absoluteBackupFilePath, SqlDbType.VarChar, 255, ParameterDirection.Input);
            parameters.Add(p);
            return parameters;
        }
开发者ID:vgrinin,项目名称:gin,代码行数:18,代码来源:CMCreateSQLBackup.cs

示例13: Do

        public override CommandResult Do(IExecutionContext context)
        {
            context.Log.AddLogInformation("Вход в метод CMExecuteSQLQuery.Do(ExecutionContext)");
            string absoluteConnectionString = context.GetStringFrom(ConnectionString);
            context.Log.AddLogInformation("ConnectionString = '" + absoluteConnectionString + "'", new ConnectionStringFilter());

            using (SqlConnection connection = new SqlConnection(absoluteConnectionString))
            {
                SqlCommand command;
                if (ScriptFilePath == null)
                {
                    command = new SqlCommand(CommandText, connection);
                    command.CommandType = CommandType;
                }
                else
                {
                    string absoluteScriptFilePath = context.GetStringFrom(ScriptFilePath);
                    string commandText = IOUtil.ReadFile(absoluteScriptFilePath);
                    commandText = context.GetStringFrom(commandText);
                    command = new SqlCommand(commandText, connection);
                    command.CommandType = CommandType.Text;
                }
                if (CommandTimeout > 0)
                {
                    command.CommandTimeout = CommandTimeout;
                }
                else
                {
                    command.CommandTimeout = SQLConst.DEFAULT_SQL_COMMAND_TIMEOUT;
                }
                if (Parameters != null)
                {
                    foreach (SqlParameterClass parameter in Parameters)
                    {
                        object value = context.GetResult(parameter.ValueName);
                        SqlParameter sqlParameter = new SqlParameter(parameter.ParameterName, parameter.Type);
                        sqlParameter.Direction = parameter.Direction;
                        sqlParameter.Value = value != null ? value : DBNull.Value;
                        if (parameter.Size > 0)
                        {
                            sqlParameter.Size = parameter.Size;
                        }
                        command.Parameters.Add(sqlParameter);
                    }
                }
                connection.Open();
                DataSet dataSet = new DataSet();
                SqlDataAdapter adapter = new SqlDataAdapter(command);
                adapter.Fill(dataSet);
                DataTable table = null;
                if (dataSet.Tables.Count > 0)
                {
                    table = dataSet.Tables[0];
                }
                context.SaveResult(ResultName, table);
            }

            return CommandResult.Next;
        }
开发者ID:vgrinin,项目名称:gin,代码行数:59,代码来源:CMExecuteSQLQuery.cs

示例14: Create

 public override Control Create(IExecutionContext context)
 {
     string absoluteValue = context.GetStringFrom((string)Value);
     _control = new Editors.TextEditor(Caption, absoluteValue, 0, "", null, null);
     return _control;
 }
开发者ID:vgrinin,项目名称:gin,代码行数:6,代码来源:UserInputTextBox.cs

示例15: Create

 public override Control Create(IExecutionContext context)
 {
     string absoluteInitialValue = context.GetStringFrom((string)Value);
     Control = new Editors.BrowseFolderEditor(Caption, absoluteInitialValue, null, null, null);
     return Control;
 }
开发者ID:vgrinin,项目名称:gin,代码行数:6,代码来源:UserInputBrowseDirectoryDialog.cs


注:本文中的IExecutionContext.GetStringFrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。