Exemplo n.º 1
0
        public RattlerStoreLoader(RattlerCore core) : base(core)
        {
            this.store = core.store;

            JsonConvert.DefaultSettings = () => new JsonSerializerSettings {
                Converters = new List <JsonConverter> {
                    new TransportJsonConverter(core),
                    new StationJsonConverter(),
                    new LinkJsonConverter(core),
                    new StoreJsonConverter(core)
                }
            };
        }
Exemplo n.º 2
0
        public void loadData()
        {
            string path   = ABSOLUTHE_PATH + SETTINGS_FILE_NAME;
            bool   exists = File.Exists(path);

            string rawJson;

            if (!exists)
            {
                File.Create(path).Close();
                rawJson = "{}";
                File.WriteAllText(path, rawJson);
            }
            else
            {
                rawJson = File.ReadAllText(path);
            }

            RattlerStore loaded = JsonConvert.DeserializeObject <RattlerStore>(rawJson);

            //demoData();
        }