Esempio n. 1
0
        public override void LoadFromJson(Json.JSObject obj)
        {
            // It should be an array:
            Json.JSIndexedArray arr = obj as Json.JSIndexedArray;

            if (arr == null)
            {
                return;
            }

            // For each one..
            for (int i = 0; i < arr.length; i++)
            {
                // Add it as a cookie:
                Add(new Cookie(arr[i].ToString()));
            }
        }
Esempio n. 2
0
        public override Json.JSObject ToJson()
        {
            // Create array:
            Json.JSIndexedArray arr = new Json.JSIndexedArray();

            // Add each cookie:
            foreach (KeyValuePair <string, Cookie> kvp in CookieSet)
            {
                // Get the cookie:
                Cookie cookie = kvp.Value;

                if (cookie.SessionOnly)
                {
                    continue;
                }

                arr.push(new Json.JSValue(cookie.ToString()));
            }

            return(arr);
        }