src/sys/dotnet/fan/sys/TimeZone.cs
/// <summary>
/// Load the name and file offset list from file into memory.
/// </summary>
Load the name and file offset list from file into memory.
Load the name and file offset list from file into memory .
static void loadIndex()
    {
      DataReader reader = new DataReader(new BufferedStream(dbFile.OpenRead()));
      try
      {
        long magic = reader.ReadLong();
        if (magic != 0x66616e747a203032L)
          throw new IOException("Invalid magic 0x" + magic.ToString("X").ToLower());
        reader.ReadUTF();
        int numPrefixes = reader.ReadByte();
        prefixes = new string[numPrefixes];
        for (int i=0; i<numPrefixes; ++i)
          prefixes[i] = reader.ReadUTF();
        int num = reader.ReadUnsignedShort();
        indexPrefixes = new byte[num];
        indexNames    = new string[num];
        indexOffsets  = new int[num];
        for (int i=0; i<num; ++i)
        {
          indexPrefixes[i] = reader.ReadByte();
          indexNames[i]    = reader.ReadUTF();
          indexOffsets[i]  = reader.ReadInt();
          if (i != 0 && String.Compare(indexNames[i-1], indexNames[i], StringComparison.Ordinal) >= 0)
            throw new IOException("Index not sorted");
        }
      }
      finally
      {
        reader.Close();
      }
    }
static void loadIndex ( ) { DataReader reader = new DataReader ( new BufferedStream ( dbFile . OpenRead ( ) ) ) ; try { long magic = reader . ReadLong ( ) ; if ( magic != 0x66616e747a203032L ) throw new IOException ( " " + magic . ToString ( " " ) . ToLower ( ) ) ; reader . ReadUTF ( ) ; int numPrefixes = reader . ReadByte ( ) ; prefixes = new string [ numPrefixes ] ; for ( int i = 0 ; i < numPrefixes ; ++ i ) prefixes [ i ] = reader . ReadUTF ( ) ; int num = reader . ReadUnsignedShort ( ) ; indexPrefixes = new byte [ num ] ; indexNames = new string [ num ] ; indexOffsets = new int [ num ] ; for ( int i = 0 ; i < num ; ++ i ) { indexPrefixes [ i ] = reader . ReadByte ( ) ; indexNames [ i ] = reader . ReadUTF ( ) ; indexOffsets [ i ] = reader . ReadInt ( ) ; if ( i != 0 && String . Compare ( indexNames [ i - 1 ] , indexNames [ i ] , StringComparison . Ordinal ) >= 0 ) throw new IOException ( " " ) ; } } finally { reader . Close ( ) ; } }
Load the name and file offset list from file into memory.
Load the name and file offset list from file into memory .
// check magic "fantz 02" // load prefixes // load the zones and verify in sort order