public override void Save(JToken jObject, string path) { JObject result = new JObject(); result["txid"] = jObject["txid"]; result["size"] = jObject["size"]; result["type"] = jObject["type"]; result["version"] = jObject["version"]; result["attributes"] = jObject["attributes"]; result["vin"] = jObject["vin"]; result["vout"] = jObject["vout"]; result["sys_fee"] = jObject["sys_fee"]; result["net_fee"] = jObject["net_fee"]; result["scripts"] = jObject["scripts"]; result["nonce"] = jObject["nonce"]; result["blockindex"] = Helper.blockHeight; List <string> slist = new List <string>(); slist.Add(result["txid"].ToString()); slist.Add(result["size"].ToString()); slist.Add(result["type"].ToString()); slist.Add(result["version"].ToString()); slist.Add(result["attributes"].ToString()); slist.Add(result["vin"].ToString()); slist.Add(result["vout"].ToString()); slist.Add(result["sys_fee"].ToString()); slist.Add(result["net_fee"].ToString()); slist.Add(result["scripts"].ToString()); slist.Add(result["nonce"].ToString()); slist.Add(Helper.blockHeight.ToString()); MysqlConn.ExecuteDataInsert("tx", slist); //File.Delete(path); //File.WriteAllText(path, result.ToString(), Encoding.UTF8); SaveAddress.getInstance().Save(result["vout"], null); SaveUTXO.getInstance().Save(result, null); var addressTransactionPath = "addressTransaction" + Path.DirectorySeparatorChar + result["txid"] + ".txt"; SaveAddressTransaction.getInstance().Save(result, addressTransactionPath); if (result["type"].ToString() == "RegisterTransaction") { var assetPath = "asset" + Path.DirectorySeparatorChar + result["txid"] + ".txt"; saveAsset(jObject, assetPath); } else if (result["type"].ToString() == "InvocationTransaction") { SaveNotify.getInstance().Save(result, null); } }
public override void Save(JToken jObject, string path) { JObject result = new JObject(); result["txid"] = jObject["txid"]; result["size"] = jObject["size"]; result["type"] = jObject["type"]; result["version"] = jObject["version"]; result["attributes"] = jObject["attributes"]; result["vin"] = jObject["vin"]; result["vout"] = jObject["vout"]; result["sys_fee"] = jObject["sys_fee"]; result["net_fee"] = jObject["net_fee"]; result["scripts"] = jObject["scripts"]; result["nonce"] = jObject["nonce"]; result["blockindex"] = Helper.blockHeight; File.Delete(path); // File.WriteAllText(path, result.ToString(), Encoding.UTF8); // SaveAddress.getInstance().Save(result["vout"], null); SaveUTXO.getInstance().Save(result, null); var addressTransactionPath = "addressTransaction" + Path.DirectorySeparatorChar + result["txid"] + ".txt"; // SaveAddressTransaction.getInstance().Save(result, addressTransactionPath); if (result["type"].ToString() == "RegisterTransaction") { if (Directory.Exists("asset") == false) { Directory.CreateDirectory("asset"); } var assetPath = "asset" + Path.DirectorySeparatorChar + result["txid"] + ".txt"; // saveAsset(jObject, assetPath); } else if (result["type"].ToString() == "InvocationTransaction") { // SaveNotify.getInstance().Save(result, null); } }