本文整理汇总了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;
}
示例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;
}
示例3: Do
public override CommandResult Do(IExecutionContext context)
{
string absoluteMessageText = context.GetStringFrom(MessageText);
context.Log.AddLogInformation(absoluteMessageText);
return CommandResult.Next;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}