Beispiel #1
0
        public bScoreFrame(SerializationReader sr)
        {
            //checksum = sr.ReadString();
            time         = sr.ReadInt32();
            id           = sr.ReadByte();
            count300     = sr.ReadUInt16();
            count100     = sr.ReadUInt16();
            count50      = sr.ReadUInt16();
            countGeki    = sr.ReadUInt16();
            countKatu    = sr.ReadUInt16();
            countMiss    = sr.ReadUInt16();
            totalScore   = sr.ReadInt32();
            maxCombo     = sr.ReadUInt16();
            currentCombo = sr.ReadUInt16();
            perfect      = sr.ReadBoolean();
            currentHp    = sr.ReadByte();
            tagByte      = sr.ReadByte();
            usingScoreV2 = sr.ReadBoolean();
            comboPortion = usingScoreV2 ? sr.ReadDouble() : 0;
            bonusPortion = usingScoreV2 ? sr.ReadDouble() : 0;

            if (currentHp == 254)
            {
                currentHp = 0;
                pass      = false;
            }
            else
            {
                pass = true;
            }
        }
Beispiel #2
0
        //public string checksum;

        public bScoreFrame(Stream s)
        {
            SerializationReader sr = new SerializationReader(s);

            //checksum = sr.ReadString();
            time         = sr.ReadInt32();
            id           = sr.ReadByte();
            count300     = sr.ReadUInt16();
            count100     = sr.ReadUInt16();
            count50      = sr.ReadUInt16();
            countGeki    = sr.ReadUInt16();
            countKatu    = sr.ReadUInt16();
            countMiss    = sr.ReadUInt16();
            totalScore   = sr.ReadInt32();
            maxCombo     = sr.ReadUInt16();
            currentCombo = sr.ReadUInt16();
            perfect      = sr.ReadBoolean();
            currentHp    = sr.ReadByte();
            if (currentHp == 254)
            {
                currentHp = 0;
                pass      = false;
            }
            else
            {
                pass = true;
            }
        }
Beispiel #3
0
        public static async Task Handle(Packet p, Presence pr)
        {
            var ms = new MemoryStream(p.Data);

            using var reader = new SerializationReader(ms);

            pr.Status = new ()
            {
                Status          = (ActionStatuses)reader.ReadByte(),
                StatusText      = reader.ReadString(),
                BeatmapChecksum = reader.ReadString(),
                CurrentMods     = (Mods)reader.ReadUInt32(),
                CurrentPlayMode = (PlayMode)reader.ReadByte(),
                BeatmapId       = reader.ReadInt32()
            };

            var lbMode = pr.Status.CurrentMods switch
            {
                var mod when(mod& Mods.Relax) > 0 => LeaderboardMode.Relax,
                _ => LeaderboardMode.Vanilla,
            };

            // We just want to update our stats from cache, so we don't
            // use context here
            await pr.GetOrUpdateUserStats(null, lbMode, false);

            await pr.UserStats();
        }
    }
        public bUserPresence(SerializationReader sr)
        {
            userId = sr.ReadInt32();
            if (userId < 0)
            {
                userId = -userId;
            }
            else
            {
                isOsu = userId != 0;
            }

            username = sr.ReadString();

            timezone    = sr.ReadByte() - 24;
            countryCode = sr.ReadByte();

            byte b = sr.ReadByte();

            permission = (Permissions)(b & ~0xe0);
            playMode   = (PlayModes)Math.Max((byte)0, Math.Min((byte)3, ((b & 0xe0) >> 5)));

            longitude = sr.ReadSingle();
            latitude  = sr.ReadSingle();
            rank      = sr.ReadInt32();
        }
        public static Color DeserializeColor(SerializationReader reader)
        {
            BitVector32 flags = reader.ReadOptimizedBitVector32();

            if (flags[ColorIsKnown])
            {
                return(Color.FromKnownColor((KnownColor)reader.ReadOptimizedInt32()));
            }
            else if (flags[ColorHasName])
            {
                return(Color.FromName(reader.ReadOptimizedString()));
            }
            else if (!flags[ColorHasValue])
            {
                return(Color.Empty);
            }
            else
            {
                byte red   = flags[ColorHasRed] ? reader.ReadByte() : (byte)0;
                byte green = flags[ColorHasGreen] ? reader.ReadByte() : (byte)0;
                byte blue  = flags[ColorHasBlue] ? reader.ReadByte() : (byte)0;
                byte alpha = flags[ColorHasAlpha] ? reader.ReadByte() : (byte)0;
                return(Color.FromArgb(alpha, red, green, blue));
            }
        }
