internal SecureString GetIV(string specified4B = "QC39")
 => ($"{ScreenName.Substring(0, 2)}{ScreenName.Substring(ScreenName.Length - 1 - 2, 2)}"
     + $"{AccountID.ToString().Substring(0, 3)}{AccountID.ToString().Substring(AccountID.ToString().Length - 1 - 3, 3)}"
     + $"{new string(specified4B.ToCharArray().Select(c => (char) (c >> 1)).ToArray())}"
     + @"Q#C_3*9"
     + $"{ProfileImageUrl.Substring(ProfileImageUrl.Length - 1 - 5, 5)}"
     + @"P!z2a@").ToSecureString();
示例#2
0
        public IEnumerable <UserDto> GetNonFriends(long userId, string query, int pageNumber, int pageSize = PaginExtension.DefaultPageSize,
                                                   bool orderByFirstName = false, bool orderByLastName = false, bool orderByAge = false, bool orderAscending = true)
        {
            var userFriends = _context.Set <Relation>().Where(u => u.UserOneId == userId || u.UserTwoId == userId)
                              .Select(u => u.UserOneId == userId ? u.UserTwoId : u.UserOneId);

            var nonFriends = _context.Set <User>().Where(u => !userFriends.Contains(u.Id) &&
                                                         u.Id != userId && (!string.IsNullOrEmpty(query) ? (u.FirstName.Contains(query) || u.LastName.Contains(query)) : true))
                             .Select(u => new UserDto
            {
                Id              = u.Id,
                FirstName       = u.FirstName,
                LastName        = u.LastName,
                BirthDate       = u.BirthDate,
                ProfileImageUrl = ProfileImageUrl.GetProfileImageUrl(u.Id)
            });

            if (orderAscending)
            {
                if (orderByAge)
                {
                    nonFriends = nonFriends.OrderBy(x => x.BirthDate);
                }
                else if (orderByFirstName)
                {
                    nonFriends = nonFriends.OrderBy(x => x.FirstName);
                }
                else if (orderByLastName)
                {
                    nonFriends = nonFriends.OrderBy(x => x.LastName);
                }
            }
            else
            {
                if (orderByAge)
                {
                    nonFriends = nonFriends.OrderByDescending(x => x.BirthDate);
                }
                else if (orderByFirstName)
                {
                    nonFriends = nonFriends.OrderByDescending(x => x.FirstName);
                }
                else if (orderByLastName)
                {
                    nonFriends = nonFriends.OrderByDescending(x => x.LastName);
                }
            }

            return(nonFriends.Page(pageNumber, pageSize).ToList());
        }
示例#3
0
        public MappingProfile()
        {
            CreateMap <User, UserDto>().ForMember(u => u.ProfileImageUrl, x => x.MapFrom(src => ProfileImageUrl.GetProfileImageUrl(src.Id)));
            CreateMap <User, LoginDto>();
            CreateMap <CreateUserDto, User>();

            CreateMap <NewMessageDto, Message>();
            CreateMap <Message, MessageDto>();
        }