Exemplo n.º 1
0
        public static LoginItemSettings FromObject(object obj)
        {
            if (obj == null)
            {
                return(null);
            }
            JsonObject json = new JsonObject(obj);

            return(new LoginItemSettings()
            {
                options = new JsonObject(json["options"]),
                openAtLogin = json.Bool("openAtLogin"),
                openAsHidden = json.Bool("openAsHidden"),
                wasOpenedAtLogin = json.Bool("wasOpenedAtLogin"),
                wasOpenedAsHidden = json.Bool("wasOpenedAsHidden"),
                restoreState = json.Bool("restoreState")
            });
        }
Exemplo n.º 2
0
        public static Cookie FromObject(object obj)
        {
            if (obj == null)
            {
                return(null);
            }
            JsonObject json = new JsonObject(obj);

            return(new Cookie()
            {
                name = json.String("name"),
                value = json.String("value"),
                domain = json.String("domain"),
                hostOnly = json.Bool("hostOnly"),
                path = json.String("path"),
                secure = json.Bool("secure"),
                httpOnly = json.Bool("httpOnly"),
                session = json.Bool("session"),
                expirationDate = json.Double("expirationDate")
            });
        }
Exemplo n.º 3
0
        public static PrinterInfo FromObject(object obj)
        {
            if (obj == null)
            {
                return(null);
            }
            JsonObject json = new JsonObject(obj);

            return(new PrinterInfo()
            {
                name = json.String("name"),
                description = json.String("description"),
                status = json.Int32("status"),
                isDefault = json.Bool("isDefault")
            });
        }
Exemplo n.º 4
0
        public static Product FromObject(object obj)
        {
            if (obj == null)
            {
                return(null);
            }
            JsonObject json = new JsonObject(obj);

            return(new Product()
            {
                productIdentifier = json.String("productIdentifier"),
                localizedDescription = json.String("localizedDescription"),
                localizedTitle = json.String("localizedTitle"),
                contentVersion = json.String("contentVersion"),
                contentLengths = Array.ConvertAll(
                    json["contentLengths"] as object[],
                    value => Convert.ToInt32(value)
                    ),
                price = json.Int32("price"),
                formattedPrice = json.String("formattedPrice"),
                downloadable = json.Bool("downloadable")
            });
        }