Ejemplo n.º 1
0
        public Environment Clone()
        {
            JsonSerializer js = JsonDefault.DefaultSerializer;
            MemoryStream   s  = new MemoryStream();

            new JsonMapSerializer(s).Save(this, js);
            s.Position = 0;
            Environment result = new JsonMapDeserializer(s).GetMap(js);

            s.Dispose();
            return(result);
        }
        public Environment Loading()
        {
            Loading loading = new Loading();

            if (ShowDialog(loading))
            {
                try
                {
                    Stream s = new FileStream(Game.SaveFilePath + @"\" +
                                              (string)loading.list.SelectedItem, FileMode.Open);
                    Environment result = new JsonMapDeserializer(s).GetMap();
                    s.Dispose();
                    return(result);
                }
                catch (IOException) { }
            }
            return(null);
        }