예제 #1
0
		public static void Import(GameStorage storage, Stream stream)
		{
			var serializer = new JsonSerializer();
			serializer.TypeNameHandling = TypeNameHandling.Auto;
			using (var json = new JsonTextReader(new StreamReader(stream)))
			{
				var export = serializer.Deserialize<JsonExportHolder>(json);

				foreach (var ply in export.Players)
					storage.RecordPlayer(ply, true);

				foreach (var end in export.EndStats)
					storage.RecordGame(end);

				storage.Commit();
			}
		}
예제 #2
0
        public static void Import(GameStorage storage, Stream stream)
        {
            var serializer = new JsonSerializer();

            serializer.TypeNameHandling = TypeNameHandling.Auto;
            using (var json = new JsonTextReader(new StreamReader(stream)))
            {
                var export = serializer.Deserialize <JsonExportHolder>(json);

                foreach (var ply in export.Players)
                {
                    storage.RecordPlayer(ply, true);
                }

                foreach (var end in export.EndStats)
                {
                    storage.RecordGame(end);
                }

                storage.Commit();
            }
        }