Пример #1
0
        public string GenerateJson()
        {
            string json = "";

            try{
                System.Web.Script.Serialization.JavaScriptSerializer oSerializer =
                    new System.Web.Script.Serialization.JavaScriptSerializer();

                oSerializer.RegisterConverters
                    (new System.Web.Script.Serialization.JavaScriptConverter[]
                {
                    new DeviceJavaScriptConverter(),
                    new PublishPropertyJavaScriptConverter(),
                    new IncludesJavaScriptConverter(),
                    new SkinJavaScriptConverter(),
                    new ConditionJavaScriptConverter()
                });
                string sJSON = oSerializer.Serialize(this);
                json = sJSON;
            }catch (Exception ex) {
                Logger.Error(ex.Message);
                return("");
            }

            DeviceJSonFormatter djf = new DeviceJSonFormatter();

            json = djf.Format(json);

            return(json);
        }
Пример #2
0
        public string GenerateJson()
        {
            string json ="";

            try{

                System.Web.Script.Serialization.JavaScriptSerializer oSerializer =
                     new System.Web.Script.Serialization.JavaScriptSerializer();

                oSerializer.RegisterConverters
                    (new System.Web.Script.Serialization.JavaScriptConverter[]
                     {
                        new DeviceJavaScriptConverter(),
                     	new PublishPropertyJavaScriptConverter(),
                        new IncludesJavaScriptConverter(),
                        new SkinJavaScriptConverter(),
                        new ConditionJavaScriptConverter()
                     });
                string sJSON = oSerializer.Serialize(this);
                json =  sJSON;

            }catch(Exception ex){
                Logger.Error(ex.Message);
                return "";
            }

            DeviceJSonFormatter djf= new DeviceJSonFormatter();
            json = djf.Format(json);

            return json;
        }