public static Portal GetPortal(int portalId) { PortalCluster Cluster = PortalList.Find(delegate(PortalCluster lCluster) { if (lCluster.PortalList.ContainsKey(portalId)) { return(true); } return(false); }); return(Cluster[portalId]); }
public static void Load(string fileName) { if (PortalList.Count > 0) { return; } using (Stream s = File.OpenRead(fileName)) { using (BitReader read = new BitReader(s)) { int count = read.ReadInt(); for (int i = 0; i < count; i++) { PortalCluster Cluster = new PortalCluster(); Cluster.Count = read.ReadInt(); for (int h = 0; h < Cluster.Count; h++) { Portal portal = new Portal(); portal.PortalId = read.ReadInt(); for (int j = 0; j < portal.uInts1.Length; j++) { portal.uInts1[j] = read.ReadInt(); } portal.MapId = read.ReadInt(); for (int j = 0; j < portal.uInts2.Length; j++) { portal.uInts2[j] = read.ReadInt(); } Cluster.Add(portal); } PortalList.Add(Cluster); } } } Console.WriteLine("[PortalDB] Loaded {0} portals", PortalList.Count); }
public static void Load(string fileName) { if (PortalList.Count > 0) return; using (Stream s = File.OpenRead(fileName)) { using (BitReader read = new BitReader(s)) { int count = read.ReadInt(); for (int i = 0; i < count; i++) { PortalCluster Cluster = new PortalCluster(); Cluster.Count = read.ReadInt(); for (int h = 0; h < Cluster.Count; h++) { Portal portal = new Portal(); portal.PortalId = read.ReadInt(); for (int j = 0; j < portal.uInts1.Length; j++) portal.uInts1[j] = read.ReadInt(); portal.MapId = read.ReadInt(); for (int j = 0; j < portal.uInts2.Length; j++) portal.uInts2[j] = read.ReadInt(); Cluster.Add(portal); } PortalList.Add(Cluster); } } } Console.WriteLine("[PortalDB] Loaded {0} portals", PortalList.Count); }