public Network(List <CelestialBodyIdentifier[]> edges, CelestialBodies.CelestialBody Map) { Edges = new List <CelestialBodies.CelestialBody[]>(); foreach (CelestialBodyIdentifier[] edge in edges) { CelestialBodies.CelestialBody body1 = Map.GetCelestialBody(edge[0]); CelestialBodies.CelestialBody body2 = Map.GetCelestialBody(edge[1]); Edges.Add(new CelestialBodies.CelestialBody[] { body1, body2 }); } }
public Network(byte[] bytes, int startIndex, CelestialBodies.CelestialBody Map) { Edges = new List <CelestialBodies.CelestialBody[]>(); int offset = 4; int numberOfEdges = BitConverter.ToInt32(bytes, startIndex + offset); offset += 4; for (int i = 0; i < numberOfEdges; i++) { CelestialBodyIdentifier id1 = new CelestialBodyIdentifier(bytes, startIndex + offset); offset += BitConverter.ToInt32(bytes, startIndex + offset); CelestialBodyIdentifier id2 = new CelestialBodyIdentifier(bytes, startIndex + offset); offset += BitConverter.ToInt32(bytes, startIndex + offset); CelestialBodies.CelestialBody body1 = Map.GetCelestialBody(id1); CelestialBodies.CelestialBody body2 = Map.GetCelestialBody(id2); Edges.Add(new CelestialBodies.CelestialBody[] { body1, body2 }); } }