public void Reads(int _inpbs, string path) { int _inpts = _inpbs - 1; object arryPR = DeserelzeD.DeserD(path); UserPrefs arrPR = (UserPrefs)arryPR; switch (_inpts) { case 0: object _wor = arrPR.Wor; var _liseW = (Dictionary <string, object>)_wor; foreach (KeyValuePair <string, object> id in _liseW) { _keys = id.Key.ToString(); _values = id.Value; Console.WriteLine(_keys); } Wor _vorse = (Wor)_values; Console.WriteLine(_vorse.Soname); Console.WriteLine(_vorse.Name); Console.WriteLine(_vorse.Father); Console.WriteLine(_vorse.Probl); break; case 1: object _kilK = arrPR.Kiler; var _liseK = (Dictionary <string, object>)_kilK; foreach (KeyValuePair <string, object> id in _liseK) { _keys = id.Key.ToString(); _values = id.Value; Console.WriteLine(_keys); } Kiler _kil = (Kiler)_values; Console.WriteLine(_kil.Soname); Console.WriteLine(_kil.Name); Console.WriteLine(_kil.Father); Console.WriteLine(_kil.Probl); break; case 2: object _kilB = arrPR.Bandit; var _liseB = (Dictionary <string, object>)_kilB; foreach (KeyValuePair <string, object> id in _liseB) { _keys = id.Key.ToString(); _values = id.Value; Console.WriteLine(_keys); } Band _ban = (Band)_values; Console.WriteLine(_ban.Soname); Console.WriteLine(_ban.Name); Console.WriteLine(_ban.Father); Console.WriteLine(_ban.Probl); break; } }
public void Work(string soname, string name, string fatger, int _inpb, string path) { //Добавити масив облікі int _inpbs = _inpb - 1; try { arrp = (UserPrefs)DeserelzeD.DeserD(path); } catch { arrp = new UserPrefs(); } switch (_inpbs) { //Прописати для запису обліків case 0: try { _wors = (Dictionary <string, object>)arrp.Wor; foreach (KeyValuePair <string, object> id in _wors) { string _keys = id.Key.ToString(); string _keses = String.Format("{0} {1} {2}", soname, name, fatger); if (String.Equals(_keys, _keses)) { _wors.Remove(_keses); } } } catch { _wors = new Dictionary <string, object>(); } object wores = ProfWorc(vors, soname, name, fatger, _inpbs); string _namesDW = String.Format("{0} {1} {2}", soname, name, fatger); Wor wors = (Wor)wores; _wors.Add(_namesDW, wores); userData.Wor = _wors; userP = ZagProf(userData, arrp, _inpbs); userPrefsd = (UserPrefs)userP; userData = userPrefsd; break; case 1: try { _kils = (Dictionary <string, object>)arrp.Kiler; foreach (KeyValuePair <string, object> id in _kils) { string _keys = id.Key.ToString(); string _keses = String.Format("{0} {1} {2}", soname, name, fatger); if (String.Equals(_keys, _keses)) { _kils.Remove(_keses); } } } catch { _kils = new Dictionary <string, object>();; } object kulees = ProfWorc(kils, soname, name, fatger, _inpbs); string _namesDK = String.Format("{0} {1} {2}", soname, name, fatger); Kiler kilesed = (Kiler)kulees; _kils.Add(_namesDK, kilesed); userData.Kiler = _kils; userP = ZagProf(userData, arrp, _inpbs); userPrefsd = (UserPrefs)userP; userData = userPrefsd; break; case 2: try { _band = (Dictionary <string, object>)arrp.Bandit; foreach (KeyValuePair <string, object> id in _band) { string _keys = id.Key.ToString(); string _keses = String.Format("{0} {1} {2}", soname, name, fatger); if (String.Equals(_keys, _keses)) { _band.Remove(_keses); } } } catch { _band = new Dictionary <string, object>(); } object bundus = ProfWorc(band, soname, name, fatger, _inpbs); string _namesDB = String.Format("{0} {1} {2}", soname, name, fatger); Band bundused = (Band)bundus; _band.Add(_namesDB, bundused); userData.Bandit = _band; userP = ZagProf(userData, arrp, _inpbs); userPrefsd = (UserPrefs)userP; userData = userPrefsd; break; default: Console.Write("Good"); break; } object lister = userData; SerelizeD.SrelD(lister, path); }