예제 #1
0
        public void ListStarSystemDesignations()
        {
            ProgressionMap map = new ProgressionMap("Local");

            LocalSectorMap c      = new LocalSectorMap(map);
            Sector         sector = c.CreateLocalSector();

            string outfile = Path.Combine(TestingUtilities.Config["DataPath"], "Designations.txt");

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

            using (StreamWriter writer = new StreamWriter(outfile))
            {
                foreach (var system in map.StarSystems)
                {
                    writer.Write(system.Key);
                    writer.Write(" : ");
                    writer.Write(system.Value.Name);
                    writer.Write(" : ");
                    if (system.Value.BasicProperties.ContainsKey(Constants.PropertyNames.Designation))
                    {
                        writer.Write(system.Value.BasicProperties[Constants.PropertyNames.Designation]);
                    }
                    else
                    {
                        writer.Write("None");
                    }
                    writer.WriteLine();
                }
            }
        }
예제 #2
0
        public void CreateSolClusterTest()
        {
            ProgressionMap map = new ProgressionMap("Sol Cluster");

            LocalSectorMap csol       = new LocalSectorMap(map);
            Cluster        solCluster = csol.CreateSolCluster();
        }
예제 #3
0
        public void CreateLocalSector()
        {
            ProgressionMap map = new ProgressionMap("Local Sector");

            LocalSectorMap c      = new LocalSectorMap(map);
            Sector         sector = c.CreateLocalSector();
        }
예제 #4
0
        public void CreateEarthTest()
        {
            ProgressionMap map = new ProgressionMap("Earth");

            LocalSectorMap csol  = new LocalSectorMap(map);
            Planet         earth = csol.CreateEarth();
        }
예제 #5
0
        public void CreateSolTest()
        {
            ProgressionMap map = new ProgressionMap("Sol");

            LocalSectorMap csol = new LocalSectorMap(map);
            StarSystem     sol  = csol.CreateSolSystem();
        }
        public void ERBridgeEqualTest()
        {
            ProgressionMap map = new ProgressionMap("Local Sector");
            LocalSectorMap c   = new LocalSectorMap(map);

            c.CreateLocalSector();

            ERBridge bridge1 = map.Bridges.Values.First();

            StarSystem system1 = map.Get <StarSystem>(bridge1.Portals[0].StarIdentifier);
            StarSystem system2 = map.Get <StarSystem>(bridge1.Portals[1].StarIdentifier);
            ERBridge   bridge2 = new ERBridge(bridge1.BridgeType, system1, system2);

            // ok force them equal because of identifiers lol
            bridge2.ParentIdentifier = bridge1.ParentIdentifier;
            bridge2.Identifier       = bridge1.Identifier;
            bridge2.Portals[0].ERBridgeIdentifier = bridge1.Portals[0].ERBridgeIdentifier;
            bridge2.Portals[1].ERBridgeIdentifier = bridge1.Portals[1].ERBridgeIdentifier;

            if (bridge1.BasicProperties.ContainsKey(Constants.PropertyNames.Distance))
            {
                bridge2.BasicProperties.Add(Constants.PropertyNames.Distance, bridge1.BasicProperties[Constants.PropertyNames.Distance]);
            }

            Assert.IsTrue(ERBridgeEqualityComparer.Comparer.Equals(bridge1, bridge2));
        }
