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


C# Processor.GetDomain方法代码示例

本文整理汇总了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());
        }
开发者ID:NasuTek,项目名称:NasuTek-Preprocessor,代码行数:8,代码来源:DateTimePreprocessor.cs

示例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;
            }
        }
开发者ID:NasuTek,项目名称:NasuTek-Monitoring,代码行数:27,代码来源:XmlFormatter.cs

示例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);
        }
开发者ID:NasuTek,项目名称:NasuTek-Preprocessor,代码行数:19,代码来源:ProcessorTests.cs

示例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);
        }
开发者ID:NasuTek,项目名称:NasuTek-Preprocessor,代码行数:12,代码来源:ProcessorTests.cs

示例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);
            }
        }
开发者ID:NasuTek,项目名称:NasuTek-Preprocessor,代码行数:15,代码来源:XMLProcessing.cs

示例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);
        }
开发者ID:NasuTek,项目名称:NasuTek-Preprocessor,代码行数:18,代码来源:ProcessorTests.cs

示例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);
        }
开发者ID:NasuTek,项目名称:NasuTek-Preprocessor,代码行数:22,代码来源:GitProcessor.cs


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