コード例 #1
0
        public static string GetSignWithUrl(string url, ApiKeyInfo apiKeyInfo)
        {
            string        result;
            string        str  = url.Substring(url.IndexOf("?", 4) + 1);
            List <string> list = str.Split('&').ToList();

            list.Sort();
            StringBuilder stringBuilder = new StringBuilder();

            foreach (string str1 in list)
            {
                stringBuilder.Append((stringBuilder.Length > 0 ? "&" : string.Empty));
                stringBuilder.Append(str1);
            }
            stringBuilder.Append(apiKeyInfo.Secret);
            result = Utils.ToMD5(stringBuilder.ToString()).ToLower();
            return(url += "&sign=" + result);
        }
コード例 #2
0
        //public static List<string> followList;


        public static string GetSign(string url, ApiKeyInfo apiKeyInfo = null)
        {
            if (apiKeyInfo == null)
            {
                apiKeyInfo = ApiHelper.AndroidKey;
            }
            string        result;
            string        str  = url.Substring(url.IndexOf("?", 4) + 1);
            List <string> list = str.Split('&').ToList();

            list.Sort();
            StringBuilder stringBuilder = new StringBuilder();

            foreach (string str1 in list)
            {
                stringBuilder.Append((stringBuilder.Length > 0 ? "&" : string.Empty));
                stringBuilder.Append(str1);
            }
            stringBuilder.Append(apiKeyInfo.Secret);
            result = Utils.ToMD5(stringBuilder.ToString()).ToLower();
            return(result);
        }