public void fromJson(Dictionary <string, object> v) { if (v.ContainsKey("check_type")) //配置校验类型 { string s = json_ser.Serialize(v["check_type"]); check_type = json_ser.Deserialize <CHECK_TYPE>(s); //取得参数类型 } if (v.ContainsKey("syn")) //配置同步字 { ArrayList list = v["syn"] as ArrayList; SYNC = new byte[list.Count]; for (int i = 0; i < list.Count; i++) //读取同步字列表 { //是16进制 string s = list[i] as string; s = s.Replace("0x", ""); SYNC[i] = byte.Parse(s, System.Globalization.NumberStyles.HexNumber); } } if (v.ContainsKey("pre_offset")) { pre_offset = (byte)(int)v["pre_offset"]; //配置确定包长的偏移位置 } if (v.ContainsKey("pack_len")) { pack_len = (int)v["pack_len"]; //配置包长 } else { pack_len = pre_offset + 1; } if (v.ContainsKey("len_dom_off")) { len_dom_off = (int)v["len_dom_off"]; // } if (v.ContainsKey("len_dom")) { var vt = v["len_dom"] as Dictionary <string, object>; string s = json_ser.Serialize(vt["type"]); DataType t = json_ser.Deserialize <DataType>(s); //取得参数类型 len_dom = new PD_Node(vt, t, null); //一定没有引用参数,所以不使用测控架构对象 } if (v.ContainsKey("len_dict")) //读取长度列表 { var vd = v["len_dict"] as Dictionary <string, object>; foreach (var item in vd) { string s = item.Key; int k = 0; if (s.StartsWith("0x")) //若是16进制 { k = int.Parse(s.Substring(2), System.Globalization.NumberStyles.HexNumber); } else { k = int.Parse(s); } len_dict[k] = (int)item.Value; } } }
public ActionsComponent OnCheck(CHECK_TYPE type) { switch (type) { case CHECK_TYPE.COMFIRM: return(OnCheck(_ => Checks.Confirm())); case CHECK_TYPE.CLOSE: return(OnCheck(_ => Checks.Close())); case CHECK_TYPE.REMOVE: return(OnCheck(_ => Checks.Remove())); } return(this); }
private void _InitiateCheck() { if (_pw_filepath.ToLower().Contains("ntlm")) { _check_type = CHECK_TYPE.NTLM; MessageBoxResult dr = MessageBox.Show(this, "Initiating NTLM password check based on file name.\nIs this correct? (No will start SHA-1 Check)", "Password Checker", MessageBoxButton.YesNo, MessageBoxImage.Question); if (dr == MessageBoxResult.No) { _check_type = CHECK_TYPE.SHA1; } } else //SHA1 assumed { _check_type = CHECK_TYPE.SHA1; MessageBoxResult dr = MessageBox.Show(this, "Initiating SHA-1 password check based on file name.\nIs this correct? (No will start NTLM Check)", "Password Checker", MessageBoxButton.YesNo, MessageBoxImage.Question); if (dr == MessageBoxResult.No) { _check_type = CHECK_TYPE.NTLM; } } if (_checkThread != null && _checkThread.IsAlive) { MessageBoxResult dr = MessageBox.Show(this, "Do you want to cancel the current check?", "Password Checker", MessageBoxButton.YesNo, MessageBoxImage.Exclamation); if (dr == MessageBoxResult.Yes) { _checkThread.Abort(); _checkThread = null; _running = false; } else { return; } } _result = ""; //purge last result _user_pw = txtPassword.Text; if (string.IsNullOrEmpty(_user_pw)) { MessageBox.Show(this, "Please enter a password to check.", "Password Checker", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } _checkThread = new Thread(new ThreadStart(_Check)); _checkThread.Start(); }