Beispiel #1
0
        public Type GetPlatformType(NonPlatformType type, string format)
        {
            foreach (PlatformTypeDescription platformTypeDescription in platformTypesList)
            {
                if ((platformTypeDescription.Type == type) && (platformTypeDescription.Format == format))
                {
                    return(platformTypeDescription.PlatformType);
                }
            }

            throw new InvalidOperationException("Platfrom type is not found.");
        }
        public static List <ClassDescription> AdaptToClassDecriptionList(JSONFileStructure jsonFileStructure)
        {
            TypesStorage typesStorage = TypesStorage.Instance();

            List <ClassDescription> classDescriptions = new List <ClassDescription>();

            foreach (ClassStructure classStructure in jsonFileStructure.ClassDescriptions)
            {
                ClassDescription classDescription = new ClassDescription(classStructure.ClassName);

                foreach (PropertyInfo propertyInfo in classStructure.Properties)
                {
                    NonPlatformType propertyNonPlatformType = typesStorage.NonPlatformTypesMappingDictionary[propertyInfo.Type];
                    Type            propertyType            = typesStorage.GetPlatformType(propertyNonPlatformType, propertyInfo.Format);
                    classDescription.PropertyDescriptions.Add(new PropertyDescription(propertyInfo.Name, propertyType));
                }

                classDescriptions.Add(classDescription);
            }

            return(classDescriptions);
        }
 internal PlatformTypeDescription(NonPlatformType type, string format, Type platformType)
 {
     Type         = type;
     Format       = format;
     PlatformType = platformType;
 }