Пример #1
0
        public void CommunityId_Equeal()
        {
            var idA = new CommunityId(123456);
            var idB = new CommunityId("co123456");

            Assert.AreEqual(idA, idB);
        }
Пример #2
0
        public async ValueTask <IPlaylist> Create(PlaylistId playlistId)
        {
            CommunityId communityId   = playlistId.Id;
            var         communityInfo = await _communityProvider.GetCommunityInfo(communityId);

            Guard.IsTrue(communityInfo.IsOK, nameof(communityInfo.IsOK));
            return(new CommunityVideoPlaylist(communityId, playlistId, communityInfo.Community.Name, _communityProvider));
        }
Пример #3
0
        public void CommunityId_ToNiconicoId()
        {
            var        idA = new CommunityId(123456);
            NiconicoId idB = new CommunityId("co123456");

            Assert.AreEqual(NiconicoIdType.Community, idB.IdType);
            Assert.AreEqual(idA, idB);
        }
Пример #4
0
        public override int GetHashCode()
        {
            var hashCode = 944434587;

            hashCode = hashCode * -1521134295 + CommunityId.GetHashCode();
            hashCode = hashCode * -1521134295 + DistrictId.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

            return(hashCode);
        }
        public string GetCommunityLevelFileNameSuffix()
        {
            var leafDir = InternalCommunityPath;

            if (!string.IsNullOrWhiteSpace(CommunityId) && !CommunityId.Equals(InternalCommunityId))
            {
                leafDir = CommunityId;
            }
            return(GetCommunityLevelFileNameSuffix(leafDir));
        }
Пример #6
0
        public override int GetHashCode()
        {
            var hashCode = -699461029;

            hashCode = hashCode * -1521134295 + AddressId.GetHashCode();
            hashCode = hashCode * -1521134295 + CommunityId.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Location);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Zip);

            return(hashCode);
        }
Пример #7
0
        public override byte[] GetData()
        {
            var nameAsBytes = Encoding.UTF8.GetBytes(Name);

            var data = new byte[16 + 16 + Address.Length + nameAsBytes.Length];

            Buffer.BlockCopy(Id.ToOrderByteArray(), 0, data, 0, 16);
            Buffer.BlockCopy(CommunityId.ToOrderByteArray(), 0, data, 16, 16);
            Buffer.BlockCopy(Address, 0, data, 32, Address.Length);
            Buffer.BlockCopy(nameAsBytes, 0, data, 32 + Address.Length, nameAsBytes.Length);

            return(data);
        }
Пример #8
0
        public async Task <(CommunityVideoResponse, CommunityVideoListItemsResponse)> GetCommunityVideoAsync(
            CommunityId communityId,
            int?offset,
            int?limit,
            CommunityVideoSortKey?sortKey,
            CommunityVideoSortOrder?sortOrder
            )
        {
            var listRes = await _niconicoSession.ToolkitContext.Community.GetCommunityVideoListAsync(communityId, offset, limit, sortKey, sortOrder);

            if (!listRes.IsSuccess)
            {
                return(listRes, null);
            }

            var itemsRes = await _niconicoSession.ToolkitContext.Community.GetCommunityVideoListItemsAsync(listRes.Data.Contents.Select(x => x.ContentId));

            return(listRes, itemsRes);
        }
Пример #9
0
 protected virtual void ToString(StringBuilder sb)
 {
     sb.AppendFormat(
         "{0}: job title: '{1}', job title expression: '{2}', location: '{3}', salary: {4}, exclude no salary: {5}, community id: '{6}', sort order: {7}, reverse sort order: {8}, include synonyms: {9}, has resume: {10}, is activated: {11}, is contactable {12}, keywords expression: '{13}', industry ids: {14}, recency: {15}, keywords: '{16}', company keywords expression: '{17}', company keywords: '{18}', education keywords expression: {19}, education keywords: {20}, jobs to search: {21}, companies to search: {22}, include relocating: {23}, include international: {24}, ideal job types: '{25}', candidate flags: '{26}', ethnic flags: '{27}', visa status flags: '{28}', desired job title: {29}, in folder: {30}, is flagged: {31}, has notes: {32}, has viewed: {33}, is unlocked: {34}, include similiar names: {35}, name: {36}.",
         GetType().Name,
         JobTitle,
         JobTitleExpression == null ? null : JobTitleExpression.GetRawExpression(),
         Location,
         Salary,
         ExcludeNoSalary,
         CommunityId == null ? string.Empty : CommunityId.ToString(),
         SortCriteria.SortOrder,
         SortCriteria.ReverseSortOrder,
         IncludeSynonyms,
         HasResume,
         IsActivated,
         IsContactable,
         KeywordsExpression == null ? null : KeywordsExpression.GetRawExpression(),
         IndustryIds == null ? null : string.Join(", ", (from i in IndustryIds select i.ToString()).ToArray()),
         Recency,
         GetKeywords(),
         CompanyKeywordsExpression == null ? null : CompanyKeywordsExpression.GetRawExpression(),
         CompanyKeywords,
         EducationKeywordsExpression == null ? null : EducationKeywordsExpression.GetUserExpression(),
         EducationKeywords,
         JobTitlesToSearch,
         CompaniesToSearch,
         IncludeRelocating,
         IncludeInternational,
         JobTypes,
         CandidateStatusFlags,
         EthnicStatus,
         VisaStatusFlags,
         DesiredJobTitleExpression == null ? null : DesiredJobTitleExpression.GetUserExpression(),
         InFolder,
         IsFlagged,
         HasNotes,
         HasViewed,
         IsUnlocked,
         IncludeSimilarNames,
         Name);
 }
