Пример #1
0
        private Dictionary <string, string> BuildQuery()
        {
            var dics = new Dictionary <string, string>();

            dics.Add("api_key", this.ApiKey);
            dics.Add("api_secret", this.ApiSecret);

            if (!string.IsNullOrWhiteSpace(this.ImageBase64String))
            {
                dics.Add("image_base64", this.ImageBase64String);
            }
            else if (!string.IsNullOrWhiteSpace(this.ImageUrl))
            {
                dics.Add("image_url", WebQueryHelper.UrlEncode(this.ImageUrl));
            }

            if (this.IsReturnGesture)
            {
                dics.Add("return_gesture", "1");
            }
            else
            {
                dics.Add("return_gesture", "0");
            }

            return(dics);
        }
Пример #2
0
        private Dictionary <string, string> BuildQuery()
        {
            var dics = new Dictionary <string, string>();

            dics.Add("api_key", this.ApiKey);
            dics.Add("api_secret", this.ApiSecret);

            if (!string.IsNullOrWhiteSpace(this.FaceSetToken))
            {
                dics.Add("faceset_token", this.FaceSetToken);
            }
            else if (!string.IsNullOrWhiteSpace(this.OuterId))
            {
                dics.Add("outer_id", WebQueryHelper.UrlEncode(this.OuterId));
            }

            if (this.IsCheckEmpty)
            {
                dics.Add("check_empty", "1");
            }
            else
            {
                dics.Add("check_empty", "0");
            }

            return(dics);
        }
        private Dictionary <string, string> BuildQuery()
        {
            var dics = new Dictionary <string, string>();

            dics.Add("api_key", this.ApiKey);
            dics.Add("api_secret", this.ApiSecret);

            if (!string.IsNullOrWhiteSpace(this.FaceSetToken))
            {
                dics.Add("faceset_token", this.FaceSetToken);
            }
            else if (!string.IsNullOrWhiteSpace(this.OuterId))
            {
                dics.Add("outer_id", WebQueryHelper.UrlEncode(this.OuterId));
            }

            if (this.FaceTokens != null)
            {
                if (this.FaceTokens.Count > 5)
                {
                    throw new Exception("最多不超过5个face_token");
                }
                dics.Add("face_tokens", string.Join(",", this.FaceTokens));
            }

            return(dics);
        }
