public UTXOCoin Clone() { UTXOCoin coin = new UTXOCoin(); coin.fromID = this.fromID; coin.fromN = this.fromN; coin.assetID = this.assetID; coin.value = this.value; return(coin); }
private void ListBox_Drop(object sender, DragEventArgs e) { Tools.UTXOCoin coin = e.Data.GetData(typeof(Tools.UTXOCoin)) as Tools.UTXOCoin; foreach (Tools.Input itemcoin in listInput.Items) { if (itemcoin.Coin.fromID == coin.fromID && itemcoin.Coin.fromN == coin.fromN) { MessageBox.Show("already have this input."); return; } } var input = new Tools.Input(); input.Coin = coin.Clone(); var pubkey = ThinNeo.Helper.GetPublicKeyFromPrivateKey(this.privatekey); input.From = ThinNeo.Helper.GetScriptHashFromPublicKey(pubkey); listInput.Items.Add(input); updateOutput(); }
public void ParseUTXO(MyJson.JsonNode_Array jsonarray) { Dictionary <string, CoinType> cointype = new Dictionary <string, CoinType>(); foreach (var item in jsonarray) { var asset = item.AsDict()["asset"].AsString(); if (cointype.ContainsKey(asset) == false) { var ctype = new CoinType(asset); cointype[asset] = ctype; allcoins.Add(ctype); } var coins = cointype[asset]; var coin = new UTXOCoin(); coin.assetID = asset; coin.fromID = item.AsDict()["txid"].AsString(); coin.fromN = item.AsDict()["n"].AsInt(); var value = decimal.Parse(item.AsDict()["value"].AsString()); coin.value = value; coins.coins.Add(coin); } }