Пример #10
0
        public override byte[] GetData()
        {
            var choices = new List <byte[]>();

            foreach (var choice in Choices ?? Array.Empty <Choice>())
            {
                choices.Add(choice.GetData());
            }

            var nameAsBytes = Encoding.UTF8.GetBytes(Name);

            var data   = new byte[16 + 16 + nameAsBytes.Length + 1 + 8 + 8 + choices.Sum(c => c.Length)];
            var offset = 0;

            Buffer.BlockCopy(Id.ToOrderByteArray(), 0, data, offset, 16);
            offset += 16;
            Buffer.BlockCopy(CommunityId.ToOrderByteArray(), 0, data, offset, 16);
            offset += 16;
            Buffer.BlockCopy(nameAsBytes, 0, data, offset, nameAsBytes.Length);
            offset += nameAsBytes.Length;

            data[offset] = Type;
            offset      += 1;

            var time = BitConverter.GetBytes(EndTime);

            Array.Reverse(time);
            Buffer.BlockCopy(time, 0, data, offset, 8);
            offset += 8;

            foreach (var choice in choices)
            {
                Buffer.BlockCopy(choice, 0, data, offset, choice.Length);
                offset += choice.Length;
            }

            return(data);
        }
Пример #11
0
 protected void ToString(StringBuilder sb)
 {
     sb.AppendFormat(
         "{0}: ad title: '{1}', location: '{2}', community id: {3}, community only: {4}, include synonyms: {5}, recency: {6}, sort order: {7}, reverse sort order: {8}, keywords: '{9}', advertiser: '{10}', salary range: {11}, job types: {12}, distance: {13}, industry ids: {14}, is flagged: {15}, has viewed: {16}, has notes: {17}, has applied: {18}",
         GetType().Name,
         AdTitle,
         Location == null ? null : (Location.IsCountry ? Location.Country.Name : Location.ToString()),
         CommunityId.HasValue ? CommunityId.ToString() : String.Empty,
         CommunityOnly.HasValue ? CommunityOnly.Value.ToString() : String.Empty,
         IncludeSynonyms,
         Recency,
         SortCriteria.SortOrder,
         SortCriteria.ReverseSortOrder,
         GetKeywords(),
         AdvertiserNameExpression == null ? "" : AdvertiserNameExpression.GetUserExpression(),
         Salary == null ? "(none)" : Salary.ToString(),
         JobTypes,
         Distance,
         IndustryIds == null ? null : string.Join(", ", (from i in IndustryIds select i.ToString()).ToArray()),
         IsFlagged,
         HasViewed,
         HasNotes,
         HasApplied);
 }
Пример #12
0
 public Task <CommunityAuthorityResponse> GetCommunityAuthorityAsync(CommunityId id)
 {
     return(_niconicoSession.ToolkitContext.Community.GetCommunityAuthorityForLoginUserAsync(id));
 }
Пример #13
0
        public async Task <bool> IsFollowingAsync(CommunityId id)
        {
            var res = await _niconicoSession.ToolkitContext.Community.GetCommunityAuthorityForLoginUserAsync(id);

            return(res.Data?.IsMember ?? false);
        }
Пример #14
0
 get => GetId(CommunityId, UserId);
Пример #15
0
 public Task <CommunityInfoResponse> GetCommunityInfo(CommunityId communityId)
 {
     return(_niconicoSession.ToolkitContext.Community.GetCommunityInfoAsync(communityId));
 }