Exemplo n.º 1
0
        public static CodeProperty CreateFrom(DeviceObject deviceObject)
        {
            var codeProperty = new CodeProperty
            {
                Name = Helpers.ToPascalCase(deviceObject.Name),
                Type = CodeClass.GetObjectClassName(deviceObject)
            };

            return(codeProperty);
        }
Exemplo n.º 2
0
        public static CodeProperty CreateFrom(DeviceProperty deviceProperty)
        {
            var codeProperty = new CodeProperty
            {
                EndpointID = deviceProperty.ID,
                Name       = Helpers.ToPascalCase(Helpers.ReplaceIllegals(deviceProperty.Name)),
                Type       = Helpers.DataTypeToString(deviceProperty.Type),
                CanSet     = deviceProperty.Access.HasFlag(AccessMode.CanWrite)
            };

            return(codeProperty);
        }
Exemplo n.º 3
0
        public static CodeClass CreateFrom(DeviceObject deviceObject)
        {
            var codeClass = new CodeClass
            {
                ClassName = GetObjectClassName(deviceObject),
                FileName  = GetObjectClassName(deviceObject) + ".Generated.cs"
            };

            var deviceProperties = deviceObject.Members.Where(x => x is DeviceProperty || x is DeviceObject).ToList();

            codeClass.Functions        = deviceObject.Members.Where(x => x is DeviceFunction).Select(x => CodeFunction.CreateFrom((DeviceFunction)x)).ToList();
            codeClass.ScalarProperties = deviceProperties.Where(x => x.Type != DataType.Object).Select(x => CodeProperty.CreateFrom((DeviceProperty)x)).ToList();
            codeClass.ObjectProperties = deviceProperties.Where(x => x.Type == DataType.Object).Select(x => CodeProperty.CreateFrom((DeviceObject)x)).ToList();

            return(codeClass);
        }