コード例 #1
0
        /**
         *  获取设备ID方法
         *  1、自动生成设备ID并记录到软件所在目录下的loginDeviceId.txt文件里;
         *  2、存在文件则读取已经记录的设备ID;
         */
        public static string loadLoginDeviceId(string file, string mobile, FileProperties keys)
        {
            String key = (String)keys[mobile];

            if (key == string.Empty || key == null)
            {
                key = generateDeviceId(mobile);
                keys.Add(mobile, key);
                // 保存properties文件
                keys.save(file);
            }
            return(key);
        }
コード例 #2
0
ファイル: DoMissions.cs プロジェクト: gaoyaguang/Projects
        private string root = System.Environment.CurrentDirectory;       // 文件执行的根路径

        /// <summary>
        /// 登陆
        /// </summary>
        /// <param name="cookieContainer"></param>
        /// <param name="usename"></param>
        /// <returns></returns>
        public Dictionary <string, string> login(CookieContainer cookieContainer, string usename)
        {
            string url = "http://www.heigo.com.cn/map-web/servlet/Login2Servlet";

            String file = root + "\\loginDeviceId.properties";

            FileUtil.createFile(file);
            FileProperties keys = new FileProperties(file);

            string deviceId = loadLoginDeviceId(cookieContainer, file, usename, keys);

            //"req=[{"mobileNumber":"15811347006","password":"******","loginDeviceId":"B804D325-0EAE-4CBF-BFB4-804407C84488","isManual":"1"}]";
            string param = "req=[{\"mobileNumber\":\"" + usename + "\",\"password\":\"00B7691D86D96AEBD21DD9E138F90840\",\"loginDeviceId\":\"" + deviceId + "\",\"isManual\":\"1\"}]";

            param = UrlCode.UrlEncode(param);
            return(Httpclient.post(url, param, "application/x-www-form-urlencoded", cookieContainer));
        }