/// <summary> /// Builds a list of FileData Values /// </summary> private static BuildNonLazyValuesDetail BuildNonLazyFileValues(FileData file) { var result = new BuildNonLazyValuesDetail(); var start = DateTime.Now; lock (file.NonLazyValues) { if (file.IsCached_Values) { result.FileCached = true; return(result); } var stopwatch = new Stopwatch(MethodBase.GetCurrentMethod().Name); try { file.NonLazyValues.Clear(); var test = XmlDal.DataModel.ValuesModel.Values .Where(n => !n.LazyLoad && n.FileInfo && n.ContainsSourceType(file.SourceType)).ToList(); result.Count = test.Count; Log.Write($"Searching for {test.Count} FileData Info Values", typeof(FileService).FullName, MethodBase.GetCurrentMethod().Name, LogEntryType.Warning); foreach (var model in test) { var s1 = DateTime.Now; var stopwatch2 = new Stopwatch("Non Lazy Value"); var valueResult = GetValue(file, model, false); if (valueResult.Success) { file.NonLazyValues.AddRange(valueResult.Values); } var duration = stopwatch2.Stop(model.Name, 200); if (duration >= XmlDal.DataModel.Options.NonLazyValueWarningTimeout) { NotificationService.Warning( $@"WARNING: Non Lazy Value ""{model.Name}"" took more then {duration} seconds. Consider optimizing the Regular Expression. Expression: '{model.Expression}'"); } result.ValueDurations.Add(new ValuePair() { Name = model.Name, Value = (DateTime.Now - s1).ToShortReadableString() }); } var addSourceTypeStart = DateTime.Now; // Add SourceType if (!string.IsNullOrEmpty(file.SourceType)) { file.NonLazyValues.Add(new ValueBookMark { DocumentMap = false, FileInfo = true, iLine = file.SourceTypeiLine, Level = DocumentMapLevel.Sibling, Name = Keywords.SOURCE_TYPE, Value = file.SourceType, ValueId = -1 }); } result.AddSourceTypeDuration = DateTime.Now - addSourceTypeStart; } finally { file.IsCached_Values = true; stopwatch.Stop(2000); } result.TotalDuration = DateTime.Now - start; return(result); } }
public BuildDetail() { RangeDetail = new BuildRangeDetail(); NonLazyValuesDetail = new BuildNonLazyValuesDetail(); SourceTypeDetail = new BuildSourceTypeDetail(); }