private void ParseResponse(byte[] result) { string message = Encoding.Default.GetString(result); Operation msg = JsonConvert.DeserializeObject <Operation>(message); switch (msg.op) { case "auth": rsa = new RSACrypto(File.ReadAllText("pri.key"), true); break; case "list_file": lvFileBrowser.Items.Clear(); int id = 1; foreach (string i in msg.param) { ListViewItem tmp = new ListViewItem(new string[] { id.ToString(), i, "Not Download" }); lvFileBrowser.Items.Add(tmp); id++; } break; case "send_file": string path = "data/" + msg.param[0]; File.WriteAllBytes(path, rsa.DecodeOrNull(RSA_Unit.Base64DecodeBytes(msg.param[1]))); if (HashTool.SHA256File(new FileStream(path, FileMode.Open)) == msg.param[2]) { lvFileBrowser.SelectedItems[0].SubItems[2].Text = "Verified"; } else { lvFileBrowser.SelectedItems[0].SubItems[2].Text = "Error"; } break; default: break; } }