private static WorkflowConfig GetConfig(string payload) { var tree = WorkflowConfigParser.ParseString(new System.Text.StringBuilder(payload)); WorkflowConfigVisitor visitor = new WorkflowConfigVisitor() .AddRule("IsMajor", typeof(ParserUnitTest).GetMethod("IsMajor")) .AddRule("IsEmpty", typeof(ParserUnitTest).GetMethod("IsEmpty")) ; visitor.Filename = "memory text"; WorkflowConfig config = (WorkflowConfig)tree.Visit <object>(visitor); return(config); }
private WorkflowsConfig GetConfigurations(DirectoryInfo d, string extension) { if (!extension.StartsWith("*.")) { if (extension.StartsWith(".")) { extension = "*" + extension; } else { extension = "*." + extension; } } WorkflowsConfig configs = new WorkflowsConfig(); Func <WorkflowConfigVisitor> f = () => { WorkflowConfigVisitor visitor = new WorkflowConfigVisitor(); foreach (var method in this._methods) { visitor.AddRule(method.Key, method.Value); } return(visitor); }; var files = d.GetFiles(extension, SearchOption.AllDirectories).ToList(); HashSet <string> _paths = new HashSet <string>(); foreach (var item in files) { if (_paths.Add(item.Directory.FullName)) { WorkflowsConfigLoader.Load(configs, f, item.Directory.FullName, extension, null, null); } } return(configs); }