internal IgnoreDictionary Next(ParameterExpression source, ParameterExpression?destination, string destMemberName) { var result = new IgnoreDictionary(); foreach (var member in this) { if (!member.Key.StartsWith(destMemberName + ".")) { continue; } var next = new IgnoreItem { Condition = member.Value.IsChildPath || member.Value.Condition == null ? member.Value.Condition : Expression.Lambda(member.Value.Condition.Apply(source, destination), source, destination), IsChildPath = true }; result.Merge(member.Key.Substring(destMemberName.Length + 1), next); } return(result); }
internal void Merge(string name, IgnoreDictionary.IgnoreItem src) { if (src.Condition != null && this.TryGetValue(name, out var item)) { if (item.Condition == null) { return; } var param = src.Condition.Parameters.ToArray(); var body = item.IsChildPath ? item.Condition.Body : item.Condition.Apply(param[0], param[1]); this[name] = new IgnoreItem { Condition = Expression.Lambda(Expression.OrElse(src.Condition.Body, body), param), IsChildPath = src.IsChildPath }; } else { this[name] = src; } }
private bool ValidExecution(out IWpfTextView view) { var formatSettings = SettingsProvider.FormatSettingsModel; view = Vsix.GetDocumentView(mDocument); if (view == null) { return(false); } if (IsFileStyleSelected(formatSettings)) { var fileToFormatPath = Vsix.GetDocumentParent(view); if (!FileSystem.SearchAllTopDirectories(fileToFormatPath, FileSystem.ConfigClangFormatFileTypes)) { OnFormatFile(new FormatCommandEventArgs() { Clear = clearOutput, FormatConfigFound = false }); if (clearOutput) { clearOutput = false; } return(false); } } if (FileHasExtension(mDocument.FullName, formatSettings.FileExtensions) == false) { OnFormatFile(new FormatCommandEventArgs() { IgnoreExtension = true, FileName = mDocument.Name, Clear = clearOutput }); if (clearOutput) { clearOutput = false; } return(false); } var ignoreItem = new IgnoreItem(); if (ignoreItem.Check(mDocument)) { OnFormatFile(new FormatCommandEventArgs() { IgnoreFile = true, FileName = mDocument.Name, Clear = clearOutput }); if (clearOutput) { clearOutput = false; } OnIgnoreItem(new ClangCommandMessageEventArgs(ignoreItem.IgnoreFormatMessage, false)); return(false); } if (ScriptConstants.kCMakeConfigFile == mDocument.Name.ToLower()) { return(false); } OnFormatFile(new FormatCommandEventArgs() { Clear = true }); return(true); }