public static WrappedUser Decode(string userData, string[] roles)
        {
            var parsedData = userData.Split('|');

            int userId;
            if (parsedData.Length != 3 || !int.TryParse(parsedData[(int)UserDataItem.UserId], out userId))
                throw new InvalidOperationException("Attempted to get User, but data is corrupted.");

            var wrappedUser = new WrappedUser(userId, parsedData[(int)UserDataItem.FriendlyName], parsedData[(int)UserDataItem.Email], roles);

            return wrappedUser;
        }
Пример #2
0
        public static WrappedUser Decode(string userData, string[] roles)
        {
            var parsedData = userData.Split('|');

            int userId;

            if (parsedData.Length != 3 || !int.TryParse(parsedData[(int)UserDataItem.UserId], out userId))
            {
                throw new InvalidOperationException("Attempted to get User, but data is corrupted.");
            }

            var wrappedUser = new WrappedUser(userId, parsedData[(int)UserDataItem.FriendlyName], parsedData[(int)UserDataItem.Email], roles);

            return(wrappedUser);
        }