예제 #1
0
        private void ParseVideoElement(XElement video)
        {
            //Parse the raw data into a InstancePlayState object
            UserStateManager.InstancePlayState playerData = new UserStateManager.InstancePlayState();
            if (!playerData.Parse(video))
            {
                return;
            }

            //Notify state update to existing data if any
            bool isInList = false;

            for (int i = 0; i < PlayerStates.Count; i++)
            {
                if (PlayerStates[i].PlayerName == playerData.PlayerName)
                {
                    isInList = true;
                    PlayerStates[i].OnStateRetrieved(playerData.CurrentState);
                    break;
                }
            }

            //No existing player with that name => add it to list
            if (!isInList)
            {
                PlayerStates.Add(playerData);
                //Forced state change after we just added it, since the state is the same as when it was parsed
                playerData.OnStateRetrieved(playerData.CurrentState, true);
            }

            //Add player to the active list
            ActivePlayerNames.Add(playerData.PlayerName);
        }
예제 #2
0
        private void ParseVideoElement(XElement video)
        {
            //Parse the raw data into a InstancePlayState object
            UserStateManager.InstancePlayState playerData = new UserStateManager.InstancePlayState();
            if (!playerData.Parse(video)) return;

            //Notify state update to existing data if any
            bool isInList = false;
            for (int i = 0; i < PlayerStates.Count; i++) {
                if (PlayerStates[i].PlayerName == playerData.PlayerName) {
                    isInList = true;
                    PlayerStates[i].OnStateRetrieved(playerData.CurrentState, playerData.Type);
                    break;
                }
            }

            //No existing player with that name => add it to list
            if (!isInList)
            {
                PlayerStates.Add(playerData);
                //Forced state change after we just added it, since the state is the same as when it was parsed
                playerData.OnStateRetrieved(playerData.CurrentState, playerData.Type, true);
            }

            //Add player to the active list
            ActivePlayerNames.Add(playerData.PlayerName);
        }