Example #1
0
        private static int CompareProps(MrProperty p1, MrProperty p2)
        {
#if DEBUG
            var c = p1.GetName().CompareTo(p2.GetName());
            if (c != 0)
            {
                return(c);
            }
            var inheritanceDepthComp = Util.GetTypeInheritanceDepth(p1.DeclaringType).CompareTo(Util.GetTypeInheritanceDepth(p2.DeclaringType));
            if (inheritanceDepthComp != 0)
            {
                return(inheritanceDepthComp);
            }
            return(p1.DeclaringType.GetName().CompareTo(p2.DeclaringType.GetName()));
#else
            var h1 = GetPropertySortKey(p1);
            var h2 = GetPropertySortKey(p2);
            if (h1.CompareTo(h2) != 0)
            {
                return(h1.CompareTo(h2));
            }
            else
            {
                return(p1.DeclaringType.GetName().CompareTo(p2.DeclaringType.GetName()));
            }
#endif
        }
Example #2
0
 public static bool IsDependencyProperty(MrProperty prop)
 {
     if (prop.GetName() == "Property")
     {
         return(false); // special case Windows.UI.Xaml.DependencyPropertyChangedEventArgs.Property
     }
     return(prop.GetName().EndsWith("Property") &&
            prop.GetPropertyType().GetName() == "DependencyProperty");
 }
Example #3
0
        public static string ToJsName(MrProperty prop)
        {
            if (IsDependencyProperty(prop))
            {
                return(ToJsName($"{prop.DeclaringType.GetName()}{Util.MinusPropertySuffix(prop.GetName())}"));
            }
            var fullName = GetPropFullName(prop);

            if (propNameMap.ContainsKey(fullName))
            {
                return(propNameMap[fullName]);
            }
            return(ToJsName(prop.GetName()));
        }
Example #4
0
 private static uint GetPropertySortKey(MrProperty p1)
 {
     return(HashName(p1.GetName()));
 }
Example #5
0
 public static string GetPropFullName(MrProperty p)
 {
     return($"{p.DeclaringType.GetFullName()}.{p.GetName()}");
 }