Esempio n. 1
0
        public static bool TypesChanged(List <Type> types)
        {
            if (MessageTypes.Count != types.Count)
            {
                return(true);
            }

            foreach (var type in types)
            {
                if (MessageTypes.GetTypeId(type) == 0u)
                {
                    return(true);
                }
            }

            Dictionary <Type, uint> typeToMessageId = null;

            try
            {
                var fieldInfo = typeof(GeneratedMessageTypes).GetField("TypeToMessageId", BindingFlags.Static | BindingFlags.NonPublic);
                typeToMessageId = (Dictionary <Type, uint>)fieldInfo.GetValue(null);
            }
            catch
            {
                // Don't care
            }

            if (typeToMessageId != null)
            {
                foreach (var kvp in typeToMessageId)
                {
                    if (!types.Contains(kvp.Key))
                    {
                        return(true);
                    }
                }
            }
            else
            {
                return(types.Count > 0);
            }

            return(false);
        }