Beispiel #6
0
        /// <summary>
        /// Parses presence.db file.
        /// </summary>
        /// <param name="stream">Stream containing presence.db data.</param>
        /// <returns>A usable <see cref="PresenceDatabase"/>.</returns>
        public static PresenceDatabase DecodePresence(Stream stream)
        {
            PresenceDatabase db = new PresenceDatabase();

            using (var r = new SerializationReader(stream))
            {
                db.OsuVersion = r.ReadInt32();
                int playersCount = r.ReadInt32();

                for (int i = 0; i < playersCount; i++)
                {
                    Player player = new Player();
                    player.UserId      = r.ReadInt32();
                    player.Username    = r.ReadString();
                    player.Timezone    = r.ReadByte() - 24;
                    player.CountryCode = r.ReadByte();
                    byte b = r.ReadByte();
                    player.Permissions    = (Permissions)(b & ~0xe0);
                    player.Ruleset        = (Ruleset)Math.Max(0, Math.Min(3, ((b & 0xe0) >> 5)));
                    player.Longitude      = r.ReadSingle();
                    player.Latitude       = r.ReadSingle();
                    player.Rank           = r.ReadInt32();
                    player.LastUpdateTime = r.ReadDateTime();
                    db.Players.Add(player);
                }
            }

            return(db);
        }
Beispiel #7
0
        public void ReadFromStream(SerializationReader r)
        {
            UserId = r.ReadInt32();
            if (UserId < 0)
            {
                UserId = -UserId;
            }
            else
            {
                UsesOsuClient = UserId != 0;
            }

            Username    = r.ReadString();
            Timezone    = r.ReadByte() - 24;
            CountryCode = r.ReadByte();

            byte permissionPlaymodeBitfield = r.ReadByte();

            Permissions = (PlayerRank)(permissionPlaymodeBitfield & 0b00011111);
            PlayMode    = (byte)((permissionPlaymodeBitfield & 0b11100000) >> 5);

            Longitude = r.ReadSingle();
            Latitude  = r.ReadSingle();
            Rank      = r.ReadInt32();
        }
Beispiel #8
0
        public bUserStats(Stream s, bool forceFull)
        {
            SerializationReader sr = new SerializationReader(s);

            userId = sr.ReadInt32();

            Completeness comp = (Completeness)sr.ReadByte();

            completeness = forceFull ? Completeness.Full : comp;

            status = new bStatusUpdate(s);

            if (completeness > Completeness.StatusOnly)
            {
                rankedScore = sr.ReadInt64();
                accuracy    = sr.ReadSingle();
                playcount   = sr.ReadInt32();
                totalScore  = sr.ReadInt64();
                rank        = sr.ReadUInt16();
            }
            if (completeness == Completeness.Full)
            {
                username       = sr.ReadString();
                avatarFilename = sr.ReadString();
                timezone       = sr.ReadByte() - 24;
                location       = sr.ReadString();
            }
        }
Beispiel #9
0
 public void ReadFromStream(SerializationReader r)
 {
     ButtonState = (ButtonState)r.ReadByte();
     r.ReadByte();  //unused byte, always 0?
     MouseX = r.ReadSingle();
     MouseY = r.ReadSingle();
     Time   = r.ReadInt32();
 }
 public void Deserialize(SerializationReader reader)
 {
     Action = (BanchoAction)reader.ReadByte();
     Text   = reader.ReadString();
     MapMd5 = reader.ReadString();
     Mods   = (Mods)reader.ReadUInt32();
     Mode   = (GameMode)reader.ReadByte();
     MapId  = reader.ReadInt32();
 }
