public int Initialize(Cryptography ex_cryptography, FileTransfering ex_filetransfering, FileSystem ex_filesystem, UDPServer ex_server, GetLogic ex_getlogic, Transactions ex_transactions, bool ex_debug) { cryptography = ex_cryptography; debug = ex_debug; filesystem = ex_filesystem; filetransfering = ex_filetransfering; getlogic = ex_getlogic; server = ex_server; transactions = ex_transactions; //window.WriteLine("class Blocks: initialized"); return(1); }
public async Task <int> Initialize(Cryptography main_cryptography, Blocks mine, FileSystem main_filesystem, UDPServer server, bool main_debug) { byte[] data; try { cryptography = main_cryptography; filesystem = main_filesystem; debug = main_debug; version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); self_location = System.Reflection.Assembly.GetExecutingAssembly().Location; data = await filesystem.GetFromFileAsync(self_location); self_size = data.Length; exe_hash = cryptography.GetSHA256Hash(data); TwoBytesArrays temp = new TwoBytesArrays(); temp.part1 = OperationToBytes(version, Updating.version_size); temp.part2 = data; data = ByteArrayJoin(temp); signed_hash = cryptography.GetSHA256Hash(data); block_version = Blocks.block_version; await ActualizeSelfSignature(); filesystem_version = filesystem.FSConfig.version; port = server.Port; //window.WriteLine("class Information: initialized"); return(1); } catch (Exception e) { Debug.WriteLine("class Information: FAILED"); Debug.WriteLine(e.ToString()); return(0); } }
public int Initialize(FileSystem ex_filesystem, UdpClient ex_socket, FileTransfering ex_filetransfering, Cryptography ex_cryptography, UDPServer ex_server, Information ex_information, Blocks ex_blocks, bool ex_debug) { filesystem = ex_filesystem; socket = ex_socket; filetransfering = ex_filetransfering; cryptography = ex_cryptography; debug = ex_debug; blocks = ex_blocks; server = ex_server; information = ex_information; //window.WriteLine("class GetLogic: initialized"); return(1); }