Пример #1
0
 public static void DeleteUsers(string uIds, string apiKey)
 {
     Sync.SendRequest("deleteuser", new List <MyParam>
     {
         MyParam.Create("uids", uIds)
     }.ToArray(), apiKey);
 }
Пример #2
0
 public static void UpdatePassword(string userName, string password, string apiKey)
 {
     Sync.SendRequest("updatepwd", new List <MyParam>
     {
         MyParam.Create("user_name", userName),
         MyParam.Create("password", password)
     }.ToArray(), apiKey);
 }
Пример #3
0
 public static void UpdateProfile(int uId, string userName, string apiKey)
 {
     Sync.SendRequest("updateprofile", new List <MyParam>
     {
         MyParam.Create("uid", uId),
         MyParam.Create("user_name", userName)
     }.ToArray(), apiKey);
 }
Пример #4
0
 public static void UpdateCredits(int uId, int creditIndex, string amount, string apiKey)
 {
     Sync.SendRequest("updatecredits", new List <MyParam>
     {
         MyParam.Create("uid", uId),
         MyParam.Create("credit_index", creditIndex.ToString()),
         MyParam.Create("amount", amount)
     }.ToArray(), apiKey);
 }
Пример #5
0
 public static void RenameUser(int uId, string oldUserName, string newUserName, string apiKey)
 {
     Sync.SendRequest("renameuser", new List <MyParam>
     {
         MyParam.Create("uid", uId),
         MyParam.Create("old_user_name", oldUserName),
         MyParam.Create("new_user_name", newUserName)
     }.ToArray(), apiKey);
 }
Пример #6
0
 //public static string Test(string asyncUrl)
 //{
 //	return Utils.GetHttpWebResponse(string.Format("{0}?action={1}", asyncUrl, "test"));
 //}
 public static void UserRegister(int uId, string userName, string password, string apiKey)
 {
     Sync.SendRequest("register", new List <MyParam>
     {
         MyParam.Create("uid", uId),
         MyParam.Create("user_name", userName),
         MyParam.Create("password", password)
     }.ToArray(), apiKey);
 }
Пример #7
0
 public static void UpdateSignature(int uId, string userName, string signature, string apiKey)
 {
     Sync.SendRequest("updatesignature", new List <MyParam>
     {
         MyParam.Create("uid", uId),
         MyParam.Create("user_name", userName),
         MyParam.Create("signature", signature)
     }.ToArray(), apiKey);
 }
Пример #8
0
 public static void NewTopic(string topicId, string title, string author, string authorId, string fid, string apiKey)
 {
     Sync.SendRequest("newtopic", new List <MyParam>
     {
         MyParam.Create("tid", topicId),
         MyParam.Create("title", title),
         MyParam.Create("author", author),
         MyParam.Create("author_id", authorId),
         MyParam.Create("fid", fid)
     }.ToArray(), apiKey);
 }
Пример #9
0
        public static string GetLogoutScript(int uId)
        {
            var stringBuilder = new StringBuilder();
            var list          = new List <MyParam>();

            list.Add(MyParam.Create("uid", uId));
            foreach (var current in Sync.GetAsyncTarget("logout"))
            {
                stringBuilder.AppendFormat("<script src=\"{0}\" reload=\"1\"></script>", Sync.GetUrl(current.SyncUrl, current.Secret, "logout", list.ToArray()));
            }
            return(stringBuilder.ToString());
        }
Пример #10
0
 public static void Reply(string postId, string topicId, string topicTitle, string poster, string posterId, string fid, string apiKey)
 {
     Sync.SendRequest("reply", new List <MyParam>
     {
         MyParam.Create("pid", postId),
         MyParam.Create("tid", topicId),
         MyParam.Create("topic_title", topicTitle),
         MyParam.Create("poster", poster),
         MyParam.Create("poster_id", posterId),
         MyParam.Create("fid", fid)
     }.ToArray(), apiKey);
 }
Пример #11
0
        private static string GetUrl(string asyncUrl, string secret, string action, MyParam[] parameters)
        {
            var list = new List <MyParam>(parameters);

            list.Add(MyParam.Create("time", Time()));
            list.Add(MyParam.Create("action", action));
            list.Sort();
            var stringBuilder = new StringBuilder();

            foreach (var current in list)
            {
                if (!string.IsNullOrEmpty(current.Value))
                {
                    stringBuilder.Append(current.ToString());
                }
            }
            stringBuilder.Append(secret);
            byte[] array          = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(stringBuilder.ToString()));
            var    stringBuilder2 = new StringBuilder();

            byte[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                byte b = array2[i];
                stringBuilder2.Append(b.ToString("x2"));
            }
            list.Add(MyParam.Create("sig", stringBuilder2.ToString()));
            var stringBuilder3 = new StringBuilder();

            for (int j = 0; j < list.Count; j++)
            {
                if (j > 0)
                {
                    stringBuilder3.Append("&");
                }
                stringBuilder3.Append(list[j].ToEncodedString());
            }
            return(string.Format("{0}?{1}", asyncUrl, stringBuilder3.ToString()));
        }