Blaze.Server.TdfDecoder.ReadLabel C# (CSharp) Méthode

ReadLabel() private méthode

Decodes a tag to a label.
private ReadLabel ( ) : string
Résultat string
        private string ReadLabel()
        {
            // by Pedro Martins
            string label = "";
            uint tag = 0;

            // get tag bytes
            byte[] tagBytes = new byte[3];
            _stream.Read(tagBytes, 0, 3);

            // resize tag byte array (add an empty byte)
            Array.Resize(ref tagBytes, 4);

            // read tag value (as uint32) from tag byte array
            tag = BitConverter.ToUInt32(tagBytes, 0);

            // convert to little endian
            tag = Utils.SwapBytes(tag) >> 8;

            // convert tag to label
            label += Convert.ToChar((((tag >> 18) & 0x3F) & 0x1F) | 64);
            label += Convert.ToChar((((tag >> 12) & 0x3F) & 0x1F) | 64);
            label += Convert.ToChar((((tag >> 6) & 0x3F) & 0x1F) | 64);
            label += Convert.ToChar(((tag & 0x3F) & 0x1F) | 64);

            // clean label
            label = Regex.Replace(label, "[^A-Z]+", "");

            return label;
        }