예제 #1
0
        public string GenerateQuery()
        {
            var queryList = new List <string>();

            if (!string.IsNullOrWhiteSpace(Name))
            {
                queryList.Add($"name={Name}");
            }

            if (Limit.HasValue)
            {
                queryList.Add($"limit={Limit}");
            }

            if (After.HasValue)
            {
                queryList.Add($"after={After}");
            }

            if (Before.HasValue)
            {
                queryList.Add($"before={Before}");
            }

            if (WarFrequency.HasValue)
            {
                queryList.Add($"warFrequency={WarFrequency.GetStringValue()}");
            }

            if (LocationId.HasValue)
            {
                queryList.Add($"locationId={LocationId}");
            }

            if (MinMembers.HasValue)
            {
                queryList.Add($"minMembers={MinMembers}");
            }

            if (MaxMembers.HasValue)
            {
                queryList.Add($"maxMembers={MaxMembers}");
            }

            if (MinClanPoints.HasValue)
            {
                queryList.Add($"minClanPoints={MinClanPoints}");
            }

            if (MinClanLevel.HasValue)
            {
                queryList.Add($"minClanLevel={MinClanLevel}");
            }

            return($"?{string.Join("&", queryList)}");
        }
        public string GetQueryString()
        {
            var requestUri = new StringBuilder();

            if (WarFrequency != null)
            {
                requestUri.Append($"&warFrequency={WarFrequency.GetWarFrequency()}");
            }

            if (LocationId != null)
            {
                requestUri.Append($"&locationId={LocationId}");
            }

            if (MinimumMembers != null)
            {
                requestUri.Append($"&minMembers={MinimumMembers}");
            }

            if (MaximumMembers != null)
            {
                requestUri.Append($"&maxMembers={MaximumMembers}");
            }

            if (MinimumClanPoints != null)
            {
                requestUri.Append($"&minClanPoints={MinimumClanPoints}");
            }

            if (MinimumClanLevel != null)
            {
                requestUri.Append($"&minClanLevel={MinimumClanLevel}");
            }

            if (Limit != null)
            {
                requestUri.Append($"&limit={Limit}");
            }

            if (After != null)
            {
                requestUri.Append($"&after={After}");
            }

            if (Before != null)
            {
                requestUri.Append($"&before={Before}");
            }

            return(requestUri.ToString());
        }
예제 #3
0
파일: Clan.cs 프로젝트: devhl-labs/CocApi
        /// <summary>
        /// Returns true if Clan instances are equal
        /// </summary>
        /// <param name="input">Instance of Clan to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Clan?input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     WarLeague == input.WarLeague ||
                     (WarLeague != null &&
                      WarLeague.Equals(input.WarLeague))
                     ) &&

                 (
                     RequiredTrophies == input.RequiredTrophies ||
                     RequiredTrophies.Equals(input.RequiredTrophies)
                 ) &&
                 (
                     ClanVersusPoints == input.ClanVersusPoints ||
                     ClanVersusPoints.Equals(input.ClanVersusPoints)
                 ) &&
                 (
                     Tag == input.Tag ||
                     (Tag != null &&
                      Tag.Equals(input.Tag))
                 ) &&
                 (
                     IsWarLogPublic == input.IsWarLogPublic ||
                     IsWarLogPublic.Equals(input.IsWarLogPublic)
                 ) &&
                 (
                     WarFrequency == input.WarFrequency ||
                     WarFrequency.Equals(input.WarFrequency)
                 ) &&
                 (
                     ClanLevel == input.ClanLevel ||
                     ClanLevel.Equals(input.ClanLevel)
                 ) &&
                 (
                     WarWinStreak == input.WarWinStreak ||
                     WarWinStreak.Equals(input.WarWinStreak)
                 ) &&
                 (
                     WarWins == input.WarWins ||
                     WarWins.Equals(input.WarWins)
                 ) &&
                 (
                     WarTies == input.WarTies ||
                     WarTies.Equals(input.WarTies)
                 ) &&
                 (
                     WarLosses == input.WarLosses ||
                     WarLosses.Equals(input.WarLosses)
                 ) &&
                 (
                     ClanPoints == input.ClanPoints ||
                     ClanPoints.Equals(input.ClanPoints)
                 ) &&
                 (
                     Labels == input.Labels ||
                     Labels != null &&
                     input.Labels != null &&
                     Labels.SequenceEqual(input.Labels)
                 ) &&
                 (
                     Name == input.Name ||
                     (Name != null &&
                      Name.Equals(input.Name))
                 ) &&
                 (
                     Location == input.Location ||
                     (Location != null &&
                      Location.Equals(input.Location))
                 ) &&
                 (
                     Type == input.Type ||
                     Type.Equals(input.Type)
                 ) &&
                 (
                     Members == input.Members ||
                     Members.Equals(input.Members)
                 ) &&
                 (
                     Description == input.Description ||
                     (Description != null &&
                      Description.Equals(input.Description))
                 ) &&
                 (
                     BadgeUrls == input.BadgeUrls ||
                     (BadgeUrls != null &&
                      BadgeUrls.Equals(input.BadgeUrls))
                 ));
        }