Beispiel #11
0
 public void ReadFromStream(SerializationReader r)
 {
     Action          = (BanchoAction)r.ReadByte();
     ActionText      = r.ReadString();
     BeatmapChecksum = r.ReadString();
     CurrentMods     = (Mods)r.ReadUInt32();
     PlayMode        = r.ReadByte();
     BeatmapId       = r.ReadInt32();
 }
        public bBeatmapInfo(Stream s)
        {
            SerializationReader sr = new SerializationReader(s);

            id           = sr.ReadInt16();
            beatmapId    = sr.ReadInt32();
            beatmapSetId = sr.ReadInt32();
            threadId     = sr.ReadInt32();
            ranked       = sr.ReadByte();
            playerRank   = (Rankings)sr.ReadByte();
            checksum     = sr.ReadString();
        }
Beispiel #13
0
 public bBeatmapInfo(SerializationReader sr)
 {
     id           = sr.ReadInt16();
     beatmapId    = sr.ReadInt32();
     beatmapSetId = sr.ReadInt32();
     threadId     = sr.ReadInt32();
     ranked       = sr.ReadByte();
     osuRank      = (Ranks)sr.ReadByte();
     fruitsRank   = (Ranks)sr.ReadByte();
     taikoRank    = (Ranks)sr.ReadByte();
     maniaRank    = (Ranks)sr.ReadByte();
     checksum     = sr.ReadString();
 }
Beispiel #14
0
 public void ReadFromStream(SerializationReader sr)
 {
     Id           = sr.ReadInt16();
     BeatmapId    = sr.ReadInt32();
     BeatmapSetId = sr.ReadInt32();
     ThreadId     = sr.ReadInt32();
     Ranked       = sr.ReadByte();
     RankStandard = sr.ReadByte();
     RankCtB      = sr.ReadByte();
     RankTaiko    = sr.ReadByte();
     RankMania    = sr.ReadByte();
     Checksum     = sr.ReadString();
 }
        public ReplayFrame(SerializationReader reader)
        {
            MouseButtonState = (pButtonState)reader.ReadByte();
            method_0(MouseButtonState);
            var b = reader.ReadByte();

            if (b > 0)
            {
                method_0(pButtonState.Right1);
            }
            MousePosX = reader.ReadSingle();
            MousePosY = reader.ReadSingle();
            Time      = reader.ReadInt32();
        }
        public static Color DeserializeColor(SerializationReader reader)
        {
            var flags = reader.ReadOptimizedBitVector32();

            if (flags[ColorIsKnown]) return Color.FromKnownColor((KnownColor) reader.ReadOptimizedInt32());
            if (flags[ColorHasName]) return Color.FromName(reader.ReadOptimizedString());
            if (!flags[ColorHasValue]) return Color.Empty;

            var red = flags[ColorHasRed] ? reader.ReadByte() : (byte) 0;
            var green = flags[ColorHasGreen] ? reader.ReadByte() : (byte) 0;
            var blue = flags[ColorHasBlue] ? reader.ReadByte() : (byte) 0;
            var alpha = flags[ColorHasAlpha] ? reader.ReadByte() : (byte) 0;

            return Color.FromArgb(alpha, red, green, blue);
        }
Beispiel #17
0
 public bStatusUpdate(SerializationReader sr)
 {
     status          = (bStatus)sr.ReadByte();
     statusText      = sr.ReadString();
     beatmapChecksum = sr.ReadString();
     if (OsuCommon.ProtocolVersion > 10)
     {
         currentMods = (Mods)sr.ReadUInt32();
     }
     else
     {
         currentMods = (Mods)sr.ReadInt16();
     }
     playMode  = (PlayModes)Math.Max((byte)0, Math.Min((byte)3, sr.ReadByte()));
     beatmapId = sr.ReadInt32();
 }
Beispiel #18
0
 public bUserStatus(SerializationReader reader)
 {
     status      = (bStatus)reader.ReadByte();
     beatmapHash = reader.ReadString();
     beatmap     = reader.ReadString();
     if (Bancho.Protocol > 10)
     {
         mods = (Mods)reader.ReadUInt32();
     }
     else
     {
         mods = (Mods)reader.ReadInt16();
     }
     playMode  = (PlayModes)Math.Max((byte)0, Math.Min((byte)3, reader.ReadByte()));
     beatmapId = reader.ReadInt32();
 }
