private void button3_Click(object sender, EventArgs e) { //string hname = "C65C320D3B3A12772390729BC3C3D80BD90C6DC212C2F13A76BB1745DD84E341C0AAB73559D19A16F4B80A2013145B6B107BBB17CE08D6FEE6163AE28AC4F443"; string hname = "A53257D683D8ABFE85961C5575A072518C36ED16BB408A27C9073F0DB1DC615844909A4E699131CD6747F1B16CA2FC1CE6B1D0896560D3129EC9778BB026B63C"; HashType h = new HashType(); h.FromString(hname); // string tmpfile = Path.GetTempFileName(); try { using (RAPIlib.Connector node = new Connector()) { h = node.cmdGetLastHash(); //byte[] buf = node.cmdGetBinaryPart(h,0,0,75131); byte[] buf = node.cmdGetBinaryData(h); if (buf.Length != 0) { string tmpfile = Path.GetTempFileName(); File.WriteAllBytes(tmpfile, buf); Form2 f = new Form2(); f.Show(); f.pictureBox1.ImageLocation = tmpfile; try { f.pictureBox1.Load(); } catch (System.Exception ex) { Graphics gr = f.pictureBox1.CreateGraphics(); gr.DrawString(string.Format("error loading image:\r\n{0}", ex.Message), new Font("Arial", 24), new SolidBrush(Color.Black), new PointF(150.0F, 150.0F)); return; } //f.pictureBox1.ImageLocation = ""; } else { throw new System.Exception("block not contained binary data"); } } } catch (System.Exception ex) { MessageBox.Show(string.Format("[{0}]:{1}", ex.HResult, ex.Message), "RAPIlib ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void button6_Click(object sender, EventArgs e) { string blstr = "0EBE78BD45F1132A0519DE10941D9EF891259AC8D99709FC71EE0B312FEC30E108A85459816138C4AE90E56DCE69A1457FAB870B4186CA8FF3B74D9E6004C9AA"; //blstr = "2741B2E98188EC7DDB42B42048FC527BE65BA2949537252D7BD468D82751985EA4AE0CD09D72FFD8A2FFFF553ADC3413A08B1A488529F0442FD66D722DE0C5A9"; blstr = "A7DA4EFA7637FC5F816C6233F59CADE40064C664313DEF044D192F71DF8FC9CB256062207ECD23CDD1C0585DB0490520BE72531FBC584F0864F3350811132535"; HashType bl = new HashType(); bl.FromString(blstr); List <HashType> lst = new List <HashType>(); using (RAPIlib.Connector node = new Connector()) { bl = node.cmdGetLastHash(); lst = node.cmdGetTransactions(bl, 0, 1); if (lst.Count == 0) { MessageBox.Show("no returned transactions"); } else { string ret = string.Format("returned {0} transactions:\r\n", lst.Count); foreach (HashType i in lst) { ret += string.Format("{0}\r\n", i.ToString()); } //MessageBox.Show(ret); } } if (lst.Count > 0) { using (RAPIlib.Connector node = new Connector()) { Transaction tr = node.cmdGetTransaction(bl, lst[0]); string res = string.Format("sign: {0}\r\nsender: {1}\r\nreceiver: {2}\r\namount: {3}\\{4}\r\ncurrency: {5}", tr.signature.ToString(), tr.sender.ToString(), tr.receiver.ToString(), tr.amount_high.ToString(), tr.amount_low.ToString(), tr.currency); MessageBox.Show(res); } } }