本文整理汇总了C#中Processor.GetDomain方法的典型用法代码示例。如果您正苦于以下问题:C# Processor.GetDomain方法的具体用法?C# Processor.GetDomain怎么用?C# Processor.GetDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Processor
的用法示例。
在下文中一共展示了Processor.GetDomain方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public void Execute(Dictionary<string, string> parameters, Processor processor)
{
var currDate = DateTime.Now;
processor.AddDomain("DateTimePreprocessor");
processor.GetDomain("DateTimePreprocessor").Add("CURRENT_DATE", currDate.ToShortDateString());
processor.GetDomain("DateTimePreprocessor").Add("CURRENT_TIME", currDate.ToShortTimeString());
}
示例2: FormatCollector
public void FormatCollector(Dictionary<string, string> parameters, Dictionary<string, string> collectorDict, System.Xml.Linq.XElement collectorElement, Type collectorType, Processor processor)
{
CollectorHelpers.IsCollectorFormatterValid(collectorType, "NasuTek.Monitoring.Service.BuiltIn.Collectors.FileCollector");
switch (collectorType.FullName)
{
case "NasuTek.Monitoring.Service.BuiltIn.Collectors.FileCollector":
{
string[] files = collectorDict["Files"].Split(',');
var dictRet = new Dictionary<string, Dictionary<string, string>>();
foreach (var file in files)
{
var xmlDoc = XDocument.Load(file);
foreach (var xmlRefVal in collectorElement.Elements("XmlRefToKeyValue"))
{
processor.AddDomain(xmlRefVal.Attribute("domain").Value, Path.GetFileName(file));
XElement ele = xmlDoc.XPathSelectElement(xmlRefVal.Attribute("name").Value);
if (ele != null)
processor.GetDomain(xmlRefVal.Attribute("domain").Value, Path.GetFileName(file))[xmlRefVal.Attribute("domain_key").Value] = ele.Value;
}
}
}
break;
}
}
示例3: TestFormatter
public void TestFormatter()
{
var processor = new Processor();
processor.AddDomain("TestDomain");
processor.AddDomain("TestDomain", "SubDomain");
processor.GetDomain("TestDomain").Add("TestKey", "This is a test.");
processor.GetDomain("TestDomain", "SubDomain").Add("TestKey", "This is a subdomain test.");
var formatStr1 = "##TestDomain.TestKey##";
var formatOut1 = processor.FormatString(formatStr1);
var formatStr2 = "##TestDomain:SubDomain.TestKey##";
var formatOut2 = processor.FormatString(formatStr2);
var formatStr3 = "##TestDomain.TestKey####TestDomain:SubDomain.TestKey##";
var formatOut3 = processor.FormatString(formatStr3);
Assert.AreEqual("This is a test.", formatOut1);
Assert.AreEqual("This is a subdomain test.", formatOut2);
Assert.AreEqual("This is a test.This is a subdomain test.", formatOut3);
}
示例4: TestFormatterWithNewlineOptionsAndSameReplacers
public void TestFormatterWithNewlineOptionsAndSameReplacers()
{
var processor = new Processor();
processor.AddDomain("TestDomain");
processor.GetDomain("TestDomain").Add("TestKey", "This is a test.");
var formatStr = @"<@<% TestOption test=""Parameter"" %>@>
##TestDomain.TestKey##<% TestOption test=""Parameter"" %>##TestDomain.TestKey##";
var formatOut = processor.FormatString(formatStr);
Assert.AreEqual("This is a test.This is a test.", formatOut);
}
示例5: Execute
public void Execute(Dictionary<string, string> parameters, Processor processor)
{
var storageDomain = processor.GetStorageDomain(parameters["storageDomain"]);
processor.AddDomain(parameters["domain"]);
var domain = processor.GetDomain(parameters["domain"]);
var xmlDocument = XDocument.Load(parameters["xmlFile"]);
foreach (var xmlDefines in storageDomain)
{
var path = xmlDefines.Value.Split(':');
var element = xmlDocument.XPathSelectElement(path[0]);
if (element == null) continue;
domain.Add(xmlDefines.Key, path.Length == 2 ? element.Attribute(path[1]).Value : element.Value);
}
}
示例6: TestFormatterWithConvertersAndOptions
public void TestFormatterWithConvertersAndOptions()
{
var processor = new Processor();
processor.AddDomain("TestDomain");
processor.GetDomain("TestDomain").Add("TestKey", "This is a test.");
var formatStr = @"<@
<% Import dll=""NasuTek.Preprocessor.ProcessingLibrary.Tests.dll"" %>
<% Import namespace=""NasuTek.Preprocessor.ProcessingLibrary.Tests"" %>
@>
##TestDomain.TestKey(TestConverter[Demo=""Demo Testing "",Demo2=""Is Awesome.""])##";
processor.ExecuteProcessors(formatStr);
var formatOut = processor.FormatString(formatStr);
Assert.AreEqual("Demo Testing Is Awesome.", formatOut);
}
示例7: Execute
public void Execute(Dictionary<string, string> parameters, Processor processor)
{
processor.AddDomain(parameters["domain"]);
var head = File.ReadAllLines(Path.Combine(".git", "HEAD"))[0];
var headRegex = new Regex(@"ref: refs/(?<RefLocation>.*)/(?<Branch>.*)");
var headRegexMatch = headRegex.Match(head);
var branch = headRegexMatch.Groups["Branch"].Value;
var revNumber =
File.ReadAllText(Path.Combine(".git", "logs", "refs", headRegexMatch.Groups["RefLocation"].Value, branch))
.Split('\n')
.Length;
var hash =
File.ReadAllLines(Path.Combine(".git", "refs", headRegexMatch.Groups["RefLocation"].Value, branch))[0];
var domain = processor.GetDomain(parameters["domain"]);
domain.Add("RevNumber", revNumber.ToString(CultureInfo.InvariantCulture));
domain.Add("Branch", branch);
domain.Add("Hash", hash);
}