Beispiel #19
0
        public void ReadFromStream(SerializationReader r)
        {
            OsuVersion        = r.ReadInt32();
            FolderCount       = r.ReadInt32();
            AccountUnlocked   = r.ReadBoolean();
            AccountUnlockDate = r.ReadDateTime();
            AccountName       = r.ReadString();

            Beatmaps = new List <BeatmapEntry>();
            int length = r.ReadInt32();

            for (int i = 0; i < length; i++)
            {
                int currentIndex = (int)r.BaseStream.Position;
                int entryLength  = r.ReadInt32();

                Beatmaps.Add(BeatmapEntry.ReadFromReader(r, false, OsuVersion));

                if (r.BaseStream.Position != currentIndex + entryLength + 4)
                {
                    Debug.Fail($"Length doesn't match, {r.BaseStream.Position} instead of expected {currentIndex + entryLength + 4}");
                }
            }
            AccountRank = (PlayerRank)r.ReadByte();
        }
Beispiel #20
0
        public bReplayFrame(SerializationReader sr)
        {
            buttonState = (pButtonState)sr.ReadByte();
            SetButtonStates(buttonState);

            byte bt = sr.ReadByte();

            if (bt > 0)//Handle Pre-Taiko compatible replays.
            {
                SetButtonStates(pButtonState.Right1);
            }

            mouseX = sr.ReadSingle();
            mouseY = sr.ReadSingle();
            time   = sr.ReadInt32();
        }
Beispiel #21
0
            public LegacyReplayFrame(SerializationReader sr)
            {
                ButtonState = (LegacyButtonState)sr.ReadByte();
                SetButtonStates(ButtonState);

                byte bt = sr.ReadByte();

                if (bt > 0)//Handle Pre-Taiko compatible replays.
                {
                    SetButtonStates(LegacyButtonState.Right1);
                }

                MouseX = sr.ReadSingle();
                MouseY = sr.ReadSingle();
                Time   = sr.ReadInt32();
            }
Beispiel #22
0
        public void ReadFromStream(SerializationReader r)
        {
            Type = (PacketType)r.ReadInt16();
            r.ReadByte();
            int length = r.ReadInt32();

            Data = r.ReadBytes(length);
        }
Beispiel #23
0
        public void ReadFromStream(SerializationReader r)
        {
            PlayerId    = r.ReadInt32();
            PlayerName  = r.ReadString();
            UtcOffset   = r.ReadByte();
            CountryByte = r.ReadByte();   //TODO: create Country enum

            byte b = r.ReadByte();

            PlayerRank = (PlayerRank)(b & 0b0001_1111);
            GameMode   = (GameMode)((b & 0b1110_0000) >> 5);
            Debug.Assert((byte)GameMode <= 3, $"GameMode is byte {(byte)GameMode}, should be between 0 and 3");

            Longitude  = r.ReadSingle();
            Latitude   = r.ReadSingle();
            GlobalRank = r.ReadInt32();
            LastUpdate = r.ReadDateTime();
        }
Beispiel #24
0
        public static async Task <Match> ReadMatch(this SerializationReader reader)
        {
            var match = new Match();

            reader.ReadInt16(); // match id
            reader.ReadByte();  // in progress

            match.Type       = (MatchTypes)reader.ReadByte();
            match.ActiveMods = (Mods)reader.ReadInt32();

            match.GameName     = reader.ReadString();
            match.GamePassword = reader.ReadString();

            reader.ReadString(); // beatmap name

            match.BeatmapId       = reader.ReadInt32();
            match.BeatmapChecksum = reader.ReadString();

            match.Beatmap = (await BeatmapManager.Get(match.BeatmapChecksum)).Item2;

            foreach (var slot in match.Slots)
            {
                slot.Status = (SlotStatus)reader.ReadByte();
            }

            foreach (var slot in match.Slots)
            {
                slot.Team = (SlotTeams)reader.ReadByte();
            }

            foreach (var slot in match.Slots)
            {
                if ((slot.Status & SlotStatus.HasPlayer) > 0)
                {
                    reader.ReadInt32();
                }
            }

            match.Host = PresenceManager.GetPresenceById(reader.ReadInt32());

            match.PlayMode    = (PlayMode)reader.ReadByte();
            match.ScoringType = (MatchScoringTypes)reader.ReadByte();
            match.TeamType    = (MatchTeamTypes)reader.ReadByte();
            match.FreeMods    = reader.ReadBoolean();

            if (match.FreeMods)
            {
                foreach (var slot in match.Slots)
                {
                    slot.Mods = (Mods)reader.ReadInt32();
                }
            }

            match.Seed = reader.ReadInt32();

            return(match);
        }
