private void UpdateNodeBinary(Node node, int version, byte[] compressedFile) { AsyncServerNodeNodeBinUpdateCastMessage msg = new AsyncServerNodeNodeBinUpdateCastMessage(); msg.updateVersion = version; //msg.compressedFile = compressedFile; if (!node.GetAsyncCommSender().SendCast(msg)) Console.WriteLine("[Error] SendCast failed!"); }
//public bool UpdateNodeBinary(string nodeKey, int version) //{ // Node node = GetNodeByNodeKey(nodeKey); // if (node != null) // return UpdateNodeBinary(node, version); // return false; //} public bool UpdateNodeBinary(Node node, int version) { string updateFilename = version + ".zip"; string binaryPath = Path.Combine(Environment.CurrentDirectory, "NodeBinaries"); string updateFileFullpath = Path.Combine(binaryPath, updateFilename); try { byte[] compressedFile = File.ReadAllBytes(updateFileFullpath); AsyncServerNodeNodeBinUpdateCastMessage msg = new AsyncServerNodeNodeBinUpdateCastMessage(); msg.updateVersion = version; //msg.compressedFile = compressedFile; if (!node.GetAsyncCommSender().SendCast(msg)) Console.WriteLine("[Error] SendCast failed!"); return true; } catch (FileNotFoundException) { Console.WriteLine("[Error][NodeManager][UpdateNodeBinary] FIle not found. " + updateFileFullpath); return false; } }