private static JObject GetRelayResult(VerifyResult reason, UInt256 hash) { if (reason == VerifyResult.Succeed) { var ret = new JObject(); ret["hash"] = hash.ToString(); return(ret); } else { throw new RpcException(-500, reason.ToString()); } }
private void btnGo_Click(object sender, EventArgs e) { bool VerifyResult; bool goVerify; double psnr; string vFileName; TextBox tb; vFileName = Path.GetFileNameWithoutExtension(this.tbPath1.Text) + "-V" + Path.GetExtension(this.tbPath1.Text); VerifyResult = true; goVerify = File.Exists(vFileName); if (goVerify) { tb = new TextBox(); tb.Text = vFileName; this.LoadSource(tb); } if (this.pbSource.Image == null) { this.btnOpenS_Click(sender, e); } if (this.pbSource.Image == null) { return; } if (goVerify) { Image img; img = this.pbTarget.Image; VerifyResult = ImageValidate.Verify(this.pbSource.Image, ref img); this.pbTarget.Image = img; } else { this.pbTarget.Image = ImageValidate.MakeVerifiable(this.pbSource.Image); this.pbTarget.Image.Save( vFileName , ((this.pbSource.Image.RawFormat.Guid == ImageFormat.MemoryBmp.Guid) ? ImageFormat.Bmp : this.pbSource.Image.RawFormat)); } this.tbTarget.Text = "" + "Width: " + this.pbTarget.Width.ToString() + "\r\n" + "Height: " + this.pbTarget.Height.ToString() + "\r\n" + "Format: " + this.GetImageFormat(this.pbTarget.Image); if (goVerify) { this.tbTarget.Text += "\r\n\r\n" + "Verify: " + VerifyResult.ToString(); } psnr = Quality.PSNR(this.pbSource.Image, this.pbTarget.Image); if (Double.IsNaN(psnr)) { this.tbTarget.Text += "\r\n\r\n" + "Images are identical."; } else { this.tbTarget.Text += "\r\n\r\n" + "PSNR: " + psnr.ToString("00.0000"); } }