コード例 #1
0
        public static PropertyBitmapPickerItem ParsePropertyBitmapPickerItem(JsonObject data)
        {
            List <PropertyMetadataItem> metadata = null;

            if (data.ContainsKey("Metadata"))
            {
                metadata = PropertyMetadataItem.ParsePropertyMetadataItemList(data["Metadata"].GetArray());
            }
            string thumbnail = null;

            if (data.ContainsKey("Thumbnail"))
            {
                thumbnail = data["Thumbnail"].GetString();
            }
            else
            {
                thumbnail = data["Path"].GetString();
            }
            Size?assetSize = null;

            if (data.ContainsKey("Size"))
            {
                assetSize = data["Size"].GetObject().GetSize();
            }
            return(new PropertyBitmapPickerItem(data["Id"].GetString(), data["Caption"].GetString(), data["Path"].GetString(), assetSize, thumbnail, metadata));
        }
コード例 #2
0
        public static PropertyListItem ParsePropertyListItem(JsonObject data)
        {
            List <PropertyMetadataItem> metadata = null;

            if (data.ContainsKey("Metadata"))
            {
                metadata = PropertyMetadataItem.ParsePropertyMetadataItemList(data["Metadata"].GetArray());
            }
            return(new PropertyListItem(data["Id"].GetString(), data["Caption"].GetString(), metadata));
        }
コード例 #3
0
        public static PropertyString ParsePropertyString(JsonObject data)
        {
            string value = data["Value"].GetString();
            bool   isVisibleInProductEditor      = bool.Parse(data["IsVisibleInProductEditor"].GetString());
            bool   isVisibleInMyLights           = bool.Parse(data["IsVisibleInMyLights"].GetString());
            List <PropertyMetadataItem> metadata = null;

            if (data.ContainsKey("Metadata"))
            {
                metadata = PropertyMetadataItem.ParsePropertyMetadataItemList(data["Metadata"].GetArray());
            }
            return(new PropertyString(data["Id"].GetString(), data["Caption"].GetString(), value, isVisibleInProductEditor, isVisibleInMyLights, metadata));
        }
コード例 #4
0
        public static PropertyList ParsePropertyList(JsonObject data)
        {
            List <PropertyListItem> listItems    = PropertyListItem.ParsePropertyListItemList(data["ListItems"].GetArray());
            string                      valueId  = data["Value"].GetString();
            PropertyListItem            selected = listItems.FirstOrDefault((a) => a.Id == valueId);
            bool                        isVisibleInProductEditor = bool.Parse(data["IsVisibleInProductEditor"].GetString());
            bool                        isVisibleInMyLights      = bool.Parse(data["IsVisibleInMyLights"].GetString());
            List <PropertyMetadataItem> metadata = null;

            if (data.ContainsKey("Metadata"))
            {
                metadata = PropertyMetadataItem.ParsePropertyMetadataItemList(data["Metadata"].GetArray());
            }
            return(new PropertyList(data["Id"].GetString(), data["Caption"].GetString(), selected, listItems, isVisibleInProductEditor, isVisibleInMyLights, metadata));
        }
コード例 #5
0
        public static PropertyBitmapPicker ParsePropertyBitmapPicker(JsonObject data, Dictionary <string, List <PropertyBitmapPickerItem> > sharedBitmapLists)
        {
            string bitmapListId = data["Bitmaps"].GetString();
            var    bitmapItems  = sharedBitmapLists[bitmapListId];

            string valueId = data["Value"].GetString();
            PropertyBitmapPickerItem selected    = bitmapItems.FirstOrDefault((a) => a.Id == valueId);
            bool isVisibleInProductEditor        = bool.Parse(data["IsVisibleInProductEditor"].GetString());
            bool isVisibleInMyLights             = bool.Parse(data["IsVisibleInMyLights"].GetString());
            List <PropertyMetadataItem> metadata = null;

            if (data.ContainsKey("Metadata"))
            {
                metadata = PropertyMetadataItem.ParsePropertyMetadataItemList(data["Metadata"].GetArray());
            }
            return(new PropertyBitmapPicker(data["Id"].GetString(), data["Caption"].GetString(), selected, bitmapItems, isVisibleInProductEditor, isVisibleInMyLights, metadata));
        }
コード例 #6
0
ファイル: PropertyNumber.cs プロジェクト: quangvd3/VanArsdel
        public static PropertyNumber ParsePropertyNumber(JsonObject data)
        {
            double value       = double.Parse(data["Value"].GetString());
            double smallChange = double.Parse(data["SmallChange"].GetString());
            double largeChange = double.Parse(data["LargeChange"].GetString());
            double min         = double.Parse(data["Min"].GetString());
            double max         = double.Parse(data["Max"].GetString());
            double stepValue   = double.Parse(data["StepValue"].GetString());
            bool   isVisibleInProductEditor      = bool.Parse(data["IsVisibleInProductEditor"].GetString());
            bool   isVisibleInMyLights           = bool.Parse(data["IsVisibleInMyLights"].GetString());
            List <PropertyMetadataItem> metadata = null;

            if (data.ContainsKey("Metadata"))
            {
                metadata = PropertyMetadataItem.ParsePropertyMetadataItemList(data["Metadata"].GetArray());
            }
            return(new PropertyNumber(data["Id"].GetString(), data["Caption"].GetString(), value, smallChange, largeChange, min, max, stepValue, isVisibleInProductEditor, isVisibleInMyLights, metadata));
        }
コード例 #7
0
        public static PropertyColorPalette ParsePropertyColorPalette(JsonObject data)
        {
            Color        value       = VanArsdel.Utils.ColorUtils.ParseColorString(data["Value"].GetString());
            Color        customColor = VanArsdel.Utils.ColorUtils.ParseColorString(data["CustomColor"].GetString());
            JsonArray    paletteData = data["Palette"].GetArray();
            List <Color> palette     = new List <Color>();

            foreach (var node in paletteData)
            {
                palette.Add(VanArsdel.Utils.ColorUtils.ParseColorString(node.GetString()));
            }

            bool isVisibleInProductEditor        = bool.Parse(data["IsVisibleInProductEditor"].GetString());
            bool isVisibleInMyLights             = bool.Parse(data["IsVisibleInMyLights"].GetString());
            List <PropertyMetadataItem> metadata = null;

            if (data.ContainsKey("Metadata"))
            {
                metadata = PropertyMetadataItem.ParsePropertyMetadataItemList(data["Metadata"].GetArray());
            }
            return(new PropertyColorPalette(data["Id"].GetString(), data["Caption"].GetString(), value, palette, customColor, isVisibleInProductEditor, isVisibleInMyLights, metadata));
        }