示例#1
0
		public static void Export(string version, IObjectContainer db, Stream stream)
		{
			var export = new JsonExportHolder
			{
				Version = version,
				EndStats = db.Query<EndOfGameStats>().ToList(),
				Players = db.Query<PlayerEntry>().ToList(),
			};
			ActivateList(db, export.EndStats);
			ActivateList(db, export.Players);

			var serializer = new JsonSerializer();
			serializer.TypeNameHandling = TypeNameHandling.Auto;
			using (var json = new JsonTextWriter(new StreamWriter(stream)))
			{
				json.Formatting = Formatting.Indented;
				serializer.Serialize(json, export);
			}
		}
示例#2
0
        public static void Export(string version, IObjectContainer db, Stream stream)
        {
            var export = new JsonExportHolder
            {
                Version  = version,
                EndStats = db.Query <EndOfGameStats>().ToList(),
                Players  = db.Query <PlayerEntry>().ToList(),
            };

            ActivateList(db, export.EndStats);
            ActivateList(db, export.Players);

            var serializer = new JsonSerializer();

            serializer.TypeNameHandling = TypeNameHandling.Auto;
            using (var json = new JsonTextWriter(new StreamWriter(stream)))
            {
                json.Formatting = Formatting.Indented;
                serializer.Serialize(json, export);
            }
        }