|
@@ -1649,119 +1649,6 @@ namespace MOKA_Factory_Tools
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- public static bool AutoGetKey(string url, string order, string key, string keytype, SQLiteConnection errorDBNow)
|
|
|
- {
|
|
|
- string code;
|
|
|
- string desc;
|
|
|
- HttpHelper http = new HttpHelper();
|
|
|
- HttpItem item = new HttpItem()
|
|
|
- {
|
|
|
- Encoding = Encoding.Default,
|
|
|
- Method = "post",
|
|
|
- ContentType = "application/x-www-form-urlencoded",
|
|
|
- KeepAlive = false
|
|
|
- };
|
|
|
- url += "/autogetkey.do?";
|
|
|
- item.URL = url;
|
|
|
- item.Postdata = string.Format("order={0}&key={1}&keytype={2}&mac={3}", order, key, keytype, HttpUtility.UrlEncode(TestMode.MAC));
|
|
|
- HttpResult result = http.GetHtml(item);
|
|
|
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
|
|
|
- {
|
|
|
- Log.WriteGetKeyLog("\r\nAutoquestKey :\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
|
|
|
- if (Xmlconfig.AutoKeyStatusXml(result.Html, "response", out code, out desc))
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- CommonMethod.ReportErrormsg("Auto get key error", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- CommonMethod.ReportErrormsg("Auto get key error", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static bool AutoGetKeyStatus(string url, string key, string keytype, SQLiteConnection errorDBNow)
|
|
|
- {
|
|
|
- string code;
|
|
|
- string desc;
|
|
|
- HttpHelper http = new HttpHelper();
|
|
|
- HttpItem item = new HttpItem()
|
|
|
- {
|
|
|
- Encoding = Encoding.Default,
|
|
|
- Method = "post",
|
|
|
- ContentType = "application/x-www-form-urlencoded",
|
|
|
- KeepAlive = false
|
|
|
- };
|
|
|
- url += "/autogetkeystatus.do?";
|
|
|
- item.URL = url;
|
|
|
- item.Postdata = string.Format("key={0}&keytype={1}", key, keytype);
|
|
|
- HttpResult result = http.GetHtml(item);
|
|
|
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
|
|
|
- {
|
|
|
- Log.WriteGetKeyLog("\r\nAutoGetKeyStatus :\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
|
|
|
- if (Xmlconfig.AutoKeyStatusXml(result.Html, "response", out code, out desc))
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- CommonMethod.ReportErrormsg("Auto get key status error", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static bool GetFireTVDsn(string url, string ordernum, string deviceCode, string FSN, string PSN, out string dsn, out string error, SQLiteConnection errorDBNow)
|
|
|
- {
|
|
|
- // 计算函数耗时;
|
|
|
- Stopwatch watch = new Stopwatch();
|
|
|
- watch.Start();
|
|
|
- dsn = "";
|
|
|
- error = "";
|
|
|
- HttpHelper http = new HttpHelper();
|
|
|
- HttpItem item = new HttpItem()
|
|
|
- {
|
|
|
- Encoding = null, // 编码格式(utf-8,gb2312,gbk)可选项 默认类会自动识别Encoding = Encoding.Default,
|
|
|
- Method = "GET", // URL 可选项 默认为Get
|
|
|
- KeepAlive = false
|
|
|
- };
|
|
|
-
|
|
|
- item.URL = string.Format("{0}/getFiretvDsn.do?ordernum={1}&fsn={2}&psn={3}&deviceCode={4}&mac={5}", url, ordernum, FSN, PSN, deviceCode, HttpUtility.UrlEncode(TestMode.MAC));
|
|
|
- HttpResult result = http.GetHtml(item);
|
|
|
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
|
|
|
- {
|
|
|
- string code;
|
|
|
- string desc;
|
|
|
- Log.WriteGetKeyLog("\r\nGetFireTVDsn :\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
|
|
|
- if (Xmlconfig.GetDSNXml(result.Html, "response", out code, out desc, out dsn))
|
|
|
- {
|
|
|
- Log.WriteGetKeyLog(string.Format("\r\nDSN= {0}\r\nHttp Get Dsn Elapsed = {1}", dsn, watch.Elapsed.TotalMilliseconds));
|
|
|
- return true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- error = desc;
|
|
|
- CommonMethod.ReportErrormsg("GetFireTVDsn error", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL, errorDBNow);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- error = "Communication with server failed";
|
|
|
- CommonMethod.ReportErrormsg("GetFireTVDsn error", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL, errorDBNow);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 导出日本的SN与ACASID到文本中;
|
|
|
/// </summary>
|