private byte _k; // Do not rename (binary serialization) private static unsafe int HexsToChars(char *guidChars, int a, int b) { guidChars[0] = HexConverter.ToCharLower(a >> 4); guidChars[1] = HexConverter.ToCharLower(a); guidChars[2] = HexConverter.ToCharLower(b >> 4); guidChars[3] = HexConverter.ToCharLower(b); return(4); }
private static unsafe int HexsToCharsHexOutput(char *guidChars, int a, int b) { guidChars[0] = '0'; guidChars[1] = 'x'; guidChars[2] = HexConverter.ToCharLower(a >> 4); guidChars[3] = HexConverter.ToCharLower(a); guidChars[4] = ','; guidChars[5] = '0'; guidChars[6] = 'x'; guidChars[7] = HexConverter.ToCharLower(b >> 4); guidChars[8] = HexConverter.ToCharLower(b); return(9); }
private void LoadHeader(Span <byte> buffer, out int indexOffset, out int dataOffset) { // tzdata files are expected to start with the form of "tzdata2012f\0" depending on the year of the tzdata used which is 2012 in this example // since we're not differentiating on year, check for tzdata and the ending \0 var tz = (ushort)TZif_ToInt16(buffer.Slice(0, 2)); var data = (uint)TZif_ToInt32(buffer.Slice(2, 4)); if (tz != 0x747A || data != 0x64617461 || buffer[11] != 0) { // 0x747A 0x64617461 = {0x74, 0x7A} {0x64, 0x61, 0x74, 0x61} = "tz" "data" var b = new StringBuilder(buffer.Length); for (int i = 0; i < 12; ++i) { b.Append(' ').Append(HexConverter.ToCharLower(buffer[i])); } throw new InvalidOperationException(SR.Format(SR.InvalidOperation_BadTZHeader, TimeZoneFileName, b.ToString())); } indexOffset = TZif_ToInt32(buffer.Slice(12, 4)); dataOffset = TZif_ToInt32(buffer.Slice(16, 4)); }