Exemplo n.º 1
0
        /// <summary>
        /// Данная функция формирует запрос на сервер по результатам которого из request получаем куда надо upload-ить файл и
        /// как закончить передачу файла
        /// </summary>
        private static void get_road_map()
        {
            string response;

            time_offset = System.Convert.ToInt64(http_sender.getCurrentTimeToUnixFormat()) - Convert.ToInt64(recvData.host_time);
            StartSession ss     = new StartSession();
            string       sha256 = "";

            ss.set_post_parameter("a", StartSession.token);
            ss.set_post_parameter("f", "json");
            ss.set_post_parameter("k", ss.dev_id);
            long ts = System.Convert.ToInt64(http_sender.getCurrentTimeToUnixFormat()) - time_offset;

            ss.set_post_parameter("ts", ts.ToString());
            ss.set_post_parameter("size", full_file_size.ToString());
            ss.set_post_parameter("filename", file_name);
            ss.set_post_parameter("client", http_sender.EscapeSymbol("Mail.ru Windows ICQ"));
            ss.set_post_parameter("r", ss.GUID);
            ss.set_post_parameter("language", "ru-ru");
            sha256 = http_sender.hmac_base64(StartSession.sessionKey, http_sender.EscapeSymbol(ss.getStrStartSession(url, false)));/*auto sha256 = escape_symbols(get_url_sign(ss_host.str(), params, params_, false));*/
            ss.set_post_parameter("sig_sha256", sha256);
            response = http_sender.GetAsync(url + ss.getStrPack(), true);

            Console.WriteLine(response);
            dynamic json = JObject.Parse(response);

            upload_host  = (string)json["data"]["host"];
            upload_url   = (string)json["data"]["url"];
            complete_url = (string)json["data"]["complete_url"];

            Console.WriteLine("upload host " + upload_host);
            Console.WriteLine("upload url " + upload_url);
            Console.WriteLine("complete_url " + complete_url);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            // GUID g = new GUID();

            string Login    = "******";//"672880971";//"742343553";
            string Pwd      = "Ltybcrf159632";
            string response = "";
            string message  = "";



            Console.WriteLine("-------------------------------1 step - ClientLogin  ----------------------");
            response = http_sender.POST("https://api.login.icq.net/auth/clientLogin", "clientName=Mail.ru%20Windows%20ICQ&clientVersion=10.0.1999&devId=ic1nmMjqg7Yu-0hL&f=json&pwd=" + Pwd + "&r=dce7ba59-bf6e-4daa-ad63-67e04799dd6b&s=" + Login + "&tokenType=longterm");
            Console.WriteLine(response);
            Console.WriteLine("-------------------------------2 step - StartSession ----------------------");
            StartSession start = new StartSession(response);

            response = http_sender.POST("https://api.icq.net/aim/startSession", start.getStrPack());
            Console.WriteLine(response);
            Console.WriteLine("-------------------------------3 step - fetchBaseURL ----------------------");
            Fetch.getContactList(response);
            Fetch.FetchEvent();
            Console.WriteLine("-------------------------------4 step - setTimeZone ----------------------");
            http_sender.GetAsync(setTimeZone.initTimeZone(response));
            Console.WriteLine(http_sender.response);
//Console.WriteLine("-------------------------------5 step - sendMessage ----------------------");
//response = http_sender.POST("https://api.icq.net/im/sendIM", sendData.getDataMesssage(response, "online"));

            // Console.WriteLine(response);
            #region MainLoop
            Fetch.AsyncUpdateState();

            do
            {
                message = Console.ReadLine();
                if (message.Equals("exit"))
                {
                    Fetch.isWork = false;
                    Thread.Sleep(1000);
                    Console.WriteLine(EndSession.end_session());
                }
                else
                {
                    sendData.sendMessage(message, "672880971");
                }
            } while (!message.Equals("exit"));

            #endregion
            Console.WriteLine("-------------------------------6 step - EndSession ----------------------");


            Console.ReadKey();
        }
Exemplo n.º 3
0
        private static void upload_file()
        {
            StartSession st     = new StartSession();
            string       sha256 = "";

            st.set_post_parameter("a", StartSession.token);
            st.set_post_parameter("f", "json");
            st.set_post_parameter("k", st.dev_id);
            long ts = System.Convert.ToInt64(http_sender.getCurrentTimeToUnixFormat()) - time_offset;

            st.set_post_parameter("ts", ts.ToString());
            st.set_post_parameter("r", st.GUID);
            sha256 = http_sender.hmac_base64(StartSession.sessionKey, http_sender.EscapeSymbol(st.getStrStartSession(url, true)));/*auto sha256 = escape_symbols(get_url_sign(ss_host.str(), params, params_, false));*/
            st.set_post_parameter("sig_sha256", sha256);

            //   read_file();
            send_data_to_server(st.getStrPack());
        }