Beispiel #25
0
 public void ReadFromStream(SerializationReader r)
 {
     Time         = r.ReadInt32();
     Id           = r.ReadByte();
     Count300     = r.ReadUInt16();
     Count100     = r.ReadUInt16();
     Count50      = r.ReadUInt16();
     CountGeki    = r.ReadUInt16();
     CountKatu    = r.ReadUInt16();
     CountMiss    = r.ReadUInt16();
     TotalScore   = r.ReadInt32();
     MaxCombo     = r.ReadUInt16();
     CurrentCombo = r.ReadUInt16();
     Perfect      = r.ReadBoolean();
     CurrentHp    = r.ReadByte();
     TagByte      = r.ReadByte();
     UsingScoreV2 = r.ReadBoolean();
     ComboPortion = UsingScoreV2 ? r.ReadDouble() : 0;
     BonusPortion = UsingScoreV2 ? r.ReadDouble() : 0;
 }
Beispiel #26
0
        public bMatch(Stream s)
        {
            SerializationReader sr = new SerializationReader(s);

            matchId         = sr.ReadByte();
            inProgress      = sr.ReadBoolean();
            matchType       = (MatchType)sr.ReadByte();
            activeMods      = (Mods)sr.ReadInt16();
            gameName        = sr.ReadString();
            beatmapName     = sr.ReadString();
            beatmapId       = sr.ReadInt32();
            beatmapChecksum = sr.ReadString();
            for (int i = 0; i < slotCount; i++)
            {
                slotStatus[i] = (SlotStatus)sr.ReadByte();
            }

            for (int i = 0; i < slotCount; i++)
            {
                slotId[i] = (slotStatus[i] & SlotStatus.CompHasPlayer) > 0 ? sr.ReadInt32() : -1;
            }
        }
Beispiel #27
0
        public bUserInfo(SerializationReader r)
        {
            ID = r.ReadInt32();
            if (ID < 0)
            {
                ID = -ID;
            }
            else
            {
                IsValidId = (ID != 0);
            }
            Name      = r.ReadString();
            TimeZone  = r.ReadByte() - 24;
            CountryID = r.ReadByte();
            var b = r.ReadByte();

            Tags       = ((UserTags)b & (UserTags)(-225));
            PlayMode   = (PlayModes)Math.Max(0, Math.Min(3, (b & 224) >> 5));
            Longitude  = r.ReadSingle();
            Latitude   = r.ReadSingle();
            GlobalRank = r.ReadInt32();
        }
Beispiel #28
0
        public bStatusUpdate(Stream s)
        {
            SerializationReader sr = new SerializationReader(s);

            status        = (bStatus)sr.ReadByte();
            beatmapUpdate = sr.ReadBoolean();

            if (beatmapUpdate)
            {
                statusText      = sr.ReadString();
                beatmapChecksum = sr.ReadString();
                currentMods     = (Mods)sr.ReadUInt16();
            }
        }
Beispiel #29
0
        public bMatch(SerializationReader sr)
        {
            SendPassword = false;

            matchId         = sr.ReadUInt16();
            inProgress      = sr.ReadBoolean();
            matchType       = (MatchTypes)sr.ReadByte();
            activeMods      = (Mods)sr.ReadUInt32();
            gameName        = sr.ReadString();
            gamePassword    = sr.ReadString();
            beatmapName     = sr.ReadString();
            beatmapId       = sr.ReadInt32();
            beatmapChecksum = sr.ReadString();

            for (int i = 0; i < MAX_PLAYERS; i++)
            {
                slotStatus[i] = (SlotStatus)sr.ReadByte();
            }

            for (int i = 0; i < MAX_PLAYERS; i++)
            {
                slotTeam[i] = (SlotTeams)sr.ReadByte();
            }

            for (int i = 0; i < MAX_PLAYERS; i++)
            {
                slotId[i] = (slotStatus[i] & SlotStatus.HasPlayer) > 0 ? sr.ReadInt32() : -1;
            }

            hostId = sr.ReadInt32();

            playMode = (PlayModes)sr.ReadByte();

            matchScoringType = (MatchScoringTypes)sr.ReadByte();
            matchTeamType    = (MatchTeamTypes)sr.ReadByte();

            specialModes = (MultiSpecialModes)sr.ReadByte();

            if (gameName.Length > 50)
            {
                gameName = gameName.Remove(50);
            }

            if ((specialModes & MultiSpecialModes.FreeMod) > 0)
            {
                for (int i = 0; i < MAX_PLAYERS; i++)
                {
                    slotMods[i] = (Mods)sr.ReadInt32();
                }
            }
            Seed = sr.ReadInt32();
        }
