Example #1
0
        public void ZipRetrieveSolarSystem()
        {
            string filename = Path.Combine(TestingUtilities.Config["DataPath"], "SolarSystem.zip");

            if (!File.Exists(filename))
            {
                ZipStoreSolarSystem();
            }

            IStellarMap map;
            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.ZipStorage);

            using StreamReader reader = new StreamReader(filename);
            map = store.Retreive <BaseStellarMap>(reader);

#pragma warning disable S125
            //// now serialize it to json file to inspect
            //filename = Path.Combine(TestingUtilities.Config["DataPath"], "SolarSystem from zip.json");

            //if (File.Exists(filename))
            //    File.Delete(filename);

            //store = MapStorageFactory.GetStorage(MapStorageFactory.JsonStorage);

            //using StreamWriter writer = new StreamWriter(filename);
            //store.Store(map, writer);
#pragma warning restore S125

            IStellarMap generatedMap = SolarSystem.CreateSolSystem();

            Assert.IsTrue(BaseStellarMapEqualityComparer.Comparer.Equals(map as BaseStellarMap, generatedMap as BaseStellarMap));
        }
        public void ZipRetrieveLocalSector()
        {
            string filename = Path.Combine(TestingUtilities.Config["DataPath"], "LocalSector.zip");

            if (!File.Exists(filename))
            {
                ZipStoreLocalSector();
            }

            IStellarMap map;
            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.ZipStorage);

            using StreamReader reader = new StreamReader(filename);
            map = store.Retreive <ProgressionMap>(reader);

            // now serialize it to json file to inspect
            filename = Path.Combine(TestingUtilities.Config["DataPath"], "LocalSectorCheck.json");

            if (File.Exists(filename))
            {
                File.Delete(filename);
            }

            store = MapStorageFactory.GetStorage(MapStorageFactory.JsonStorage);

            using StreamWriter writer = new StreamWriter(filename);
            store.Store(map, writer);
        }
Example #3
0
        public static void JsonRetrieveLocalSector()
        {
            string filename = Path.Combine(dataDir, "LocalSector.json");

            IStellarMap map;
            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.JsonStorage);

            using StreamReader reader = new StreamReader(filename);
            map = store.Retreive <ProgressionMap>(reader);

            Console.WriteLine(map.ToString());
        }
Example #4
0
        public static void RetrieveSolarSystem()
        {
            string filename = Path.Combine(dataDir, "SolarSystem.json");

            IStellarMap map;
            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.JsonStorage);

            using StreamReader reader = new StreamReader(filename);
            map = store.Retreive <BaseStellarMap>(reader);

            Console.WriteLine(map.ToString());
        }
        public void JsonRetrieveSolarSystem()
        {
            string filename = Path.Combine(TestingUtilities.Config["DataPath"], "LocalSector.json");

            if (!File.Exists(filename))
            {
                JsonStoreLocalSector();
            }

            IStellarMap map;
            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.JsonStorage);

            using StreamReader reader = new StreamReader(filename);
            map = store.Retreive <ProgressionMap>(reader);
        }
Example #6
0
        public void ZipStoreSolarSystem()
        {
            IStellarMap map = SolarSystem.CreateSolSystem();

            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.ZipStorage);

            string filename = Path.Combine(TestingUtilities.Config["DataPath"], "SolarSystem.zip");

            if (File.Exists(filename))
            {
                File.Delete(filename);
            }

            using StreamWriter writer = new StreamWriter(filename);
            store.Store(map, writer);
        }
Example #7
0
        public static void StoreSolarSystem()
        {
            IStellarMap map = new BaseStellarMap("SolarSystem");

            PhysicalSolarSystemCreator.CreateSolarSystem(map);

            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.JsonStorage);

            string filename = Path.Combine(dataDir, "SolarSystem.json");

            if (File.Exists(filename))
            {
                File.Delete(filename);
            }

            using StreamWriter writer = new StreamWriter(filename);
            store.Store(map, writer);
        }
Example #8
0
        public void JsonRetrieveSolarSystem()
        {
            string filename = Path.Combine(TestingUtilities.Config["DataPath"], "SolarSystem.json");

            if (!File.Exists(filename))
            {
                JsonStoreSolarSystem();
            }

            IStellarMap map;
            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.JsonStorage);

            using StreamReader reader = new StreamReader(filename);
            map = store.Retreive <BaseStellarMap>(reader);

            IStellarMap generatedMap = SolarSystem.CreateSolSystem();

            Assert.IsTrue(BaseStellarMapEqualityComparer.Comparer.Equals(map as BaseStellarMap, generatedMap as BaseStellarMap));
        }
        public void ZipStoreLocalSector()
        {
            ProgressionMap localsector = new ProgressionMap("Local Sector");

            LocalSectorMap create = new LocalSectorMap(localsector);

            create.CreateLocalSector();

            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.ZipStorage);

            string filename = Path.Combine(TestingUtilities.Config["DataPath"], "LocalSector.zip");

            if (File.Exists(filename))
            {
                File.Delete(filename);
            }

            using StreamWriter writer = new StreamWriter(filename);
            store.Store(localsector, writer);
        }
Example #10
0
        public static void JsonGenerateLocalSector()
        {
            ProgressionMap localsector = new ProgressionMap("Local Sector");

            LocalSectorMap create = new LocalSectorMap(localsector);

            create.CreateLocalSector();

            IMapStorage store = MapStorageFactory.GetStorage(MapStorageFactory.JsonStorage);

            string filename = Path.Combine(dataDir, "LocalSector.json");

            if (File.Exists(filename))
            {
                File.Delete(filename);
            }

            using StreamWriter writer = new StreamWriter(filename);
            store.Store(localsector, writer);
        }