示例#1
0
        public static string ToLegacyType(string key, string type,
                                          out bool isKnownKey, out bool isSpecialType)
        {
            isKnownKey    = false;
            isSpecialType = false;

            key  = AsciiUtil.ToLower(key);
            type = AsciiUtil.ToLower(type);

            if (KEYMAP.TryGetValue(key, out KeyData keyData) && keyData != null)
            {
                isKnownKey = true;
                if (keyData.TypeMap.TryGetValue(type, out Type t) && t != null)
                {
                    return(t.legacyId);
                }
                if (keyData.SpecialTypes != null)
                {
                    foreach (SpecialType st in keyData.SpecialTypes)
                    {
                        if (st.GetHandler().IsWellFormed(type))
                        {
                            isSpecialType = true;
                            return(st.GetHandler().Canonicalize(type));
                        }
                    }
                }
            }
            return(null);
        }
示例#2
0
 public static string ToLegacyKey(string key)
 {
     key = AsciiUtil.ToLower(key);
     if (KEYMAP.TryGetValue(key, out KeyData keyData) && keyData != null)
     {
         return(keyData.LegacyId);
     }
     return(null);
 }