Beispiel #30
0
        public void ReadFromStream(SerializationReader sr)
        {
            if (BeatmapDatabase.Version < 5)
            {
                sr.ReadByte();
            }

            if (sr.ReadBoolean()) //has score
            {
                HighScore = new Score();
                HighScore.ReadFromStream(sr);
            }

            Playcount = sr.ReadUInt16();
        }
 public bScoreData(SerializationReader reader)
 {
     int_1    = reader.ReadInt32();
     byte_0   = reader.ReadByte();
     ushort_1 = reader.ReadUInt16();
     ushort_0 = reader.ReadUInt16();
     ushort_2 = reader.ReadUInt16();
     ushort_3 = reader.ReadUInt16();
     ushort_4 = reader.ReadUInt16();
     ushort_5 = reader.ReadUInt16();
     int_2    = reader.ReadInt32();
     ushort_7 = reader.ReadUInt16();
     ushort_6 = reader.ReadUInt16();
     bool_1   = reader.ReadBoolean();
     int_0    = reader.ReadByte();
     int_3    = reader.ReadByte();
     if (int_0 == 254)
     {
         int_0  = 0;
         bool_0 = false;
         return;
     }
     bool_0 = true;
 }
Beispiel #32
0
        public Exceptional Deserialize(Byte[] mySerializedData, IIntegrityCheck myIntegrityCheckAlgorithm, ISymmetricEncryption myEncryptionAlgorithm, Boolean myIgnoreIntegrityCheckFailures)
        {
            #region Data

            Byte[] IntegrityCheckValue;
            int IntegrityCheckValue_Length;
            Int64 IntegrityCheckValue_Position;
            Byte[] actualIntegrityCheckValue;

            Byte[] EncryptionParameters;
            int EncryptionParameters_Length;

            int DataPadding_Length;
            int AdditionalPadding_Length = 0;

            #endregion

            #region Check if data is larger than the minimum allowed size

            if (mySerializedData == null)
                throw new GraphFSException_InvalidInformationHeader("The information header is invalid!");

            if (mySerializedData.Length < 8)
                throw new GraphFSException_InvalidInformationHeader("The information header is invalid!");

            #endregion

            try
            {

                #region Init reader

                var _SerializationReader = new SerializationReader(mySerializedData);

                #endregion

                #region Read HeaderVersion

                var _NewHeaderVersion = _SerializationReader.ReadByte();

                #endregion

                #region Read Length of the Integrity Check Value

                // Multiply the value of the first byte with 8
                IntegrityCheckValue_Length = _SerializationReader.ReadByte() << 3;

                if (IntegrityCheckValue_Length > mySerializedData.Length - HeaderLength)
                    throw new GraphFSException_InvalidIntegrityCheckLengthField("The length of the integrity check value is invalid!");

                // HACK: Remeber that a IntegrityCheckValue of 0 will circumvent the whole integrity checking!
                if (myIntegrityCheckAlgorithm != null)
                    if ((IntegrityCheckValue_Length > 0) && (IntegrityCheckValue_Length != myIntegrityCheckAlgorithm.HashSize))
                        throw new GraphFSException_InvalidIntegrityCheckLengthField("The length of the integrity check value is " + IntegrityCheckValue_Length + ", but " + myIntegrityCheckAlgorithm.HashSize + " was expected!");

                #endregion

                #region Read Length of the Encryption Parameters

                // Multiply the value of the second byte with 8
                EncryptionParameters_Length = _SerializationReader.ReadByte() << 3;

                if (EncryptionParameters_Length > mySerializedData.Length - HeaderLength - IntegrityCheckValue_Length)
                    throw new GraphFSException_InvalidEncryptionParametersLengthField("The length of the encryption parameters is invalid!");

                #endregion

                #region Read Padding lengths

                DataPadding_Length = (Int32)_SerializationReader.ReadByte();
                AdditionalPadding_Length = (Int32)(256 * _SerializationReader.ReadByte() + _SerializationReader.ReadByte()) << 3;

                if ((HeaderLength + IntegrityCheckValue_Length + EncryptionParameters_Length + AdditionalPadding_Length) >= mySerializedData.Length)
                    throw new GraphFSException_InvalidAdditionalPaddingLengthField("The length of the additional padding is invalid!");

                _SerializationReader.ReadBytesDirect(2);  // Read reserved bytes

                #endregion

                #region Read Integrity Check Value and Encryption Parameters

                IntegrityCheckValue_Position = _SerializationReader.BaseStream.Position;

                if (IntegrityCheckValue_Length > 0)
                    IntegrityCheckValue = _SerializationReader.ReadBytesDirect(IntegrityCheckValue_Length);

                if (EncryptionParameters_Length > 0)
                    EncryptionParameters = _SerializationReader.ReadBytesDirect(EncryptionParameters_Length);

                #endregion

                #region Verify the integrity of the data

                if (myIntegrityCheckAlgorithm != null && IntegrityCheckValue_Length > 0)
                {

                    // Save the read IntegrityCheckValue
                    IntegrityCheckValue = new Byte[IntegrityCheckValue_Length];
                    Array.Copy(mySerializedData, IntegrityCheckValue_Position, IntegrityCheckValue, 0, IntegrityCheckValue_Length);

                    // Zero the IntegrityCheckValue within the serialized data
                    Byte[] AllZeros = new Byte[IntegrityCheckValue_Length];
                    Array.Copy(AllZeros, 0, mySerializedData, IntegrityCheckValue_Position, IntegrityCheckValue_Length);

                    // Calculate the actual IntegrityCheckValue
                    actualIntegrityCheckValue = myIntegrityCheckAlgorithm.GetHashValueAsByteArray(mySerializedData);

                    // Compare read and actual IntegrityCheckValue
                    if (IntegrityCheckValue.CompareByteArray(actualIntegrityCheckValue) != 0 && myIgnoreIntegrityCheckFailures == false)
                        throw new GraphFSException_IntegrityCheckFailed(String.Concat("The IntegrityCheck failed as ", actualIntegrityCheckValue.ToHexString(), " is not equal to the expected ", IntegrityCheckValue.ToHexString()));

                }

                #endregion

                #region Decrypt the remaining data

                //EncryptedData_Length      = (UInt64) (mySerializedData.Length - (HeaderLength + IntegrityCheckValue_Length + EncryptionParameters_Length + AdditionalPadding_Length));
                //EncryptedData             = new Byte[EncryptedData_Length];
                //Array.Copy(mySerializedData, HeaderLength + IntegrityCheckValue_Length + EncryptionParameters_Length, EncryptedData, 0, (Int64) EncryptedData_Length);

                //#endregion

                //#region Decrypt Data

                // Decrypt Data, sooon...!

                //if ( (UInt64) DataPadding_Length >= EncryptedData_Length)
                //    throw new GraphFSException_InvalidDataPaddingLengthField("The length of the data padding is invalid!");

                //DecryptedData = new Byte[EncryptedData_Length - (UInt64) DataPadding_Length];
                //Array.Copy(EncryptedData, 0, DecryptedData, 0, (Int64) (EncryptedData_Length - (UInt64) DataPadding_Length));

                #endregion

                #region Deserialize Inner Object

                _StructureVersion = BitConverter.ToUInt16(_SerializationReader.ReadBytesDirect(2), 0);
                ObjectUUID = new ObjectUUID();
                ObjectUUID.Deserialize(ref _SerializationReader); // n or at least 16 Bytes

                Deserialize(ref _SerializationReader);

                #endregion

            }

            catch (GraphFSException_IntegrityCheckFailed e)
            {
                throw new GraphFSException_IntegrityCheckFailed("The AGraphStructure could not be deserialized as its integrity is corrupted!\n\n" + e);
            }

            catch (Exception e)
            {
                throw new GraphFSException_AGraphStructureCouldNotBeDeserialized("The AGraphStructure could not be deserialized!\n\n" + e);
            }

            _SerializedAGraphStructure = mySerializedData;

            return new Exceptional();
        }