示例#1
0
        public string Serialize()
        {
            this.DDPSpecVersion = "1.2.1";

            string json = JsonConvert.SerializeObject(
                this,
                Formatting.Indented,
                jss_defaults
                );

            // TODO: Catch exceptions for serialization function
            // TODO: Check for valid filename and path

            Dictionary <String, String> d_OldIDToNew = new Dictionary <string, string>();

            json = ProcessJSON.CrawlJSONDictionary(json,
                                                   new ParseSettings()
            {
                b_FixIDs = true, b_ManipulateMode = true, operation = Operation.SERIALIZE
            },
                                                   d_OldIDToNew);
            json = ProcessJSON.RedirectRefs(json, d_OldIDToNew);

            return(json);
        }
示例#2
0
        public static DesignModel Deserialize(string json)
        {
            string json_processed = ProcessJSON.CrawlJSONDictionary(json,
                                                                    new ParseSettings()
            {
                b_FixIDs = true, b_ManipulateMode = true, operation = Operation.DESERIALIZE
            });

            DesignModel rtn = JsonConvert.DeserializeObject(json_processed,
                                                            typeof(DesignModel),
                                                            jss_defaults)
                              as DesignModel;

            return(rtn);
        }