예제 #7
0
        public void GetBridgeDistances()
        {
            ProgressionMap map = new ProgressionMap("Local Sector");
            LocalSectorMap c   = new LocalSectorMap(map);

            c.CreateLocalSector();

            var bridges = map.Bridges.Values.Where(b => b.BridgeType == ProgressionConstants.BridgeTypes.StarSystem);

            string bridgeFile = Path.Combine(TestingUtilities.Config["DataPath"], "bridges.txt");

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

            using (StreamWriter sw = new StreamWriter(bridgeFile))
            {
                foreach (ERBridge bridge in bridges)
                {
                    if (double.TryParse(bridge.BasicProperties[StellarMap.Core.Types.Constants.PropertyNames.Distance], out var distance))
                    {
                        distance = distance * 3.261633;
                        sw.Write(bridge.Name);
                        sw.Write(":");
                        sw.WriteLine(distance.ToString());
                    }
                }
            }
        }
        public void LocalSectorEqualTest()
        {
            ProgressionMap map = new ProgressionMap("Local Sector");
            LocalSectorMap c   = new LocalSectorMap(map);

            c.CreateLocalSector();

            ProgressionMap map2 = new ProgressionMap("Local Sector");
            LocalSectorMap c2   = new LocalSectorMap(map2);

            c2.CreateLocalSector();

            Assert.IsTrue(ProgressionMapEqualityComparer.Comparer.Equals(map, map2));
        }
예제 #9
0
        public void SerializeFileSolCluster()
        {
            ProgressionMap map = new ProgressionMap("Sol Cluster");
            LocalSectorMap c   = new LocalSectorMap(map);

            c.CreateSolCluster();

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

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

            using StreamWriter writer = new StreamWriter(filename);
            SerializeMap(map, writer);
        }
        public void LocalSectorNotEqualTest()
        {
            ProgressionMap map = new ProgressionMap("Local Sector");
            LocalSectorMap c   = new LocalSectorMap(map);

            c.CreateLocalSector();

            ProgressionMap map2 = new ProgressionMap("Local Sector");
            LocalSectorMap c2   = new LocalSectorMap(map2);

            c2.CreateLocalSector();
            var solCluster = map2.Clusters.Values.Where(x => x.Name == "Sol Cluster").First();

            Assert.IsNotNull(solCluster);
            solCluster.Name = "New Sol";

            Assert.IsFalse(ProgressionMapEqualityComparer.Comparer.Equals(map, map2));
        }
        public void HabitatNotEqualTest()
        {
            ProgressionMap map = new ProgressionMap("Local Sector");
            LocalSectorMap c   = new LocalSectorMap(map);

            c.CreateLocalSector();

            Habitat habitat1 = map.Habitats.Values.First();

            Habitat habitat2 = new Habitat();

            habitat2.BodyType         = ProgressionConstants.BodyType.Cluster;
            habitat2.Identifier       = habitat1.Identifier;
            habitat2.Name             = habitat1.Name;
            habitat2.ParentIdentifier = habitat1.ParentIdentifier;
            //habitat2.Properties = habitat1.Properties;

            Assert.IsFalse(StellarBodyEqualityComparer.Comparer.Equals(habitat1, habitat2));
        }
예제 #12
0
        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);
        }
예제 #13
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);
        }
        public void ERBridgeNotEqualTest()
        {
            ProgressionMap map = new ProgressionMap("Local Sector");
            LocalSectorMap c   = new LocalSectorMap(map);

            c.CreateLocalSector();

            ERBridge bridge1 = map.Bridges.Values.First();

            StarSystem system1 = map.Get <StarSystem>(bridge1.Portals[0].StarIdentifier);
            StarSystem system2 = map.Get <StarSystem>(bridge1.Portals[1].StarIdentifier);
            ERBridge   bridge2 = new ERBridge(bridge1.BridgeType, system1, system2);

            // ok force them equal because of identifiers lol
            bridge2.ParentIdentifier = bridge1.ParentIdentifier;
            bridge2.Identifier       = bridge1.Identifier;
            bridge2.Portals[0].ERBridgeIdentifier = bridge1.Portals[0].ERBridgeIdentifier;
            // except Portal 2 bridge identifier
            //bridge2.Portals[1].ERBridgeIdentifier = bridge1.Portals[1].ERBridgeIdentifier;

            Assert.IsFalse(ERBridgeEqualityComparer.Comparer.Equals(bridge1, bridge2));
        }