internal static JsonBase Parse(System.IO.TextReader json)
 {
     JsonCustomObject result = new JsonCustomObject();
     while (json.Peek() != '}')
     {
         char comma = (char)json.Read();
         System.Diagnostics.Debug.Assert(comma == ',' || comma == '{');
         string key = JsonString.Parse(json).Value;
         char c = (char)json.Read();
         System.Diagnostics.Debug.Assert(c == ':');
         result.Properties[key] = JsonBase.BaseParse(json);
     }
     char close = (char)json.Read();
     System.Diagnostics.Debug.Assert(close== '}');
     return result;
 }
Exemple #2
0
        protected override void OnPreRender(EventArgs e)
        {
            Page.ClientScript.RegisterClientScriptInclude("facebookConnect", "http://connect.facebook.net/en_US/all.js");
            JsonCustomObject obj = new JsonCustomObject();
            foreach (string key in Attributes.Keys)
            {
                obj.Properties.Add(key, new JsonString(Attributes[key]));
            }

            if (!string.IsNullOrEmpty(ApplicationName))
            {
                string apiKey = Configuration.ConfigurationSection.GetSection()[ApplicationName].ApiKey;
                obj.Properties.Add("apiKey", apiKey);
            }

            string json = obj.ToJsonString();
            string initString = "FB.init(" + json + ");";
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "fbinit", initString, true);
            base.OnPreRender(e);
        }