public static Peers ReadPeers() { string path = System.IO.Directory.GetCurrentDirectory() + "\\peers.json"; Peers peers = new Peers(); using (StreamReader file = File.OpenText(path)) { JsonSerializer serializer = new JsonSerializer(); peers = (Peers)serializer.Deserialize(file, typeof(Peers)); } return(peers); }
public void NewPeers(Peers new_peers) { to_merge.Add(new_peers); }
private void ReceivePeers(PacketHeader packetHeader, Connection connection, string peer_list) { Peers new_peers = Serialize.DeserializePeers(peer_list); network.NewPeers(new_peers); }
public static void WritePeers(Peers peers) { //MessageBox.Show("Saving: " + SerializePeers(peers)); File.WriteAllText(System.IO.Directory.GetCurrentDirectory() + "\\peers.json", SerializePeers(peers)); }
public static string SerializePeers(Peers peers) { return(JsonConvert.SerializeObject(peers, Newtonsoft.Json.Formatting.Indented)); }