Ejemplo n.º 1
0
        public void Write(IAmeSession session, Stream stream)
        {
            // TODO open dialog asking user to save the map files before closing
            AmeSessionJson json = new AmeSessionJson(session);

            JsonSerializer serializer = new JsonSerializer();

            serializer.Formatting        = Formatting.Indented;
            serializer.NullValueHandling = NullValueHandling.Ignore;
            using (StreamWriter streamWriter = new StreamWriter(stream))
                using (JsonWriter jsonWriter = new JsonTextWriter(streamWriter))
                {
                    serializer.Serialize(jsonWriter, json);
                }
        }
Ejemplo n.º 2
0
        public IAmeSession Read(string file)
        {
            AmeSessionJson json = JsonConvert.DeserializeObject <AmeSessionJson>(File.ReadAllText(file));

            return(json.Generate());
        }