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


C# IExecutionContext.SaveResult方法代码示例

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


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

示例1: Do

 public override CommandResult Do(IExecutionContext context)
 {
     string stringBaseKey = KeyFullPath.Split('\\')[0];
     string stringKey = KeyFullPath.Substring(KeyFullPath.LastIndexOf('\\') + 1);
     string stringRelativePath = KeyFullPath.Substring(KeyFullPath.IndexOf('\\') + 1);
     stringRelativePath = stringRelativePath.Remove(stringRelativePath.LastIndexOf('\\'));
     RegistryKey baseKey;
     switch (stringBaseKey)
     {
         case "HKEY_CLASSES_ROOT":
             baseKey = Registry.ClassesRoot;
             break;
         case "HKEY_CURRENT_USER":
             baseKey = Registry.CurrentUser;
             break;
         case "HKEY_LOCAL_MACHINE":
             baseKey = Registry.LocalMachine;
             break;
         case "HKEY_USERS":
             baseKey = Registry.Users;
             break;
         case "HKEY_CURRENT_CONFIG":
             baseKey = Registry.CurrentConfig;
             break;
         default:
             baseKey = Registry.LocalMachine;
             break;
     }
     RegistryKey key = baseKey.OpenSubKey(stringRelativePath);
     context.SaveResult(ResultName, key.GetValue(stringKey));
     return CommandResult.Next;
 }
开发者ID:vgrinin,项目名称:gin,代码行数:32,代码来源:ReadRegistry.cs

示例2: Do

        public override CommandResult Do(IExecutionContext context)
        {
            RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"CLSID\" + ClassId);
            context.SaveResult(ResultName, key != null);

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

示例3: Do

        public override CommandResult Do(IExecutionContext context)
        {
            bool result = false;
            RegistryKey key;
            switch (SearchType)
            {
                case MSISearchType.ProductCode:
                    key = Registry.ClassesRoot.OpenSubKey(@"Installer\Products\" + Product);
                    result = key != null;
                    break;
                case MSISearchType.ProductName:
                    key = Registry.ClassesRoot.OpenSubKey(@"Installer\Products");
                    string[] subKeys = key.GetSubKeyNames();
                    foreach (string subKey in subKeys)
                    {
                        RegistryKey key2 = key.OpenSubKey(subKey);
                        string keyValue = (string)key2.GetValue("ProductName");
                        if (keyValue == Product)
                        {
                            result = true;
                            break;
                        }
                    }
                    break;
                default:
                    throw new Exception("Добавь тип");
            }

            context.SaveResult(ResultName, result);

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

示例4: Do

        public override CommandResult Do(IExecutionContext context)
        {
            DataRow row = (DataRow)context.GetResult(DataRowName);
            context.SaveResult(ResultName, row[FieldName]);

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

示例5: 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

示例6: Do

        public override CommandResult Do(IExecutionContext context)
        {
            DataTable table = (DataTable)context.GetResult(TableName);
            DataRow row = table.Rows[0];
            context.SaveResult(ResultName, row);

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

示例7: Do

        public override CommandResult Do(IExecutionContext context)
        {
            string operand1 = (string)(context.GetResult(FirstOperandName));
            string operand2 = (string)(context.GetResult(SecondOperandName));

            bool result = Compare(operand1, operand2);
            context.SaveResult(ResultName, result);
            return CommandResult.Next;
        }
开发者ID:vgrinin,项目名称:gin,代码行数:9,代码来源:CompareStrings.cs

示例8: Do

 public override CommandResult Do(IExecutionContext context)
 {
     object argument = context.GetResult(ArgumentName);
     List<ParsedResult> list = GetObjectValueMembers(argument.GetType(), argument, ArgumentName);
     foreach (var item in list)
     {
          context.SaveResult(ExecutionContext.GetPercentedKey(item.Name), item.Value);
     }
     return CommandResult.Next;
 }
开发者ID:vgrinin,项目名称:gin,代码行数:10,代码来源:CMParseResult.cs

示例9: 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

示例10: 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

示例11: 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

示例12: Do

 public override CommandResult Do(IExecutionContext context)
 {
     context.SaveResult(ResultName, Value);
     return CommandResult.Next;
 }
开发者ID:vgrinin,项目名称:gin,代码行数:5,代码来源:SaveDateTime.cs

示例13: Do

 public override CommandResult Do(IExecutionContext context)
 {
     DateTime dateTime = UseCurrent ? DateTime.Now : DateTimeValue;
     context.SaveResult(ResultName, dateTime.ToString(FormatString));
     return CommandResult.Next;
 }
开发者ID:vgrinin,项目名称:gin,代码行数:6,代码来源:FormatDateTime.cs

示例14: 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

示例15: Do

 public override CommandResult Do(IExecutionContext context)
 {
     string result = Environment.GetEnvironmentVariable(VariableName);
     context.SaveResult(ResultName, result);
     return CommandResult.Next;
 }
开发者ID:vgrinin,项目名称:gin,代码行数:6,代码来源:ReadEnvironment.cs


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