public async Task <byte[]> DeploySmartContract(int category, byte[] contract) { SmartContractRegistration registration = new SmartContractRegistration { Category = category, ContractBytes = ByteString.CopyFrom(contract), ContractHash = Hash.FromRawBytes(contract) }; var tx = Api.GetTransaction(); ulong serialNumber = _serialNumber.Increment().Value; var creator = Api.GetTransaction().From; var info = new ContractInfo() { Owner = creator, SerialNumber = serialNumber }; var address = info.Address; // calculate new account address var account = DataPath.CalculateAccountAddress(tx.From, tx.IncrementId); await Api.DeployContractAsync(account, registration); Console.WriteLine("TestContractZero: Deployment success, {0}", account.DumpHex()); return(account.DumpByteArray()); }
// Create the Doc Method public static void CreateWordDocument(object filename, object SaveAs, int copies) { // the instance of word Word.Application wordApp = new Word.Application(); Word.Document myWordDoc = null; wordApp.Visible = true; if (!File.Exists((string)filename)) { throw new IOException("File not Found!"); } for (int i = 1; i <= copies; i++) { // The passed in document myWordDoc = wordApp.Documents.Open(ref filename); myWordDoc.Activate(); //find and replace --------------------------------------------------------- SerialNumber oldNum = new SerialNumber(WhatToFind(myWordDoc)); FindAndReplace(wordApp, oldNum.ToString(), oldNum.Increment(i).ToString()); //Save as object name = (string)SaveAs + i; myWordDoc.SaveAs2(ref name); myWordDoc.Close(); } wordApp.Quit(); MessageBox.Show("Success!"); }
//Creeate the Doc Method private static void CreateWordDocument(object filename, object SaveAs) { Word.Application wordApp = new Word.Application(); Word.Document myWordDoc = null; if (File.Exists((string)filename)) { wordApp.Visible = false; myWordDoc = wordApp.Documents.Open(ref filename); myWordDoc.Activate(); //find and replace SerialNumber oldNum = new SerialNumber(WhatToFind(myWordDoc)); FindAndReplace(wordApp, oldNum.ToString(), oldNum.Increment().ToString()); } else { throw new IOException("File not found!"); } string s = myWordDoc.Content.Text; //Save as myWordDoc.SaveAs2(ref SaveAs); myWordDoc.Close(); wordApp.Quit(); Console.WriteLine("Success!"); }