Пример #4
0
        private Dictionary <string, string> BuildQuery()
        {
            var dics = new Dictionary <string, string>();

            dics.Add("api_key", this.ApiKey);
            dics.Add("api_secret", this.ApiSecret);

            if (!string.IsNullOrWhiteSpace(this.FaceSetToken))
            {
                dics.Add("faceset_token", this.FaceSetToken);
            }
            else if (!string.IsNullOrWhiteSpace(this.OuterId))
            {
                dics.Add("outer_id", WebQueryHelper.UrlEncode(this.OuterId));
            }

            if (this.Start >= 1 && this.Start < 10000)
            {
                dics.Add("start", this.Start.ToString());
            }
            else if (!string.IsNullOrWhiteSpace(this.StartToken))
            {
                dics.Add("start", this.StartToken);
            }

            return(dics);
        }
        private Dictionary <string, string> BuildQuery()
        {
            var dics = new Dictionary <string, string>();

            dics.Add("api_key", this.ApiKey);
            dics.Add("api_secret", this.ApiSecret);

            if (!string.IsNullOrWhiteSpace(this.ImageBase64String))
            {
                dics.Add("image_base64", this.ImageBase64String);
            }
            else if (!string.IsNullOrWhiteSpace(this.ImageUrl))
            {
                dics.Add("image_url", WebQueryHelper.UrlEncode(this.ImageUrl));
            }

            if (this.ReturnAttributesType != HumanBodyAttributes.None)
            {
                var _att = "";
                foreach (var d in _attributes)
                {
                    if (d.Key == (int)(this.ReturnAttributesType & (HumanBodyAttributes)d.Key) && d.Key != (int)HumanBodyAttributes.All && d.Key != (int)HumanBodyAttributes.None)
                    {
                        _att += string.Format("{0},", d.Value);
                    }
                }
                _att = _att.TrimEnd(',');
                dics.Add("return_attributes", _att);
            }

            return(dics);
        }
        private Dictionary <string, string> BuildQuery()
        {
            var dics = new Dictionary <string, string>();

            dics.Add("api_key", this.ApiKey);
            dics.Add("api_secret", this.ApiSecret);

            if (!string.IsNullOrWhiteSpace(this.FaceToken1))
            {
                dics.Add("face_token1", this.FaceToken1);
            }
            if (!string.IsNullOrWhiteSpace(this.ImageUrl1))
            {
                dics.Add("image_url1", WebQueryHelper.UrlEncode(this.ImageUrl1));
            }
            if (!string.IsNullOrWhiteSpace(this.ImageBase64String1))
            {
                dics.Add("image_base64_1", this.ImageBase64String1);
            }

            if (!string.IsNullOrWhiteSpace(this.FaceToken2))
            {
                dics.Add("face_token2", this.FaceToken2);
            }
            if (!string.IsNullOrWhiteSpace(this.ImageUrl2))
            {
                dics.Add("image_url2", WebQueryHelper.UrlEncode(this.ImageUrl2));
            }
            if (!string.IsNullOrWhiteSpace(this.ImageBase64String2))
            {
                dics.Add("image_base64_2", this.ImageBase64String2);
            }

            if (this.FaceRectangle1 != null)
            {
                dics.Add("face_rectangle1", string.Format("{0},{1},{2},{3}",
                                                          this.FaceRectangle1.Top, this.FaceRectangle1.Left,
                                                          this.FaceRectangle1.Width, this.FaceRectangle1.Height));
            }

            if (this.FaceRectangle2 != null)
            {
                dics.Add("face_rectangle2", string.Format("{0},{1},{2},{3}",
                                                          this.FaceRectangle2.Top, this.FaceRectangle2.Left,
                                                          this.FaceRectangle2.Width, this.FaceRectangle2.Height));
            }

            return(dics);
        }
        private Dictionary <string, string> BuildQuery()
        {
            var dics = new Dictionary <string, string>();

            dics.Add("api_key", this.ApiKey);
            dics.Add("api_secret", this.ApiSecret);

            if (!string.IsNullOrWhiteSpace(this.ImageBase64String))
            {
                dics.Add("image_base64", this.ImageBase64String);
            }
            else if (!string.IsNullOrWhiteSpace(this.ImageUrl))
            {
                dics.Add("image_url", WebQueryHelper.UrlEncode(this.ImageUrl));
            }

            if (this.IsReturnLandMark)
            {
                dics.Add("return_landmark", "1");
            }

            if (this.ReturnAttributesType != AttributesType.None)
            {
                var _att = "";
                foreach (var d in _attributes)
                {
                    if (d.Key == (int)(this.ReturnAttributesType & (AttributesType)d.Key) && d.Key != (int)AttributesType.All && d.Key != (int)AttributesType.None)
                    {
                        _att += string.Format("{0},", d.Value);
                    }
                }
                _att = _att.TrimEnd(',');
                dics.Add("return_attributes", _att);
            }

            if (this.IsCalculateAll)
            {
                dics.Add("calculate_all", "1");
            }

            if (this.FaceRectangle != null)
            {
                dics.Add("face_rectangle", string.Format("{0},{1},{2},{3}",
                                                         this.FaceRectangle.Top, this.FaceRectangle.Left,
                                                         this.FaceRectangle.Width, this.FaceRectangle.Height));
            }

            return(dics);
        }
        private Dictionary <string, string> BuildQuery()
        {
            var dics = new Dictionary <string, string>();

            dics.Add("api_key", this.ApiKey);
            dics.Add("api_secret", this.ApiSecret);

            if (!string.IsNullOrWhiteSpace(this.DisplayName))
            {
                dics.Add("display_name", WebQueryHelper.UrlEncode(this.DisplayName));
            }

            if (!string.IsNullOrWhiteSpace(this.OuterId))
            {
                dics.Add("outer_id", WebQueryHelper.UrlEncode(this.OuterId));
            }

            if (this.Tags != null)
            {
                dics.Add("tags", WebQueryHelper.UrlEncode(string.Join(",", this.Tags)));
            }

            if (this.FaceTokens != null)
            {
                if (this.FaceTokens.Count > 0)
                {
                    throw new Exception("最多不超过5个face_token");
                }
                dics.Add("face_tokens", string.Join(",", this.FaceTokens));
            }

            if (!string.IsNullOrWhiteSpace(this.UserData))
            {
                dics.Add("user_data", WebQueryHelper.UrlEncode(this.UserData));
            }

            if (this.IsForceMerge)
            {
                dics.Add("force_merge", "1");
            }

            return(dics);
        }
        private Dictionary <string, string> BuildQuery()
        {
            var dics = new Dictionary <string, string>();

            dics.Add("api_key", this.ApiKey);
            dics.Add("api_secret", this.ApiSecret);

            if (!string.IsNullOrWhiteSpace(this.FaceToken))
            {
                dics.Add("face_token", this.FaceToken);
            }
            if (!string.IsNullOrWhiteSpace(this.ImageBase64String))
            {
                dics.Add("image_base64", this.ImageBase64String);
            }
            else if (!string.IsNullOrWhiteSpace(this.ImageUrl))
            {
                dics.Add("image_url", WebQueryHelper.UrlEncode(this.ImageUrl));
            }

            if (!string.IsNullOrWhiteSpace(this.FaceSetToken))
            {
                dics.Add("faceset_token", this.FaceSetToken);
            }
            else if (!string.IsNullOrWhiteSpace(this.OuterId))
            {
                dics.Add("outer_id", this.OuterId);
            }

            dics.Add("return_result_count", this.ReturnResultCount.ToString());

            if (this.FaceRectangle != null)
            {
                dics.Add("face_rectangle", string.Format("{0},{1},{2},{3}",
                                                         this.FaceRectangle.Top, this.FaceRectangle.Left,
                                                         this.FaceRectangle.Width, this.FaceRectangle.Height));
            }

            return(dics);
        }
        private Dictionary <string, string> BuildQuery()
        {
            var dics = new Dictionary <string, string>();

            dics.Add("api_key", this.ApiKey);
            dics.Add("api_secret", this.ApiSecret);

            if (!string.IsNullOrWhiteSpace(this.FaceSetToken))
            {
                dics.Add("faceset_token", this.FaceSetToken);
            }
            else if (!string.IsNullOrWhiteSpace(this.OuterId))
            {
                dics.Add("outer_id", WebQueryHelper.UrlEncode(this.OuterId));
            }

            if (!string.IsNullOrWhiteSpace(this.DisplayName))
            {
                dics.Add("display_name", WebQueryHelper.UrlEncode(this.DisplayName));
            }

            if (!string.IsNullOrWhiteSpace(this.NewOuterId))
            {
                dics.Add("new_outer_id", WebQueryHelper.UrlEncode(this.NewOuterId));
            }

            if (this.Tags != null)
            {
                dics.Add("tags", WebQueryHelper.UrlEncode(string.Join(",", this.Tags)));
            }

            if (!string.IsNullOrWhiteSpace(this.UserData))
            {
                dics.Add("user_data", WebQueryHelper.UrlEncode(this.UserData));
            }

            return(dics);
        }
Пример #11
0
        private Dictionary <string, string> BuildQuery()
        {
            var dics = new Dictionary <string, string>();

            dics.Add("api_key", this.ApiKey);
            dics.Add("api_secret", this.ApiSecret);

            if (this.Tags != null)
            {
                dics.Add("tags", WebQueryHelper.UrlEncode(string.Join(",", this.Tags)));
            }

            if (this.Start >= 1 && this.Start < 10000)
            {
                dics.Add("start", this.Start.ToString());
            }
            else if (!string.IsNullOrWhiteSpace(this.StartToken))
            {
                dics.Add("start", this.StartToken);
            }

            return(dics);
        }