internal SelfUser WithState(CMsgClientPersonaState.Friend state, ClientPersonaStateFlag flag)
        {
            var before = (SelfUser)MemberwiseClone();

            if (flag.HasFlag(ClientPersonaStateFlag.Presence))
            {
                before._avatarHash = ImmutableArray.Create(state.avatar_hash);
                before._state      = (PersonaState)state.persona_state;
                before._stateFlags = (PersonaStateFlag)state.persona_state_flags;
            }

            if (flag.HasFlag(ClientPersonaStateFlag.PlayerName))
            {
                before._playerName = state.player_name;
            }

            if (flag.HasFlag(ClientPersonaStateFlag.LastSeen))
            {
                before._lastLogoff = DateTimeOffset.FromUnixTimeSeconds(state.last_logoff);
                before._lastLogon  = DateTimeOffset.FromUnixTimeSeconds(state.last_logon);
            }

            if (flag.HasFlag(ClientPersonaStateFlag.Status))
            {
                before._onlineSessionInstances = state.online_session_instances;
                before._publishedInstanceId    = state.published_instance_id;
            }

            if (flag.HasFlag(ClientPersonaStateFlag.QueryPort | ClientPersonaStateFlag.SourceID | ClientPersonaStateFlag.GameDataBlob | ClientPersonaStateFlag.GameExtraInfo))
            {
                before._game = GameInfo.Create(state);
            }

            return(before);
        }
Beispiel #2
0
        internal Clan WithPersonaState(CMsgClientPersonaState.Friend state, ClientPersonaStateFlag flag)
        {
            var before = (Clan)MemberwiseClone();

            if (flag.HasFlag(ClientPersonaStateFlag.PlayerName))
            {
                before._name = state.player_name;
            }

            if (flag.HasFlag(ClientPersonaStateFlag.Presence))
            {
                before._avatar = ImmutableArray.Create(state.avatar_hash);
            }

            if (flag.HasFlag(ClientPersonaStateFlag.ClanTag))
            {
                before._tag = state.clan_tag;
            }

            return(before);
        }