private void load_data(string file = "") { if (file == "") { return; } MySerializer serializer = new MySerializer(); Data2 d2 = serializer.DeserializeObject(file).Data2; Rlist = d2.players; reLoad_data(); }
private void append_data(string file = "") { if (file == "") { return; } MySerializer serializer = new MySerializer(); Data2 d2 = serializer.DeserializeObject(file).Data2; Rlist = new List <Short_player>(tvlData.short_players.Union(d2.players, new PlComparer())); reLoad_data(); }
private void save_data(string file = "") { if (file == "") { file = $"{AppDomain.CurrentDomain.BaseDirectory}Отчеты" + Path.DirectorySeparatorChar + "Турнир " + DateTime.Now.ToString("dd-MM-yyyy hh.mm") + " Рейтинг-лист.tvrl"; } Data2 d2 = new Data2(); if (Rlist != null) { d2.players = Rlist; } SerializableObject obj = new SerializableObject(); obj.Data2 = d2; MySerializer serializer = new MySerializer(); serializer.SerializeObject(file, obj); }
public SerializableObject(SerializationInfo sInfo, StreamingContext contextArg) { this.data = (Data)sInfo.GetValue("data", typeof(Data)); this.data2 = (Data2)sInfo.GetValue("data2", typeof(Data2)); }