public static Style Merge(this Style style, Style target, params string[] components) { var merged = new Style(); foreach (var component in style.GetType().GetProperties().Select(self => self.Name)) { merged.GetByName(component).Current = style.GetByName(component).Current; } foreach (var component in StyleManager.GetModule().Cached .Where(self => components.Select(name => name.ToLower()).Contains(self.Seed.ToLower())) .SelectMany(self => self.Group).Select(self => self.Seed)) { merged.GetByName(component).Current = target.GetByName(component).Current; } return(merged); }
public static int Differ(this Style source, Style target) { var type = typeof(Style); var amount = 0; foreach (var property in type.GetProperties().Select(self => self.Name).ToList()) { if (source.GetByName(property).Current != target.GetByName(property).Current) { amount++; } } return(amount); }