/// <summary> /// This handles the creation of the /// </summary> private void Initialize() { byte[] overviewHeader = new byte[176]; using (Stream str = GetStream()) { if (str == null) { return; } str.Read(overviewHeader, 0, 176); } byte[] bCount = new byte[4]; Array.Copy(overviewHeader, 8 + 32, bCount, 0, 4); if (!BitConverter.IsLittleEndian) { Array.Reverse(bCount); } int numGrids = BitConverter.ToInt32(bCount, 0); long offset = 176; for (int iGrid = 0; iGrid < numGrids; iGrid++) { string location = FileIsEmbedded ? ManifestResourceString : GridFilePath; NadTable sub = new GsbNadTable(location, offset, FileIsEmbedded, RequiresDecompression); sub.ReadHeader(); offset += 176 + sub.NumPhis * sub.NumLambdas * 16; SubGrids.Add(sub); } }
/// <summary> /// This method parses the extension of a resource location or /// path and creates the new NadTable type. /// </summary> /// <param name="location"></param> /// <param name="embedded"></param> /// <returns></returns> public static NadTable FromSourceName(string location, bool embedded) { NadTable result = null; string ext = Path.GetExtension(location).ToLower(); switch (ext) { case ".lla": result = new LlaNadTable(location, embedded); break; case ".gsb": result = new GsbNadTable(location, 0, embedded); break; case ".dat": result = new DatNadTable(location, embedded); break; case ".los": result = new LasLosNadTable(location, embedded); break; } if (result != null) { result.ReadHeader(); } return(result); }
/// <summary> /// This handles the creation of the /// </summary> private void Initialize() { byte[] overviewHeader = new byte[176]; using (Stream str = GetStream()) { if (str == null) return; str.Read(overviewHeader, 0, 176); } byte[] bCount = new byte[4]; Array.Copy(overviewHeader, 8 + 32, bCount, 0, 4); if (!BitConverter.IsLittleEndian) Array.Reverse(bCount); int numGrids = BitConverter.ToInt32(bCount, 0); long offset = 176; for (int iGrid = 0; iGrid < numGrids; iGrid++) { string location = FileIsEmbedded ? ManifestResourceString : GridFilePath; NadTable sub = new GsbNadTable(location, offset, FileIsEmbedded); sub.ReadHeader(); offset += 176 + sub.NumPhis * sub.NumLambdas * 16; SubGrids.Add(sub); } }
/// <summary> /// This method parses the extension of a resource location or /// path and creates the new NadTable type. /// </summary> /// <param name="location"></param> /// <param name="embedded"></param> /// <returns></returns> public static NadTable FromSourceName(string location, bool embedded) { NadTable result = null; string ext = Path.GetExtension(location).ToLower(); switch (ext) { case ".lla": result = new LlaNadTable(location, embedded); break; case ".gsb": result = new GsbNadTable(location, 0, embedded); break; case ".dat": result = new DatNadTable(location, embedded); break; case ".los": result = new LasLosNadTable(location, embedded); break; } if (result != null) result.ReadHeader(); return result; }