Пример #1
0
        public void RegisterTypeWithSerialUid(Type type)
        {
            long uid = SerializationUidUtils.GetUid(type);

            if (!this.uidByType.ContainsKey(uid))
            {
                this.uidByType.Add(uid, type);
            }
            else
            {
                Type objA = this.uidByType[uid];
                if (!ReferenceEquals(objA, type))
                {
                    throw new TypeWithSameUidAlreadyRegisteredException(uid, objA, type);
                }
            }
        }
Пример #2
0
        public void Register(Type templateClass)
        {
            if (templateClass.IsDefined(typeof(TemplatePart), true))
            {
                throw new CannotRegisterTemplatePartAsTemplateException(templateClass);
            }
            long uid = SerializationUidUtils.GetUid(templateClass);

            if (!this.templates.ContainsKey(new long?(uid)))
            {
                foreach (Type type in this.GetParentTemplateClasses(templateClass))
                {
                    this.Register(type);
                }
                TemplateDescriptionImpl impl = new TemplateDescriptionImpl(this, uid, templateClass);
                impl.AddComponentInfoFromClass(templateClass);
                this.templates[new long?(uid)] = impl;
            }
        }
Пример #3
0
 public long GetUidByType(Type cl) =>
 SerializationUidUtils.GetUid(cl);
Пример #4
0
        public TemplateDescription GetTemplateInfo(Type templateClass)
        {
            long uid = SerializationUidUtils.GetUid(templateClass);

            return(this.GetTemplateInfo(uid));
        }