本文整理汇总了C#中VariableDictionary.GetRaw方法的典型用法代码示例。如果您正苦于以下问题:C# VariableDictionary.GetRaw方法的具体用法?C# VariableDictionary.GetRaw怎么用?C# VariableDictionary.GetRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VariableDictionary
的用法示例。
在下文中一共展示了VariableDictionary.GetRaw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalamariVariableDictionary
public CalamariVariableDictionary(string storageFilePath, string sensitiveFilePath, string sensitiveFilePassword)
{
var fileSystem = CalamariPhysicalFileSystem.GetPhysicalFileSystem();
if (!string.IsNullOrEmpty(storageFilePath))
{
if (!fileSystem.FileExists(storageFilePath))
throw new CommandException("Could not find variables file: " + storageFilePath);
var nonSensitiveVariables = new VariableDictionary(storageFilePath);
nonSensitiveVariables.GetNames().ForEach(name => Set(name, nonSensitiveVariables.GetRaw(name)));
}
if (!string.IsNullOrEmpty(sensitiveFilePath))
{
var rawVariables = string.IsNullOrWhiteSpace(sensitiveFilePassword)
? fileSystem.ReadFile(sensitiveFilePath)
: Decrypt(fileSystem.ReadAllBytes(sensitiveFilePath), sensitiveFilePassword);
try
{
var sensitiveVariables = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawVariables);
foreach (var variable in sensitiveVariables)
{
SetSensitive(variable.Key, variable.Value);
}
}
catch (JsonReaderException)
{
throw new CommandException("Unable to parse sensitive-variables as valid JSON.");
}
}
}
示例2: AddEnvironmentVariables
private VariableDictionary AddEnvironmentVariables()
{
var variables = new VariableDictionary();
var convention = new ContributeEnvironmentVariablesConvention();
convention.Install(new RunningDeployment("C:\\Package.nupkg", variables));
Assert.That(variables.GetNames().Count, Is.GreaterThan(3));
Assert.That(variables.GetRaw(SpecialVariables.Tentacle.Agent.InstanceName), Is.EqualTo("#{env:TentacleInstanceName}"));
return variables;
}
示例3: MergeWith
public static void MergeWith(this VariableDictionary variables, VariableDictionary other)
{
other.GetNames().ForEach(name => variables.Set(name, other.GetRaw(name)));
}