|
@@ -296,6 +296,197 @@ namespace MOKA_Factory_Tools
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public static bool CheckKeyType(Dictionary<string, string> keyTypes, Config_WriteDone cfg_write, out List<KeyType> resultKeyType)
|
|
|
+ {
|
|
|
+ resultKeyType = new List<KeyType>();
|
|
|
+
|
|
|
+ Func<string, List <KeyType> ,bool > check_key_type = (keyname, listType) =>
|
|
|
+ {
|
|
|
+ if (!keyTypes.ContainsKey(keyname)) {
|
|
|
+ Log.WriteErrorLog(string.Format("{0} is not included in the available key type of the order", keyname));
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ KeyType keyType = new KeyType();
|
|
|
+ keyType.name = keyname;
|
|
|
+ keyType.type = keyTypes[keyname];
|
|
|
+ listType.Add(keyType);
|
|
|
+ return true;
|
|
|
+ };
|
|
|
+
|
|
|
+ if (cfg_write.DIDWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("DeviceID", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.MacWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("MAC", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.HDCPWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("HDCP_KEY", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.HDCP22Write_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("HDCP2.2_KEY", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.ESNWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("NETFILX_ESN", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.WidevineWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("Widevine_KEY", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.CI_plusWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("CI_PLUS_KEY", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.AttestationWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("Attestation_key", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.MGKWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("MGK_KEY", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.FairplayWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("Fairplay_KEY", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.ECPWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("ECP_KEY", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.WifiMacWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("WiFi_MAC", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.BTMacWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("BT_MAC", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.LEKWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("LEK", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.PEKWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("PEK", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.PlayreadyWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("PlayReady_key", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.HashWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("Hashkey", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.DSNWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("DSN", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.YouTubeWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("YouTube_KEY", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.ACASKeyWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("ACAS_KEY", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg_write.DAKWrite_YesNo)
|
|
|
+ {
|
|
|
+ if (!check_key_type("DAK", resultKeyType))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Log.WriteInfoLog("key type of order need to copy="+resultKeyType.ToString());
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 获取预绑定模式下的key包地址
|
|
|
/// </summary>
|
|
@@ -488,7 +679,7 @@ namespace MOKA_Factory_Tools
|
|
|
/// <param name="error"></param>
|
|
|
/// <param name="md5"></param>
|
|
|
/// <returns></returns>
|
|
|
- public static bool GetIDMKeys(string url, string sn, string order, string psn, string firetv_device_code, SQLiteConnection connection, out KeyInfo keys, out string msg)
|
|
|
+ public static bool GetIDMKeys(string url, string sn, string order, string psn, string firetv_device_code, List<KeyType> key2Write, SQLiteConnection connection, out KeyInfo keys, out string msg)
|
|
|
{
|
|
|
msg = "";
|
|
|
keys = new KeyInfo();
|
|
@@ -509,7 +700,7 @@ namespace MOKA_Factory_Tools
|
|
|
watch.Start();
|
|
|
|
|
|
item.URL = url + "/v1/bind/order";
|
|
|
- item.Postdata = string.Format("{{\"orderNum\":\"{0}\",\"sn\":\"{1}\",\"psn\":\"{2}\",\"orderCode\":\"{3}\"}}", order, sn, psn, firetv_device_code);
|
|
|
+ item.Postdata = string.Format("{{\"orderNum\":\"{0}\",\"sn\":\"{1}\",\"psn\":\"{2}\",\"orderCode\":\"{3}\",\"skipKey\":{4}}}", order, sn, psn, firetv_device_code, key2Write == null ? "[]" : JsonConvert.SerializeObject(key2Write).ToString());
|
|
|
HttpResult httpResult = http.GetHtml(item);
|
|
|
if (httpResult.StatusCode == System.Net.HttpStatusCode.OK)
|
|
|
{
|