public Util.LinkedList <byte> Serialize() { Util.LinkedList <byte> bytes = new Util.LinkedList <byte>(); bytes.Append(BitConverter.GetBytes((int)Type)); foreach (CelestialBodyType type in Enum.GetValues(typeof(CelestialBodyType))) { bytes.Append(BitConverter.GetBytes(Address[type])); } bytes.Prepend(BitConverter.GetBytes(bytes.Length + 4)); return(bytes); }
private void SaveMap() { Util.LinkedList <byte> linkedList = Map.Serialize(); linkedList.Append(Network.Serialize()); byte[] bytes = new byte[linkedList.Length]; int i = 0; foreach (byte b in linkedList) { bytes[i++] = b; } System.IO.File.WriteAllBytes("MapInfo.dat", bytes); }
private void DelaunayTest() { MapGenerator.ProgressTracker.Initialize(); MapGenerator.Containers.Container Map = new MapGenerator.Containers.SolarSystem(new CelestialBodyIdentifier(CelestialBodyType.SolarSystem), 1216466133, true); Map.Initialize(); MapGenerator.EuclideanGraph.EuclideanGraph <MapGenerator.Containers.Container> graph = new MapGenerator.EuclideanGraph.EuclideanGraph <MapGenerator.Containers.Container>(); Util.LinkedList <MapGenerator.Containers.Container> smallBodies = Map.GetAllSmallBodies(); foreach (MapGenerator.Containers.Container body in smallBodies) { graph.AddNode(body); } graph.GenerateDelaunayTriangulation(); }
public Util.LinkedList <byte> Serialize() { Util.LinkedList <byte> bytes = new Util.LinkedList <byte>(); bytes.Append(BitConverter.GetBytes(Edges.Count)); foreach (CelestialBodies.CelestialBody[] edge in Edges) { bytes.Append(edge[0].ID.Serialize()); bytes.Append(edge[1].ID.Serialize()); } bytes.Prepend(BitConverter.GetBytes(bytes.Length + 4)); return(bytes); }