private ObjectBlockRequest <T> ConvertToObjectBlockRequest <T>(IObjectBlockSettings <T> settings) { var request = new ObjectBlockRequest <T>(settings.Object, _taskConfiguration.MaxLengthForNonCompressedData); request.ApplicationName = _taskExecutionInstance.ApplicationName; request.TaskName = _taskExecutionInstance.TaskName; request.TaskExecutionId = _taskExecutionInstance.TaskExecutionId; request.TaskDeathMode = _taskExecutionOptions.TaskDeathMode; if (_taskExecutionOptions.TaskDeathMode == TaskDeathMode.KeepAlive) { request.KeepAliveDeathThreshold = _taskExecutionOptions.KeepAliveDeathThreshold.Value; } else { request.OverrideDeathThreshold = _taskExecutionOptions.OverrideThreshold.Value; } request.ReprocessReferenceValue = settings.ReferenceValueToReprocess; request.ReprocessOption = settings.ReprocessOption; SetConfigurationOverridableSettings(request, settings); return(request); }
public ObjectBlock Parse(string input, IObjectBlockSettings settings) { var result = input.Split(Environment.NewLine) .Aggregate(new BlockAccumulator(new ObjectBlock()), (acc, line) => { var match = IndentRegex.Match(line); var indent = match.Groups[1].Value; var rest = match.Groups[2].Value; var rank = BlockIndenter.MeasureIndent(indent); var parser = _blockParsers.FirstOrDefault(x => x.IsMatch(rest)); return(parser != null ? parser.Include(acc.SetRank(rank), parser.Parse(rest)) : acc); }) .Root .MakeCollections(settings); return(result); }
public ObjectBlock MakeCollections(IObjectBlockSettings settings) { var collectionNames = settings.KnownCollectionNames().ToList(); var items = Blocks .OfType <ObjectBlock>() .GroupBy(x => x.Name) //known collection names (handles singles) or any grouping of 2 or more (handles unknowns) .Where(x => collectionNames.Contains(x.Key) || x.Count() > 1) .ToDictionary(x => x.Key, x => x.ToList()); var allItems = items.SelectMany(x => x.Value).ToList(); var collections = items.Select(x => new CollectionBlock(x.Key) { Blocks = x.Value }); _blocks.RemoveAll(allItems.Contains); _blocks.AddRange(collections); allItems.Each(x => x.MakeCollections(settings)); return(this); }
public void RegisterSettings(Type type, IObjectBlockSettings settings) { _settings.Fill(type, settings); }
public ObjectBlockValues(ObjectBlock root, IObjectBlockSettings settings, Type type) { _root = root; _settings = settings; _type = type; }