|
@@ -55,20 +55,21 @@ namespace MOKA_Factory_Tools
|
|
{
|
|
{
|
|
if (Convert.ToBoolean(mo["IPEnabled"]))
|
|
if (Convert.ToBoolean(mo["IPEnabled"]))
|
|
{
|
|
{
|
|
- if(j<2)
|
|
|
|
|
|
+ if (j < 2)
|
|
{
|
|
{
|
|
mac = mo["MacAddress"].ToString() + "&" + mac;
|
|
mac = mo["MacAddress"].ToString() + "&" + mac;
|
|
- j++; }
|
|
|
|
-
|
|
|
|
|
|
+ j++;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- if(i<1)
|
|
|
|
|
|
+ if (i < 1)
|
|
{
|
|
{
|
|
mac += mo["MacAddress"].ToString() + "&";
|
|
mac += mo["MacAddress"].ToString() + "&";
|
|
i++;
|
|
i++;
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -88,7 +89,7 @@ namespace MOKA_Factory_Tools
|
|
/// <param name="sqliteConn"></param>
|
|
/// <param name="sqliteConn"></param>
|
|
/// <param name="mid"></param>
|
|
/// <param name="mid"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static bool GetMidInfo(string url, string order, string pcmac, string iptvip, string version, SQLiteConnection sqliteConn,out MidList mid)
|
|
|
|
|
|
+ public static bool GetMidInfo(string url, string order, string pcmac, string iptvip, string version, SQLiteConnection sqliteConn, out MidList mid)
|
|
{
|
|
{
|
|
mid = new MidList();
|
|
mid = new MidList();
|
|
OrderInput orderInput1 = new OrderInput { bid = order, mac = pcmac, version = "", clientType = "" };//"74-27-EA-6E-DA-9F"
|
|
OrderInput orderInput1 = new OrderInput { bid = order, mac = pcmac, version = "", clientType = "" };//"74-27-EA-6E-DA-9F"
|
|
@@ -98,12 +99,12 @@ namespace MOKA_Factory_Tools
|
|
{
|
|
{
|
|
URL = url,//URL这里都是测试URl 必需项
|
|
URL = url,//URL这里都是测试URl 必需项
|
|
Encoding = Encoding.UTF8,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
|
|
Encoding = Encoding.UTF8,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
|
|
- //Encoding = Encoding.Default,
|
|
|
|
|
|
+ //Encoding = Encoding.Default,
|
|
Method = "post",//URL 可选项 默认为Get
|
|
Method = "post",//URL 可选项 默认为Get
|
|
Postdata = jsonorder,
|
|
Postdata = jsonorder,
|
|
- PostEncoding= Encoding.UTF8,
|
|
|
|
|
|
+ PostEncoding = Encoding.UTF8,
|
|
KeepAlive = false
|
|
KeepAlive = false
|
|
- };
|
|
|
|
|
|
+ };
|
|
item.ContentType = "application/json;charset=utf-8";
|
|
item.ContentType = "application/json;charset=utf-8";
|
|
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
|
|
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
|
|
stopwatch.Start();
|
|
stopwatch.Start();
|
|
@@ -135,24 +136,24 @@ namespace MOKA_Factory_Tools
|
|
mid.clienttype = jObject["clientType"].Value<string>();
|
|
mid.clienttype = jObject["clientType"].Value<string>();
|
|
mid.host = jObject["host"].Value<string>();
|
|
mid.host = jObject["host"].Value<string>();
|
|
mid.whiteType = jObject["whiteType"].Value<string>();
|
|
mid.whiteType = jObject["whiteType"].Value<string>();
|
|
- object a=jObject["rokuCustomer"];
|
|
|
|
- if (jObject["rokuCustomer"].ToString().Length>0)
|
|
|
|
|
|
+ object a = jObject["rokuCustomer"];
|
|
|
|
+ if (jObject["rokuCustomer"].ToString().Length > 0)
|
|
mid.rokuCustomer = new RokuCustomer()
|
|
mid.rokuCustomer = new RokuCustomer()
|
|
{
|
|
{
|
|
id = JSON_SeleteNode(jObject["rokuCustomer"], "id").Trim(),
|
|
id = JSON_SeleteNode(jObject["rokuCustomer"], "id").Trim(),
|
|
- ordernum= JSON_SeleteNode(jObject["rokuCustomer"], "ordernum").Trim(),
|
|
|
|
|
|
+ ordernum = JSON_SeleteNode(jObject["rokuCustomer"], "ordernum").Trim(),
|
|
brand = JSON_SeleteNode(jObject["rokuCustomer"], "brand").Trim(),
|
|
brand = JSON_SeleteNode(jObject["rokuCustomer"], "brand").Trim(),
|
|
region = JSON_SeleteNode(jObject["rokuCustomer"], "region").Trim(),
|
|
region = JSON_SeleteNode(jObject["rokuCustomer"], "region").Trim(),
|
|
oemmodel = JSON_SeleteNode(jObject["rokuCustomer"], "oemmodel").Trim(),
|
|
oemmodel = JSON_SeleteNode(jObject["rokuCustomer"], "oemmodel").Trim(),
|
|
supporturl = JSON_SeleteNode(jObject["rokuCustomer"], "supporturl").Trim(),
|
|
supporturl = JSON_SeleteNode(jObject["rokuCustomer"], "supporturl").Trim(),
|
|
supportphone = JSON_SeleteNode(jObject["rokuCustomer"], "supportphone").Trim(),
|
|
supportphone = JSON_SeleteNode(jObject["rokuCustomer"], "supportphone").Trim(),
|
|
productiondate = JSON_SeleteNode(jObject["rokuCustomer"], "productiondate").Trim(),
|
|
productiondate = JSON_SeleteNode(jObject["rokuCustomer"], "productiondate").Trim(),
|
|
- remotetype= JSON_SeleteNode(jObject["rokuCustomer"], "remotetype").Trim(),
|
|
|
|
|
|
+ remotetype = JSON_SeleteNode(jObject["rokuCustomer"], "remotetype").Trim(),
|
|
updatetime = JSON_SeleteNode(jObject["rokuCustomer"], "updatetime").Trim(),
|
|
updatetime = JSON_SeleteNode(jObject["rokuCustomer"], "updatetime").Trim(),
|
|
createtime = JSON_SeleteNode(jObject["rokuCustomer"], "createtime").Trim(),
|
|
createtime = JSON_SeleteNode(jObject["rokuCustomer"], "createtime").Trim(),
|
|
isdelete = JSON_SeleteNode(jObject["rokuCustomer"], "isdelete").Trim()
|
|
isdelete = JSON_SeleteNode(jObject["rokuCustomer"], "isdelete").Trim()
|
|
};
|
|
};
|
|
-
|
|
|
|
|
|
+
|
|
mid.keytype = new Dictionary<string, string>();
|
|
mid.keytype = new Dictionary<string, string>();
|
|
foreach (var ss in jObject["obj"]) //查找某个字段与值
|
|
foreach (var ss in jObject["obj"]) //查找某个字段与值
|
|
{
|
|
{
|
|
@@ -166,7 +167,7 @@ namespace MOKA_Factory_Tools
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
- {
|
|
|
|
|
|
+ {
|
|
Log.WriteErrorLog("\r\nFail to parse MID info," + ex.Message + ":" + ParseText + "\r\nAddress:" + url + "\r\nPostdata:" + jsonorder);
|
|
Log.WriteErrorLog("\r\nFail to parse MID info," + ex.Message + ":" + ParseText + "\r\nAddress:" + url + "\r\nPostdata:" + jsonorder);
|
|
ReportErrormsg("Fail to parse MID info", ex.Message + ":" + ParseText + "\r\nAddress:" + url + "\r\nPostdata:" + jsonorder, sqliteConn);
|
|
ReportErrormsg("Fail to parse MID info", ex.Message + ":" + ParseText + "\r\nAddress:" + url + "\r\nPostdata:" + jsonorder, sqliteConn);
|
|
MessageBox.Show("Fail to parse MID info\r\n " + ex.Message);
|
|
MessageBox.Show("Fail to parse MID info\r\n " + ex.Message);
|
|
@@ -183,7 +184,7 @@ namespace MOKA_Factory_Tools
|
|
/// <param name="sqliteConn"></param>
|
|
/// <param name="sqliteConn"></param>
|
|
/// <param name="midAddress"></param>
|
|
/// <param name="midAddress"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static bool GetMidAddress(MidList midInfo, string order, SQLiteConnection sqliteConn,out MidAddress midAddress)
|
|
|
|
|
|
+ public static bool GetMidAddress(MidList midInfo, string order, SQLiteConnection sqliteConn, out MidAddress midAddress)
|
|
{
|
|
{
|
|
midAddress = new MidAddress();
|
|
midAddress = new MidAddress();
|
|
HttpHelper http = new HttpHelper();
|
|
HttpHelper http = new HttpHelper();
|
|
@@ -193,7 +194,7 @@ namespace MOKA_Factory_Tools
|
|
Encoding = null,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
|
|
Encoding = null,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
|
|
//Encoding = Encoding.Default,
|
|
//Encoding = Encoding.Default,
|
|
Method = "post",//URL 可选项 默认为Get
|
|
Method = "post",//URL 可选项 默认为Get
|
|
- Postdata = ("orderNumber=" + order +"&mac=" + HttpUtility.UrlEncode(TestMode.MAC)),
|
|
|
|
|
|
+ Postdata = ("orderNumber=" + order + "&mac=" + HttpUtility.UrlEncode(TestMode.MAC)),
|
|
KeepAlive = false
|
|
KeepAlive = false
|
|
};
|
|
};
|
|
item.ContentType = "application/x-www-form-urlencoded";
|
|
item.ContentType = "application/x-www-form-urlencoded";
|
|
@@ -201,7 +202,7 @@ namespace MOKA_Factory_Tools
|
|
string ParseText = result.Html;
|
|
string ParseText = result.Html;
|
|
if (result.StatusCode == System.Net.HttpStatusCode.OK)
|
|
if (result.StatusCode == System.Net.HttpStatusCode.OK)
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -275,14 +276,14 @@ namespace MOKA_Factory_Tools
|
|
JObject jObject = JObject.Parse(ParseText);
|
|
JObject jObject = JObject.Parse(ParseText);
|
|
if (jObject["data"] != null)
|
|
if (jObject["data"] != null)
|
|
{
|
|
{
|
|
- foreach(var data in jObject["data"])
|
|
|
|
|
|
+ foreach (var data in jObject["data"])
|
|
{
|
|
{
|
|
midAddressList.Add(new MidAddress()
|
|
midAddressList.Add(new MidAddress()
|
|
{
|
|
{
|
|
des = JSON_SeleteNode(jObject, "des"),
|
|
des = JSON_SeleteNode(jObject, "des"),
|
|
code = JSON_SeleteNode(jObject, "code"),
|
|
code = JSON_SeleteNode(jObject, "code"),
|
|
order = data["order_number"].ToObject<string>(),
|
|
order = data["order_number"].ToObject<string>(),
|
|
- number = data["order_quantity"].ToObject<string>(),
|
|
|
|
|
|
+ number = data["order_quantity"].ToObject<string>(),
|
|
pid = data["project_id"].ToObject<string>(),
|
|
pid = data["project_id"].ToObject<string>(),
|
|
ctype = data["client_type"].ToObject<string>(),
|
|
ctype = data["client_type"].ToObject<string>(),
|
|
purl = data["packet_url"].ToObject<string>(),
|
|
purl = data["packet_url"].ToObject<string>(),
|
|
@@ -293,7 +294,7 @@ namespace MOKA_Factory_Tools
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
Log.WriteGetKeyLog("\r\nGet Mid address success:" + "\r\n" + result.Html + "\r\nAddress:" + item.URL + "\r\nPostdata:" + item.Postdata);
|
|
Log.WriteGetKeyLog("\r\nGet Mid address success:" + "\r\n" + result.Html + "\r\nAddress:" + item.URL + "\r\nPostdata:" + item.Postdata);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
@@ -364,7 +365,7 @@ namespace MOKA_Factory_Tools
|
|
/// <param name="key"></param>
|
|
/// <param name="key"></param>
|
|
/// <param name="error"></param>
|
|
/// <param name="error"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static bool GetKeys(string url,string keymessage,string sn,string keytype, SQLiteConnection sqliteConn, out string key, out string error, string order, out string md5)
|
|
|
|
|
|
+ public static bool GetKeys(string url, string keymessage, string sn, string keytype, SQLiteConnection sqliteConn, out string key, out string error, string order, out string md5)
|
|
{
|
|
{
|
|
string code;
|
|
string code;
|
|
string desc;
|
|
string desc;
|
|
@@ -377,7 +378,7 @@ namespace MOKA_Factory_Tools
|
|
Encoding = Encoding.Default,
|
|
Encoding = Encoding.Default,
|
|
Method = "post",
|
|
Method = "post",
|
|
ContentType = "application/x-www-form-urlencoded",
|
|
ContentType = "application/x-www-form-urlencoded",
|
|
- KeepAlive = false
|
|
|
|
|
|
+ KeepAlive = false
|
|
};
|
|
};
|
|
switch (keymessage)
|
|
switch (keymessage)
|
|
{
|
|
{
|
|
@@ -387,7 +388,7 @@ namespace MOKA_Factory_Tools
|
|
item.Postdata = "devicetype=tcl_unknown_model" + "&sn=" + sn;
|
|
item.Postdata = "devicetype=tcl_unknown_model" + "&sn=" + sn;
|
|
if (sn.Trim().Length > 0)
|
|
if (sn.Trim().Length > 0)
|
|
item.Postdata += "&order=" + order;
|
|
item.Postdata += "&order=" + order;
|
|
- HttpResult result = http.GetHtml(item);
|
|
|
|
|
|
+ HttpResult result = http.GetHtml(item);
|
|
if (result.StatusCode == System.Net.HttpStatusCode.OK)
|
|
if (result.StatusCode == System.Net.HttpStatusCode.OK)
|
|
{
|
|
{
|
|
Log.WriteGetKeyLog("\r\nGetDeviceID:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
|
|
Log.WriteGetKeyLog("\r\nGetDeviceID:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
|
|
@@ -396,14 +397,14 @@ namespace MOKA_Factory_Tools
|
|
//
|
|
//
|
|
}
|
|
}
|
|
else
|
|
else
|
|
- {
|
|
|
|
|
|
+ {
|
|
error = desc;
|
|
error = desc;
|
|
ReportErrormsg("Fail to parse DID", error + "\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html, sqliteConn);
|
|
ReportErrormsg("Fail to parse DID", error + "\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html, sqliteConn);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
- {
|
|
|
|
|
|
+ {
|
|
error = result.StatusDescription;
|
|
error = result.StatusDescription;
|
|
ReportErrormsg("Fail to get DID", error + "\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html, sqliteConn);
|
|
ReportErrormsg("Fail to get DID", error + "\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html, sqliteConn);
|
|
return false;
|
|
return false;
|
|
@@ -412,8 +413,8 @@ namespace MOKA_Factory_Tools
|
|
}
|
|
}
|
|
case "MAC":
|
|
case "MAC":
|
|
{
|
|
{
|
|
- item.URL = url+"/getmac.do?";
|
|
|
|
- item.Postdata = "typeString=" + keytype + "&sn="+ sn;
|
|
|
|
|
|
+ item.URL = url + "/getmac.do?";
|
|
|
|
+ item.Postdata = "typeString=" + keytype + "&sn=" + sn;
|
|
if (sn.Trim().Length > 0)
|
|
if (sn.Trim().Length > 0)
|
|
item.Postdata += "&order=" + order;
|
|
item.Postdata += "&order=" + order;
|
|
HttpResult result = http.GetHtml(item);
|
|
HttpResult result = http.GetHtml(item);
|
|
@@ -442,7 +443,7 @@ namespace MOKA_Factory_Tools
|
|
case "HDCP_KEY":
|
|
case "HDCP_KEY":
|
|
{
|
|
{
|
|
item.URL = url + "/gethdcpkey.do?";
|
|
item.URL = url + "/gethdcpkey.do?";
|
|
- item.Postdata = "type=" + keytype + "&sn="+ sn;
|
|
|
|
|
|
+ item.Postdata = "type=" + keytype + "&sn=" + sn;
|
|
if (sn.Trim().Length > 0)
|
|
if (sn.Trim().Length > 0)
|
|
item.Postdata += "&order=" + order;
|
|
item.Postdata += "&order=" + order;
|
|
HttpResult result = http.GetHtml(item);
|
|
HttpResult result = http.GetHtml(item);
|
|
@@ -470,7 +471,7 @@ namespace MOKA_Factory_Tools
|
|
}
|
|
}
|
|
case "CI_PLUS_KEY":
|
|
case "CI_PLUS_KEY":
|
|
{
|
|
{
|
|
- item.URL = url+ "/getcikey.do?";
|
|
|
|
|
|
+ item.URL = url + "/getcikey.do?";
|
|
item.Postdata = "type=" + keytype + "&sn=" + sn;
|
|
item.Postdata = "type=" + keytype + "&sn=" + sn;
|
|
if (sn.Trim().Length > 0)
|
|
if (sn.Trim().Length > 0)
|
|
item.Postdata += "&order=" + order;
|
|
item.Postdata += "&order=" + order;
|
|
@@ -499,7 +500,7 @@ namespace MOKA_Factory_Tools
|
|
}
|
|
}
|
|
case "WiDi":
|
|
case "WiDi":
|
|
{
|
|
{
|
|
- item.URL = url+ "/getwidi.do?";
|
|
|
|
|
|
+ item.URL = url + "/getwidi.do?";
|
|
item.Postdata = "type=" + keytype + "&sn=" + sn;
|
|
item.Postdata = "type=" + keytype + "&sn=" + sn;
|
|
if (sn.Trim().Length > 0)
|
|
if (sn.Trim().Length > 0)
|
|
item.Postdata += "&order=" + order;
|
|
item.Postdata += "&order=" + order;
|
|
@@ -528,7 +529,7 @@ namespace MOKA_Factory_Tools
|
|
}
|
|
}
|
|
case "HDCP2.2_KEY":
|
|
case "HDCP2.2_KEY":
|
|
{
|
|
{
|
|
- item.URL = url+ "/gethdcpkey2.do?";
|
|
|
|
|
|
+ item.URL = url + "/gethdcpkey2.do?";
|
|
item.Postdata = "type=" + keytype + "&sn=" + sn;
|
|
item.Postdata = "type=" + keytype + "&sn=" + sn;
|
|
if (sn.Trim().Length > 0)
|
|
if (sn.Trim().Length > 0)
|
|
item.Postdata += "&order=" + order;
|
|
item.Postdata += "&order=" + order;
|
|
@@ -557,7 +558,7 @@ namespace MOKA_Factory_Tools
|
|
}
|
|
}
|
|
case "NETFILX_ESN":
|
|
case "NETFILX_ESN":
|
|
{
|
|
{
|
|
- item.URL = url+ "/getnetfilxesn.do?";
|
|
|
|
|
|
+ item.URL = url + "/getnetfilxesn.do?";
|
|
item.Postdata = "type=" + keytype + "&sn=" + sn;
|
|
item.Postdata = "type=" + keytype + "&sn=" + sn;
|
|
if (sn.Trim().Length > 0)
|
|
if (sn.Trim().Length > 0)
|
|
item.Postdata += "&order=" + order;
|
|
item.Postdata += "&order=" + order;
|
|
@@ -817,48 +818,48 @@ namespace MOKA_Factory_Tools
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case "MOKA_RT2851M_IR": // ACAS Key;
|
|
case "MOKA_RT2851M_IR": // ACAS Key;
|
|
- {
|
|
|
|
- item.URL = url + "/getAcasKey.do?";
|
|
|
|
- item.Postdata = "type=" + keytype + "&sn=" + sn;
|
|
|
|
- if (sn.Trim().Length > 0)
|
|
|
|
- item.Postdata += "&order=" + order;
|
|
|
|
- HttpResult result = http.GetHtml(item);
|
|
|
|
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
|
|
|
|
{
|
|
{
|
|
- Log.WriteGetKeyLog("\r\nGet ACAS key:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
|
|
|
|
- if (Xmlconfig.GetOthersKeyXml(result.Html, "response", "acasKey", out code, out desc, out key, out md5))
|
|
|
|
|
|
+ item.URL = url + "/getAcasKey.do?";
|
|
|
|
+ item.Postdata = "type=" + keytype + "&sn=" + sn;
|
|
|
|
+ if (sn.Trim().Length > 0)
|
|
|
|
+ item.Postdata += "&order=" + order;
|
|
|
|
+ HttpResult result = http.GetHtml(item);
|
|
|
|
+ if (result.StatusCode == System.Net.HttpStatusCode.OK)
|
|
{
|
|
{
|
|
|
|
+ Log.WriteGetKeyLog("\r\nGet ACAS key:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
|
|
|
|
+ if (Xmlconfig.GetOthersKeyXml(result.Html, "response", "acasKey", out code, out desc, out key, out md5))
|
|
|
|
+ {
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ error = desc;
|
|
|
|
+ ReportErrormsg("Fail to parse ACAS key", error + "\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html, sqliteConn);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- error = desc;
|
|
|
|
- ReportErrormsg("Fail to parse ACAS key", error + "\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html, sqliteConn);
|
|
|
|
|
|
+ error = result.StatusDescription;
|
|
|
|
+ ReportErrormsg("Fail to get ACAS key", error + "\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html, sqliteConn);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
- else
|
|
|
|
- {
|
|
|
|
- error = result.StatusDescription;
|
|
|
|
- ReportErrormsg("Fail to get ACAS key", error + "\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html, sqliteConn);
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
public static bool GetWidevineAnAttestationKey(
|
|
public static bool GetWidevineAnAttestationKey(
|
|
- string url,
|
|
|
|
- string sn,
|
|
|
|
- string keytype,
|
|
|
|
- SQLiteConnection sqliteConn,
|
|
|
|
|
|
+ string url,
|
|
|
|
+ string sn,
|
|
|
|
+ string keytype,
|
|
|
|
+ SQLiteConnection sqliteConn,
|
|
out bool isAndroidTV,
|
|
out bool isAndroidTV,
|
|
out string Widevinekey,
|
|
out string Widevinekey,
|
|
out string Attestationkey,
|
|
out string Attestationkey,
|
|
- out string error,
|
|
|
|
- string order,
|
|
|
|
|
|
+ out string error,
|
|
|
|
+ string order,
|
|
out string AttestationMd5)
|
|
out string AttestationMd5)
|
|
{
|
|
{
|
|
string code;
|
|
string code;
|
|
@@ -908,20 +909,19 @@ namespace MOKA_Factory_Tools
|
|
/// <param name="reportData"></param>
|
|
/// <param name="reportData"></param>
|
|
/// <param name="sqliteConn"></param>
|
|
/// <param name="sqliteConn"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static bool ReportErrormsg(string reportType,string reportData, SQLiteConnection sqliteConn)
|
|
|
|
|
|
+ public static bool ReportErrormsg(string reportType, string reportData, SQLiteConnection sqliteConn)
|
|
{
|
|
{
|
|
-
|
|
|
|
- ErrorInfo ErrorInfo1 = new ErrorInfo { reportType = reportType, reportData = reportData.Replace("'",""), version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(), factory = FactoryName, mac = TestMode.MAC, reportTime = System.DateTime.Now.ToString(("yyyy-MM-dd HH:mm:ss")) };
|
|
|
|
|
|
+ ErrorInfo ErrorInfo1 = new ErrorInfo { reportType = reportType, reportData = reportData.Replace("'", ""), version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(), factory = FactoryName, mac = TestMode.MAC, reportTime = System.DateTime.Now.ToString(("yyyy-MM-dd HH:mm:ss")) };
|
|
string jsonError = Newtonsoft.Json.JsonConvert.SerializeObject(ErrorInfo1, Newtonsoft.Json.Formatting.Indented);
|
|
string jsonError = Newtonsoft.Json.JsonConvert.SerializeObject(ErrorInfo1, Newtonsoft.Json.Formatting.Indented);
|
|
HttpHelper http = new HttpHelper();
|
|
HttpHelper http = new HttpHelper();
|
|
HttpItem item = new HttpItem()
|
|
HttpItem item = new HttpItem()
|
|
{
|
|
{
|
|
URL = TestMode.errorreportServerurl,//URL这里都是测试URl 必需项
|
|
URL = TestMode.errorreportServerurl,//URL这里都是测试URl 必需项
|
|
Encoding = Encoding.UTF8,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
|
|
Encoding = Encoding.UTF8,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
|
|
- //Encoding = Encoding.Default,
|
|
|
|
|
|
+ //Encoding = Encoding.Default,
|
|
Method = "post",//URL 可选项 默认为Get
|
|
Method = "post",//URL 可选项 默认为Get
|
|
Postdata = jsonError,
|
|
Postdata = jsonError,
|
|
- PostEncoding= Encoding.UTF8,
|
|
|
|
|
|
+ PostEncoding = Encoding.UTF8,
|
|
KeepAlive = false
|
|
KeepAlive = false
|
|
};
|
|
};
|
|
item.ContentType = "application/json;charset=utf-8";
|
|
item.ContentType = "application/json;charset=utf-8";
|
|
@@ -933,9 +933,9 @@ namespace MOKA_Factory_Tools
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- if(HTTPChecker(item.URL))
|
|
|
|
|
|
+ if (HTTPChecker(item.URL))
|
|
SQLiteHelper.InsertDelayErrorReport(sqliteConn, new object[] { item.URL, item.Postdata });
|
|
SQLiteHelper.InsertDelayErrorReport(sqliteConn, new object[] { item.URL, item.Postdata });
|
|
- Log.WriteErrorLog("\r\nFail to ReportErrormsg:\r\n"+ result.StatusDescription +"\r\n"+ result.Html + "\r\nAddress:" + TestMode.errorreportServerurl + "\r\nPostdata:" + jsonError);
|
|
|
|
|
|
+ Log.WriteErrorLog("\r\nFail to ReportErrormsg:\r\n" + result.StatusDescription + "\r\n" + result.Html + "\r\nAddress:" + TestMode.errorreportServerurl + "\r\nPostdata:" + jsonError);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
try
|
|
try
|
|
@@ -965,7 +965,7 @@ namespace MOKA_Factory_Tools
|
|
/// <param name="order"></param>
|
|
/// <param name="order"></param>
|
|
/// <param name="sqliteConn"></param>
|
|
/// <param name="sqliteConn"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static bool ReportDownloadStatus(string url,string order, SQLiteConnection sqliteConn)
|
|
|
|
|
|
+ public static bool ReportDownloadStatus(string url, string order, SQLiteConnection sqliteConn)
|
|
{
|
|
{
|
|
HttpHelper http = new HttpHelper();
|
|
HttpHelper http = new HttpHelper();
|
|
HttpItem item = new HttpItem()
|
|
HttpItem item = new HttpItem()
|
|
@@ -1021,17 +1021,17 @@ namespace MOKA_Factory_Tools
|
|
/// <param name="keydata"></param>
|
|
/// <param name="keydata"></param>
|
|
/// <param name="error"></param>
|
|
/// <param name="error"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static bool CreateDBkeyString(KeyInfo keyInfo,out string keydata,out string error)
|
|
|
|
|
|
+ public static bool CreateDBkeyString(KeyInfo keyInfo, out string keydata, out string error)
|
|
{
|
|
{
|
|
keydata = "";
|
|
keydata = "";
|
|
error = "";
|
|
error = "";
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- DBKeysStringFormat DBKeysStringFormat1 = new DBKeysStringFormat { cikey = keyInfo.CI_plus == null ? "" : keyInfo.CI_plus, esn = keyInfo.ESN == null ? "" : keyInfo.ESN, hdcp = keyInfo.HDCP == null ? "" : keyInfo.HDCP, widevine = keyInfo.Widevine == null ? "" : keyInfo.Widevine, hdcp22=keyInfo.HDCP22 == null ? "" : keyInfo.HDCP22, did=keyInfo.DID == null ? "" : keyInfo.DID, mac=keyInfo.Mac == null ? "" : keyInfo.Mac, widi=keyInfo.WiDi == null ? "" : keyInfo.WiDi, attestation = keyInfo.Attestation == null ? "" : keyInfo.Attestation, mgk = keyInfo.MGK == null ? "" : keyInfo.MGK };
|
|
|
|
|
|
+ DBKeysStringFormat DBKeysStringFormat1 = new DBKeysStringFormat { cikey = keyInfo.CI_plus == null ? "" : keyInfo.CI_plus, esn = keyInfo.ESN == null ? "" : keyInfo.ESN, hdcp = keyInfo.HDCP == null ? "" : keyInfo.HDCP, widevine = keyInfo.Widevine == null ? "" : keyInfo.Widevine, hdcp22 = keyInfo.HDCP22 == null ? "" : keyInfo.HDCP22, did = keyInfo.DID == null ? "" : keyInfo.DID, mac = keyInfo.Mac == null ? "" : keyInfo.Mac, widi = keyInfo.WiDi == null ? "" : keyInfo.WiDi, attestation = keyInfo.Attestation == null ? "" : keyInfo.Attestation, mgk = keyInfo.MGK == null ? "" : keyInfo.MGK };
|
|
keydata = Newtonsoft.Json.JsonConvert.SerializeObject(DBKeysStringFormat1, Newtonsoft.Json.Formatting.Indented);
|
|
keydata = Newtonsoft.Json.JsonConvert.SerializeObject(DBKeysStringFormat1, Newtonsoft.Json.Formatting.Indented);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
- catch(Exception ex)
|
|
|
|
|
|
+ catch (Exception ex)
|
|
{
|
|
{
|
|
error = ex.Message;
|
|
error = ex.Message;
|
|
return false;
|
|
return false;
|
|
@@ -1082,11 +1082,10 @@ namespace MOKA_Factory_Tools
|
|
else
|
|
else
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- catch(Exception ex)
|
|
|
|
|
|
+ catch (Exception ex)
|
|
{
|
|
{
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -1107,11 +1106,10 @@ namespace MOKA_Factory_Tools
|
|
myRequest.UseDefaultCredentials = true;//权限设置
|
|
myRequest.UseDefaultCredentials = true;//权限设置
|
|
return (myResponse.StatusCode == HttpStatusCode.OK);//返回响应的状态
|
|
return (myResponse.StatusCode == HttpStatusCode.OK);//返回响应的状态
|
|
}
|
|
}
|
|
- catch(Exception ex)
|
|
|
|
|
|
+ catch (Exception ex)
|
|
{
|
|
{
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -1131,7 +1129,7 @@ namespace MOKA_Factory_Tools
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="content"></param>
|
|
/// <param name="content"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static bool UploadCopyResult(string content ,string url, SQLiteConnection sqliteConn,string order, bool repeatupload, string id,int timeout)
|
|
|
|
|
|
+ public static bool UploadCopyResult(string content, string url, SQLiteConnection sqliteConn, string order, bool repeatupload, string id, int timeout)
|
|
{
|
|
{
|
|
if (timeout < 5000)
|
|
if (timeout < 5000)
|
|
timeout = 5000;
|
|
timeout = 5000;
|
|
@@ -1180,8 +1178,8 @@ namespace MOKA_Factory_Tools
|
|
CommonMethod.ReportErrormsg("Fail to upload copy result", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, sqliteConn);
|
|
CommonMethod.ReportErrormsg("Fail to upload copy result", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, sqliteConn);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 本地DB存储的异常重新上报
|
|
/// 本地DB存储的异常重新上报
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -1189,7 +1187,7 @@ namespace MOKA_Factory_Tools
|
|
/// <param name="reportData"></param>
|
|
/// <param name="reportData"></param>
|
|
/// <param name="sqliteConn"></param>
|
|
/// <param name="sqliteConn"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static bool ReportErrormsg2(string url,string content,out bool mark)
|
|
|
|
|
|
+ public static bool ReportErrormsg2(string url, string content, out bool mark)
|
|
{
|
|
{
|
|
mark = false;
|
|
mark = false;
|
|
HttpHelper http = new HttpHelper();
|
|
HttpHelper http = new HttpHelper();
|
|
@@ -1228,7 +1226,6 @@ namespace MOKA_Factory_Tools
|
|
Log.WriteErrorLog("\r\nError report return error:\r\n" + ParseText + "\r\nAddress:" + TestMode.errorreportServerurl + "\r\nPostdata:" + content);
|
|
Log.WriteErrorLog("\r\nError report return error:\r\n" + ParseText + "\r\nAddress:" + TestMode.errorreportServerurl + "\r\nPostdata:" + content);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
@@ -1291,7 +1288,7 @@ namespace MOKA_Factory_Tools
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="copydate">烧录时间</param>
|
|
/// <param name="copydate">烧录时间</param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static bool UploadPreloadCopyResult(string host, string copydate,string SN, SQLiteConnection localDBNow, SQLiteConnection sqliteConn,bool repeatupload,string id,int timeout)
|
|
|
|
|
|
+ public static bool UploadPreloadCopyResult(string host, string copydate, string SN, SQLiteConnection localDBNow, SQLiteConnection sqliteConn, bool repeatupload, string id, int timeout)
|
|
{
|
|
{
|
|
string ParseText = "";
|
|
string ParseText = "";
|
|
bool status;
|
|
bool status;
|
|
@@ -1300,8 +1297,8 @@ namespace MOKA_Factory_Tools
|
|
List<PostDateClass> postList = new List<PostDateClass>();
|
|
List<PostDateClass> postList = new List<PostDateClass>();
|
|
postList.Add(new PostDateClass("sn", SN));
|
|
postList.Add(new PostDateClass("sn", SN));
|
|
postList.Add(new PostDateClass("date", copydate));
|
|
postList.Add(new PostDateClass("date", copydate));
|
|
- ParseText = FormPost.postFileMessage(host + "/reportlist.do?", postList,out status,timeout);
|
|
|
|
- if(status)
|
|
|
|
|
|
+ ParseText = FormPost.postFileMessage(host + "/reportlist.do?", postList, out status, timeout);
|
|
|
|
+ if (status)
|
|
{
|
|
{
|
|
JObject jObject = JObject.Parse(ParseText);
|
|
JObject jObject = JObject.Parse(ParseText);
|
|
string des = CommonMethod.JSON_SeleteNode(jObject, "des");
|
|
string des = CommonMethod.JSON_SeleteNode(jObject, "des");
|
|
@@ -1324,8 +1321,8 @@ namespace MOKA_Factory_Tools
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- CommonMethod.ReportErrormsg("Fail to UploadPreloadCopyResult","Address: " + host + "/reportlist.do?" + "\r\nPostdata: " + "sn=" + SN + "\r\ndate=" + copydate+"\r\n"+ ParseText, sqliteConn);
|
|
|
|
- Log.WriteErrorLog("\r\nUpdateReportStatus code return error,should be 1000 " + "\r\n" + SN + ":" + ParseText+"\r\nAddress:" + host + "/reportlist.do?" + "\r\nPostdata: " + "sn=" + SN + "\r\ndate=" + copydate);
|
|
|
|
|
|
+ CommonMethod.ReportErrormsg("Fail to UploadPreloadCopyResult", "Address: " + host + "/reportlist.do?" + "\r\nPostdata: " + "sn=" + SN + "\r\ndate=" + copydate + "\r\n" + ParseText, sqliteConn);
|
|
|
|
+ Log.WriteErrorLog("\r\nUpdateReportStatus code return error,should be 1000 " + "\r\n" + SN + ":" + ParseText + "\r\nAddress:" + host + "/reportlist.do?" + "\r\nPostdata: " + "sn=" + SN + "\r\ndate=" + copydate);
|
|
if (repeatupload)
|
|
if (repeatupload)
|
|
{
|
|
{
|
|
SQLiteHelper.DeleteDelayCopyReport(sqliteConn, id);
|
|
SQLiteHelper.DeleteDelayCopyReport(sqliteConn, id);
|
|
@@ -1341,7 +1338,6 @@ namespace MOKA_Factory_Tools
|
|
SQLiteHelper.InsertDelayCopyReport(sqliteConn, new object[] { "preload_mode", host, SN + "@" + copydate });
|
|
SQLiteHelper.InsertDelayCopyReport(sqliteConn, new object[] { "preload_mode", host, SN + "@" + copydate });
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
@@ -1366,7 +1362,7 @@ namespace MOKA_Factory_Tools
|
|
bool status;
|
|
bool status;
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- ParseText = FormPost.postFileMessage(host + "/reportlist.do?", postList, out status,30000);
|
|
|
|
|
|
+ ParseText = FormPost.postFileMessage(host + "/reportlist.do?", postList, out status, 30000);
|
|
if (status)
|
|
if (status)
|
|
{
|
|
{
|
|
JObject jObject = JObject.Parse(ParseText);
|
|
JObject jObject = JObject.Parse(ParseText);
|
|
@@ -1394,7 +1390,6 @@ namespace MOKA_Factory_Tools
|
|
Log.WriteErrorLog("Fail to UploadPreloadCopyResult\r\nAddress: " + host + "/reportlist.do?" + ParseText);
|
|
Log.WriteErrorLog("Fail to UploadPreloadCopyResult\r\nAddress: " + host + "/reportlist.do?" + ParseText);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
@@ -1454,7 +1449,7 @@ namespace MOKA_Factory_Tools
|
|
public static bool UpgradeCheck(string url, string FactoryNum, SQLiteConnection sqliteConn, out UpgradeMsgList upmid)
|
|
public static bool UpgradeCheck(string url, string FactoryNum, SQLiteConnection sqliteConn, out UpgradeMsgList upmid)
|
|
{
|
|
{
|
|
upmid = new UpgradeMsgList();
|
|
upmid = new UpgradeMsgList();
|
|
- UpgradeCheckInput UpgradeCheckInput1 = new UpgradeCheckInput { appid = "SCBC_Factory_Tools", devicemodel= "SCBC_Factory_Tools", dnum= FactoryNum, ver= System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(), type= "pc" };//System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()
|
|
|
|
|
|
+ UpgradeCheckInput UpgradeCheckInput1 = new UpgradeCheckInput { appid = "SCBC_Factory_Tools", devicemodel = "SCBC_Factory_Tools", dnum = FactoryNum, ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(), type = "pc" };//System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()
|
|
string jsonorder = Newtonsoft.Json.JsonConvert.SerializeObject(UpgradeCheckInput1, Newtonsoft.Json.Formatting.Indented);
|
|
string jsonorder = Newtonsoft.Json.JsonConvert.SerializeObject(UpgradeCheckInput1, Newtonsoft.Json.Formatting.Indented);
|
|
HttpHelper http = new HttpHelper();
|
|
HttpHelper http = new HttpHelper();
|
|
HttpItem item = new HttpItem()
|
|
HttpItem item = new HttpItem()
|
|
@@ -1473,7 +1468,7 @@ namespace MOKA_Factory_Tools
|
|
| SecurityProtocolType.Tls11//(SecurityProtocolType)0x300 //Tls11
|
|
| SecurityProtocolType.Tls11//(SecurityProtocolType)0x300 //Tls11
|
|
| SecurityProtocolType.Tls12;//(SecurityProtocolType)0xC00; //Tls12
|
|
| SecurityProtocolType.Tls12;//(SecurityProtocolType)0xC00; //Tls12
|
|
HttpResult result = http.GetHtml(item);
|
|
HttpResult result = http.GetHtml(item);
|
|
- string ParseText = result.Html;
|
|
|
|
|
|
+ string ParseText = result.Html;
|
|
if (result.StatusCode == System.Net.HttpStatusCode.OK)
|
|
if (result.StatusCode == System.Net.HttpStatusCode.OK)
|
|
{
|
|
{
|
|
Log.WriteGetKeyLog("\r\nUpgrade check," + ParseText + "\r\nAddress:" + url + "\r\nPostdata:" + jsonorder);
|
|
Log.WriteGetKeyLog("\r\nUpgrade check," + ParseText + "\r\nAddress:" + url + "\r\nPostdata:" + jsonorder);
|
|
@@ -1523,7 +1518,6 @@ namespace MOKA_Factory_Tools
|
|
MessageBox.Show("Fail to parse upgrade check info\r\n " + ex.Message);
|
|
MessageBox.Show("Fail to parse upgrade check info\r\n " + ex.Message);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -1534,9 +1528,9 @@ namespace MOKA_Factory_Tools
|
|
/// <param name="Result"></param>
|
|
/// <param name="Result"></param>
|
|
/// <param name="sqliteConn"></param>
|
|
/// <param name="sqliteConn"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static bool UpgradeReport(string url, string FactoryNum, string Result,SQLiteConnection sqliteConn)
|
|
|
|
|
|
+ public static bool UpgradeReport(string url, string FactoryNum, string Result, SQLiteConnection sqliteConn)
|
|
{
|
|
{
|
|
- UpgradeReportInput UpgradeCheckInput1 = new UpgradeReportInput { appid = "SCBC_Factory_Tools", devmodel = "SCBC_Factory_Tools", dnum = FactoryNum, ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(), type = "pc", result= Result };
|
|
|
|
|
|
+ UpgradeReportInput UpgradeCheckInput1 = new UpgradeReportInput { appid = "SCBC_Factory_Tools", devmodel = "SCBC_Factory_Tools", dnum = FactoryNum, ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(), type = "pc", result = Result };
|
|
string jsonorder = Newtonsoft.Json.JsonConvert.SerializeObject(UpgradeCheckInput1, Newtonsoft.Json.Formatting.Indented);
|
|
string jsonorder = Newtonsoft.Json.JsonConvert.SerializeObject(UpgradeCheckInput1, Newtonsoft.Json.Formatting.Indented);
|
|
HttpHelper http = new HttpHelper();
|
|
HttpHelper http = new HttpHelper();
|
|
HttpItem item = new HttpItem()
|
|
HttpItem item = new HttpItem()
|
|
@@ -1589,7 +1583,7 @@ namespace MOKA_Factory_Tools
|
|
/// <param name="filemd5"></param>
|
|
/// <param name="filemd5"></param>
|
|
/// <param name="error"></param>
|
|
/// <param name="error"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static bool CompareLocalkey(string filename, string filetype, string filemd5, out string error,out string filefullname)
|
|
|
|
|
|
+ public static bool CompareLocalkey(string filename, string filetype, string filemd5, out string error, out string filefullname)
|
|
{
|
|
{
|
|
error = "";
|
|
error = "";
|
|
filefullname = "";
|
|
filefullname = "";
|
|
@@ -1606,7 +1600,7 @@ namespace MOKA_Factory_Tools
|
|
string FileMD5 = GetMD5.GetMD5HashFromFile(keyfile.Name);
|
|
string FileMD5 = GetMD5.GetMD5HashFromFile(keyfile.Name);
|
|
if (FileMD5 == filemd5)
|
|
if (FileMD5 == filemd5)
|
|
{
|
|
{
|
|
- Log.WriteGetKeyLog("Check md5file success,file md5:" + FileMD5+"\r\nfile:"+ keyfile.FullName) ;
|
|
|
|
|
|
+ Log.WriteGetKeyLog("Check md5file success,file md5:" + FileMD5 + "\r\nfile:" + keyfile.FullName);
|
|
filefullname = keyfile.FullName;
|
|
filefullname = keyfile.FullName;
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
@@ -1618,12 +1612,11 @@ namespace MOKA_Factory_Tools
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- catch(Exception ex)
|
|
|
|
|
|
+ catch (Exception ex)
|
|
{
|
|
{
|
|
error = ex.Message;
|
|
error = ex.Message;
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -1637,7 +1630,7 @@ namespace MOKA_Factory_Tools
|
|
{
|
|
{
|
|
string strdata = Encoding.ASCII.GetString(data);
|
|
string strdata = Encoding.ASCII.GetString(data);
|
|
Console.WriteLine(strdata);
|
|
Console.WriteLine(strdata);
|
|
- if(strdata.StartsWith("MD5="))
|
|
|
|
|
|
+ if (strdata.StartsWith("MD5="))
|
|
{
|
|
{
|
|
string md5 = GetMD5.GetMD5Hash(key);
|
|
string md5 = GetMD5.GetMD5Hash(key);
|
|
Console.WriteLine(md5);
|
|
Console.WriteLine(md5);
|
|
@@ -1653,7 +1646,7 @@ namespace MOKA_Factory_Tools
|
|
/// <param name="data"></param>
|
|
/// <param name="data"></param>
|
|
/// <param name="error"></param>
|
|
/// <param name="error"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static bool GetCreateHexkey(string path,string data,out string error)
|
|
|
|
|
|
+ public static bool GetCreateHexkey(string path, string data, out string error)
|
|
{
|
|
{
|
|
error = "";
|
|
error = "";
|
|
try
|
|
try
|
|
@@ -1668,8 +1661,8 @@ namespace MOKA_Factory_Tools
|
|
return true;
|
|
return true;
|
|
|
|
|
|
}
|
|
}
|
|
- catch(Exception ex)
|
|
|
|
- {
|
|
|
|
|
|
+ catch (Exception ex)
|
|
|
|
+ {
|
|
error = ex.Message;
|
|
error = ex.Message;
|
|
Log.WriteErrorLog("save key error:" + error);
|
|
Log.WriteErrorLog("save key error:" + error);
|
|
return false;
|
|
return false;
|
|
@@ -1683,7 +1676,7 @@ namespace MOKA_Factory_Tools
|
|
/// <param name="data"></param>
|
|
/// <param name="data"></param>
|
|
/// <param name="error"></param>
|
|
/// <param name="error"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static bool ReadHexFile(string filepath,out string data,out string error)
|
|
|
|
|
|
+ public static bool ReadHexFile(string filepath, out string data, out string error)
|
|
{
|
|
{
|
|
data = "";
|
|
data = "";
|
|
error = "";
|
|
error = "";
|
|
@@ -1699,7 +1692,7 @@ namespace MOKA_Factory_Tools
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- catch(Exception ex)
|
|
|
|
|
|
+ catch (Exception ex)
|
|
{
|
|
{
|
|
error = ex.Message;
|
|
error = ex.Message;
|
|
return false;
|
|
return false;
|
|
@@ -1721,7 +1714,7 @@ namespace MOKA_Factory_Tools
|
|
loginOutput1 = new LoginOutput();
|
|
loginOutput1 = new LoginOutput();
|
|
LoginInput LoginInput1 = new LoginInput { account = account, password = password, mac = pcmac };
|
|
LoginInput LoginInput1 = new LoginInput { account = account, password = password, mac = pcmac };
|
|
string jsonorder = Newtonsoft.Json.JsonConvert.SerializeObject(LoginInput1, Newtonsoft.Json.Formatting.Indented);
|
|
string jsonorder = Newtonsoft.Json.JsonConvert.SerializeObject(LoginInput1, Newtonsoft.Json.Formatting.Indented);
|
|
-
|
|
|
|
|
|
+
|
|
HttpHelper http = new HttpHelper();
|
|
HttpHelper http = new HttpHelper();
|
|
HttpItem item = new HttpItem()
|
|
HttpItem item = new HttpItem()
|
|
{
|
|
{
|
|
@@ -1766,8 +1759,8 @@ namespace MOKA_Factory_Tools
|
|
MessageBox.Show("Fail to parse login return\r\n " + ex.Message);
|
|
MessageBox.Show("Fail to parse login return\r\n " + ex.Message);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 获取指定日期,在为一年中为第几周
|
|
/// 获取指定日期,在为一年中为第几周
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -1871,14 +1864,13 @@ namespace MOKA_Factory_Tools
|
|
updatetime = JSON_SeleteNode(jObject["obj"], "updatetime"),
|
|
updatetime = JSON_SeleteNode(jObject["obj"], "updatetime"),
|
|
createtime = JSON_SeleteNode(jObject["obj"], "createtime"),
|
|
createtime = JSON_SeleteNode(jObject["obj"], "createtime"),
|
|
isdelete = JSON_SeleteNode(jObject["obj"], "isdelete"),
|
|
isdelete = JSON_SeleteNode(jObject["obj"], "isdelete"),
|
|
- isExemption= JSON_SeleteNode(jObject["obj"], "isExemption")
|
|
|
|
|
|
+ isExemption = JSON_SeleteNode(jObject["obj"], "isExemption")
|
|
};
|
|
};
|
|
if (WBList.code == "1000")
|
|
if (WBList.code == "1000")
|
|
return true;
|
|
return true;
|
|
else
|
|
else
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
Log.WriteErrorLog("\r\nFail to parse WB info," + ex.Message + ":" + ParseText + "\r\nAddress:" + url + "\r\nPostdata:" + jsonorder);
|
|
Log.WriteErrorLog("\r\nFail to parse WB info," + ex.Message + ":" + ParseText + "\r\nAddress:" + url + "\r\nPostdata:" + jsonorder);
|
|
@@ -1886,7 +1878,6 @@ namespace MOKA_Factory_Tools
|
|
MessageBox.Show("Fail to parse WB info\r\n " + ex.Message);
|
|
MessageBox.Show("Fail to parse WB info\r\n " + ex.Message);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
|
|
private static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
|
|
@@ -2018,7 +2009,7 @@ namespace MOKA_Factory_Tools
|
|
Directory.CreateDirectory(path);
|
|
Directory.CreateDirectory(path);
|
|
}
|
|
}
|
|
|
|
|
|
- if ( !lastOrder.Equals(ordernum) )
|
|
|
|
|
|
+ if (!lastOrder.Equals(ordernum))
|
|
{
|
|
{
|
|
lastOrder = ordernum;
|
|
lastOrder = ordernum;
|
|
ListACASSN.Clear();
|
|
ListACASSN.Clear();
|
|
@@ -2075,15 +2066,16 @@ namespace MOKA_Factory_Tools
|
|
value = (value >> 8) ^ Crc32Table[(value & 0xFF) ^ bytes[i]];
|
|
value = (value >> 8) ^ Crc32Table[(value & 0xFF) ^ bytes[i]];
|
|
}
|
|
}
|
|
return value ^ 0xffffffff;
|
|
return value ^ 0xffffffff;
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 本地抄写模式方法
|
|
/// 本地抄写模式方法
|
|
/// </summary>
|
|
/// </summary>
|
|
public class GetLocalKeyCount
|
|
public class GetLocalKeyCount
|
|
{
|
|
{
|
|
static string LocalKeyPath = AppDomain.CurrentDomain.BaseDirectory + "\\Keys\\";
|
|
static string LocalKeyPath = AppDomain.CurrentDomain.BaseDirectory + "\\Keys\\";
|
|
- public static bool GetLocalDidCount(string order,out int num,ref MidList localmidList, SQLiteConnection errorDBNow)
|
|
|
|
|
|
+ public static bool GetLocalDidCount(string order, out int num, ref MidList localmidList, SQLiteConnection errorDBNow)
|
|
{
|
|
{
|
|
num = 0;
|
|
num = 0;
|
|
try
|
|
try
|
|
@@ -2149,15 +2141,15 @@ namespace MOKA_Factory_Tools
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- catch(Exception ex)
|
|
|
|
|
|
+ catch (Exception ex)
|
|
{
|
|
{
|
|
num = -1;
|
|
num = -1;
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
public static bool GetLocalMacCount(string order, out int num, ref MidList localmidList, SQLiteConnection errorDBNow)
|
|
public static bool GetLocalMacCount(string order, out int num, ref MidList localmidList, SQLiteConnection errorDBNow)
|
|
{
|
|
{
|
|
num = 0;
|
|
num = 0;
|
|
@@ -2296,6 +2288,7 @@ namespace MOKA_Factory_Tools
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
public static bool GetLocalWidevineCount(string order, out int num)
|
|
public static bool GetLocalWidevineCount(string order, out int num)
|
|
{
|
|
{
|
|
num = 0;
|
|
num = 0;
|
|
@@ -2317,6 +2310,7 @@ namespace MOKA_Factory_Tools
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
public static bool GetLocalESNCount(string order, out int num)
|
|
public static bool GetLocalESNCount(string order, out int num)
|
|
{
|
|
{
|
|
num = 0;
|
|
num = 0;
|
|
@@ -2380,7 +2374,7 @@ namespace MOKA_Factory_Tools
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- public static bool GetLocalFolderKeyCount(string order,string keyname, out int num)
|
|
|
|
|
|
+ public static bool GetLocalFolderKeyCount(string order, string keyname, out int num)
|
|
{
|
|
{
|
|
num = 0;
|
|
num = 0;
|
|
try
|
|
try
|
|
@@ -2401,6 +2395,7 @@ namespace MOKA_Factory_Tools
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
public static bool GetLocalAttestationCount(string order, out int num)
|
|
public static bool GetLocalAttestationCount(string order, out int num)
|
|
{
|
|
{
|
|
num = 0;
|
|
num = 0;
|
|
@@ -2422,6 +2417,7 @@ namespace MOKA_Factory_Tools
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
public static bool GetLocalCIKEYCount(string order, out int num)
|
|
public static bool GetLocalCIKEYCount(string order, out int num)
|
|
{
|
|
{
|
|
num = 0;
|
|
num = 0;
|
|
@@ -2443,7 +2439,7 @@ namespace MOKA_Factory_Tools
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- public static bool GetLocalStringKeys(string order,string keytype,int filesize,out FileStream fskey,out StreamReader brkey, out string data,out string filename,out string error, SQLiteConnection errorDBNow,ref MidList localmidList,string SN)
|
|
|
|
|
|
+ public static bool GetLocalStringKeys(string order, string keytype, int filesize, out FileStream fskey, out StreamReader brkey, out string data, out string filename, out string error, SQLiteConnection errorDBNow, ref MidList localmidList, string SN)
|
|
{
|
|
{
|
|
data = "";
|
|
data = "";
|
|
filename = "";
|
|
filename = "";
|
|
@@ -2451,13 +2447,13 @@ namespace MOKA_Factory_Tools
|
|
brkey = null;
|
|
brkey = null;
|
|
fskey = null;
|
|
fskey = null;
|
|
try
|
|
try
|
|
- {
|
|
|
|
- string keypath = LocalKeyPath + order + "\\"+ keytype;
|
|
|
|
|
|
+ {
|
|
|
|
+ string keypath = LocalKeyPath + order + "\\" + keytype;
|
|
if (Directory.Exists(keypath) == false)
|
|
if (Directory.Exists(keypath) == false)
|
|
{
|
|
{
|
|
error = "File not exist";
|
|
error = "File not exist";
|
|
return false;
|
|
return false;
|
|
- }
|
|
|
|
|
|
+ }
|
|
else
|
|
else
|
|
{
|
|
{
|
|
DirectoryInfo Getkeyfile = new DirectoryInfo(keypath);
|
|
DirectoryInfo Getkeyfile = new DirectoryInfo(keypath);
|
|
@@ -2468,9 +2464,9 @@ namespace MOKA_Factory_Tools
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- if(localmidList.host==null)
|
|
|
|
|
|
+ if (localmidList.host == null)
|
|
{
|
|
{
|
|
- if(CommonMethod.GetMidInfo(TestMode.serverurl, order, TestMode.MAC, "", "", errorDBNow, out localmidList))
|
|
|
|
|
|
+ if (CommonMethod.GetMidInfo(TestMode.serverurl, order, TestMode.MAC, "", "", errorDBNow, out localmidList))
|
|
{
|
|
{
|
|
;
|
|
;
|
|
}
|
|
}
|
|
@@ -2495,7 +2491,7 @@ namespace MOKA_Factory_Tools
|
|
keytype = "WiDi";
|
|
keytype = "WiDi";
|
|
else if (keytype == "CIKEY")
|
|
else if (keytype == "CIKEY")
|
|
keytype = "CI_PLUS_KEY";
|
|
keytype = "CI_PLUS_KEY";
|
|
- if (CommonMethod.GetKeys(localmidList.host, keytype, SN, localmidList.keytype[keytype], errorDBNow, out string did, out error, order,out string md5))
|
|
|
|
|
|
+ if (CommonMethod.GetKeys(localmidList.host, keytype, SN, localmidList.keytype[keytype], errorDBNow, out string did, out error, order, out string md5))
|
|
{
|
|
{
|
|
data = did;
|
|
data = did;
|
|
Log.WriteGetKeyLog("\r\n" + keytype + "= " + data);
|
|
Log.WriteGetKeyLog("\r\n" + keytype + "= " + data);
|
|
@@ -2505,14 +2501,12 @@ namespace MOKA_Factory_Tools
|
|
{
|
|
{
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
- catch(Exception ex)
|
|
|
|
|
|
+ catch (Exception ex)
|
|
{
|
|
{
|
|
error = ex.Message;
|
|
error = ex.Message;
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -2540,11 +2534,8 @@ namespace MOKA_Factory_Tools
|
|
;
|
|
;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
@@ -2621,14 +2612,12 @@ namespace MOKA_Factory_Tools
|
|
{
|
|
{
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
error = ex.Message;
|
|
error = ex.Message;
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -2657,7 +2646,6 @@ namespace MOKA_Factory_Tools
|
|
;
|
|
;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -2676,7 +2664,7 @@ namespace MOKA_Factory_Tools
|
|
{
|
|
{
|
|
for (int i = 0; i < filelist.Count; i++)
|
|
for (int i = 0; i < filelist.Count; i++)
|
|
{
|
|
{
|
|
- if(filelist[i].ToString().Contains("DeviceID"))
|
|
|
|
|
|
+ if (filelist[i].ToString().Contains("DeviceID"))
|
|
((StreamReader)Reader[i]).Dispose();
|
|
((StreamReader)Reader[i]).Dispose();
|
|
else
|
|
else
|
|
((BinaryReader)Reader[i]).Dispose();
|
|
((BinaryReader)Reader[i]).Dispose();
|
|
@@ -2686,9 +2674,9 @@ namespace MOKA_Factory_Tools
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
- return false;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
- catch(Exception ex)
|
|
|
|
|
|
+ catch (Exception ex)
|
|
{
|
|
{
|
|
for (int i = 0; i < Reader.Count; i++)
|
|
for (int i = 0; i < Reader.Count; i++)
|
|
{
|
|
{
|
|
@@ -2701,6 +2689,7 @@ namespace MOKA_Factory_Tools
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
public static bool UnlockLocalKeys(ArrayList filelist, ArrayList Stream, ArrayList Reader)
|
|
public static bool UnlockLocalKeys(ArrayList filelist, ArrayList Stream, ArrayList Reader)
|
|
{
|
|
{
|
|
for (int i = 0; i < Reader.Count; i++)
|
|
for (int i = 0; i < Reader.Count; i++)
|
|
@@ -2713,8 +2702,6 @@ namespace MOKA_Factory_Tools
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -2722,7 +2709,7 @@ namespace MOKA_Factory_Tools
|
|
/// </summary>
|
|
/// </summary>
|
|
public class LocalTxtRecord
|
|
public class LocalTxtRecord
|
|
{
|
|
{
|
|
- public static bool LocalRecord(string record,string name)
|
|
|
|
|
|
+ public static bool LocalRecord(string record, string name)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -2749,8 +2736,6 @@ namespace MOKA_Factory_Tools
|
|
{
|
|
{
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|