Example #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);
            }
        }
Example #2
0
 public CachedContent(CachedContentSet set, string path)
 {
     SavedAt = DateTime.Now;
     Set     = set;
     Path    = path;
     Changed = true;
 }
Example #3
0
 public CachedContent(CachedContentSet set, string path, JSObject obj)
 {
     Set  = set;
     Path = path;
     LoadFromJson(obj);
 }