public string ReportOptions(Report report) { StringBuilder sb = new StringBuilder(); sb.AppendLine("==============================================================================="); sb.AppendLine("[Global scope options]"); sb.AppendLine(ArgsOnlyHandler.Report()); sb.AppendLine(DebugHandler.Report()); sb.AppendLine(InitFileHandler.Report()); sb.AppendLine(ScriptHandler.Report()); sb.AppendLine(TraceHandler.Report()); sb.AppendLine(VerboseHandler.Report()); sb.AppendLine(VerifyHandler.Report()); sb.AppendLine(VerifyMemoryHandler.Report()); sb.AppendLine("[Session scope options]"); sb.AppendLine(report.Session.ReportOptions()); sb.AppendLine("[Report scope options]"); sb.AppendLine(report.ReportOptions()); sb.AppendLine("==============================================================================="); return(sb.ToString()); }
/// <summary> /// Initializes a new instance of the KeyedSignatureProvider class. /// </summary> /// <param name="verifyHandler">The verify handler.</param> /// <param name="secret">The secret.</param> /// <param name="name">The signature algorithm name.</param> public KeyedSignatureProvider(VerifyHandler verifyHandler, string secret, string name) { secretBytes = Encoding.ASCII.GetBytes(secret); Name = name; verify = verifyHandler; CanSign = true; }
/// <summary> /// Initializes a new instance of the KeyedSignatureProvider class. /// </summary> /// <param name="verifyHandler">The verify handler.</param> /// <param name="secret">The secret.</param> /// <param name="name">The signature algorithm name.</param> public KeyedSignatureProvider(VerifyHandler verifyHandler, byte[] secret, string name) { secretBytes = secret; Name = name; verify = verifyHandler; CanSign = true; }
private void VerifyLogin() { responseBox.gameObject.SetActive(true); if (!Utils.IsValidEmail(emailInput.text)) { responseBox.text = "<color=red>Invalid email!"; return; } else if (string.IsNullOrEmpty(passwordInput.text)) { responseBox.text = "<color=red>Please enter a password!"; return; } VerifyHandler verify = new VerifyHandler(emailInput.text, passwordInput.text); if (verify.SendRequest()) { responseBox.text = "<color=green>Successfully logged in!"; Account.set(emailInput.text, passwordInput.text); Account.onAccountChange(); Destroy(this.gameObject); } else { responseBox.text = "<color=red>Invalid Login!"; } }
public static bool verify() { if (credentials == null) { return(false); } var verify = new VerifyHandler(credentials.guid, credentials.password); return(verify.SendRequest()); }
//开机同步 public static bool syncOnstart(string home, Socket curClientSocket) { string paraHome = home.Substring(0, home.Length - 1); VerifyHandler.verify(curClientSocket); if (!findFileAndSync(paraHome, curClientSocket, paraHome)) { return(false); } // flag = 2 表示已同步完成 VerifyHandler.postMessage(curClientSocket, MessageAssembler.assembleDone()); return(true); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "image/gif"; context.Response.CacheControl = "no-cache"; VerifyHandler vh = new VerifyHandler(64, 20, "uverify"); vh.BackGroundColor = Color.FromArgb(193, 223, 237); Bitmap basemap = vh.GetImg(); basemap.Save(context.Response.OutputStream, ImageFormat.Gif); }
// 递归查找当前主目录 public static bool findFileAndSync(string home, Socket curClientSocket, string constHome) { string fullPath = null; string paraPath = null; DirectoryInfo Dir = new DirectoryInfo(home); try { // 查找子目录 foreach (DirectoryInfo d in Dir.GetDirectories()) { fullPath = Dir + "\\" + d.ToString(); paraPath = fullPath.Substring(constHome.Length + 1, fullPath.Length - constHome.Length - 1); // flag = 0 时表示同步的是文件夹 string lastWriteTime = Directory.GetLastWriteTime(fullPath).ToString(); byte[] message = MessageAssembler.assembleDir(paraPath, lastWriteTime); VerifyHandler.postMessage(curClientSocket, message); VerifyHandler.verify(curClientSocket); findFileAndSync(fullPath, curClientSocket, constHome); } // 查找文件 foreach (FileInfo f in Dir.GetFiles()) { fullPath = Dir + "\\" + f.ToString(); paraPath = fullPath.Substring(constHome.Length + 1, fullPath.Length - constHome.Length - 1); // flag = 1 时表示同步的是文件 string lastWriteTime = File.GetLastWriteTime(fullPath).ToString(); byte[] message = MessageAssembler.assembleFile(paraPath, lastWriteTime); VerifyHandler.postMessage(curClientSocket, message); if (!VerifyHandler.verify(curClientSocket)) { FileTransferHandler.postFile(curClientSocket, fullPath); VerifyHandler.verify(curClientSocket); } } return(true); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); return(false); } }
public static bool syncNow(string home, Socket curClientSocket) { bool loop = true; string fullPath = null; string para1 = null; string para2 = null; DateTime lastWriteTime = new DateTime(); byte[] receiveBytes = new byte[CommonStaticVariables.constSize]; while (loop) { if (curClientSocket.Poll(100, SelectMode.SelectRead)) { int successReceiveBytes = curClientSocket.Receive(receiveBytes); string[] parMessage; if ((parMessage = MessageParser.parseFileMessage(receiveBytes)) != null) { string flag = parMessage[0]; para1 = parMessage[1]; para2 = parMessage[2]; switch (flag) { case "0": // 文件夹 fullPath = home + "\\" + para1; lastWriteTime = DateTime.Parse(para2); if (!Directory.Exists(fullPath)) { Directory.CreateDirectory(fullPath); } Directory.SetLastWriteTime(fullPath, lastWriteTime); VerifyHandler.postMessage(curClientSocket, CommonStaticVariables.messageDoneEncrypted); break; case "1": // 文件 fullPath = home + "\\" + para1; lastWriteTime = DateTime.Parse(para2); if (!File.Exists(fullPath)) { VerifyHandler.postMessage(curClientSocket, CommonStaticVariables.messageFailedEncrypted); // 接收从客户器端传来的文件 FileTransferHandler.receiveFile(fullPath, lastWriteTime, curClientSocket); VerifyHandler.postMessage(curClientSocket, CommonStaticVariables.messageDoneEncrypted); // 接收从客户器端传来的文件 } else { if (lastWriteTime == File.GetLastWriteTime(fullPath)) { VerifyHandler.postMessage(curClientSocket, CommonStaticVariables.messageDoneEncrypted); } else { VerifyHandler.postMessage(curClientSocket, CommonStaticVariables.messageFailedEncrypted); // 接收从客户器端传来的文件 FileTransferHandler.receiveFile(fullPath, lastWriteTime, curClientSocket); VerifyHandler.postMessage(curClientSocket, CommonStaticVariables.messageDoneEncrypted); } } break; case "2": // 同步完成 loop = false; break; default: break; } } } } return(true); }
/// <summary> /// Initializes a new instance of the KeyedSignatureProvider class. /// </summary> /// <param name="signHandler">The signature handler.</param> /// <param name="verifyHandler">The verify handler.</param> /// <param name="secret">The secret.</param> /// <param name="name">The signature algorithm name.</param> public KeyedSignatureProvider(SignHandler signHandler, VerifyHandler verifyHandler, string secret, string name) : this(signHandler, secret, name) { verify = verifyHandler; }
public JPromptTextBox() { InitializeComponent(); Verify += new VerifyHandler(JPromptTextBox_Verify); LayoutUI(); }