Example #1
0
        private BinaryStruct CheckExist(Type type, int initialSize = 32)
        {
            if (!TypeCacheMap.ContainsKey(type) || !TypeCacheMap[type].ContainsKey(""))
            {
                TypeCacheMap.TryAdd(type, new ConcurrentDictionary <string, BinaryStruct>());
                LoadType(type, initialSize);
            }

            return(TypeCacheMap[type][""]);
        }
Example #2
0
        internal BinaryStruct AppendPreCompile(StructBuilder builder)
        {
            if (!TypeCacheMap.ContainsKey(builder.CurrentType))
            {
                TypeCacheMap.TryAdd(builder.CurrentType, new ConcurrentDictionary <string, BinaryStruct>());
            }
            else
            {
                TypeCacheMap[builder.CurrentType].Clear();
            }
            TypeCacheMap[builder.CurrentType].TryAdd("", builder.CurrentStruct);

            return(builder.CurrentStruct);
        }