コード例 #1
0
        /// <summary>Loads the domain data from the given JSON string.</summary>
        public void LoadFromJson(string data)
        {
            if (string.IsNullOrEmpty(data))
            {
                return;
            }

            // Load the JSON:
            JSObject json = JSON.Parse(data);

            if (json == null)
            {
                return;
            }

            // Setup content and cookies:
            JSObject cookies = json["cookies"];

            if (cookies != null)
            {
                // Setup:
                Cookies = new CookieJar(this);
                Cookies.LoadFromJson(cookies);
            }

            // Content:
            JSObject content = json["files"];

            if (content != null)
            {
                // Setup:
                Content = new CachedContentSet(this);
                Content.LoadFromJson(content);
            }
        }