public async Task Save() { UserSettingsPOCOs up = new UserSettingsPOCOs(); up.Host = this.Host; up.UserName = this.UserName; up.Password = this.Password; up.CameraList = this.CameraList; up.UsersList = this.UsersList; string _ptch = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Cript cr = new Cript(); string jstr = cr.CriptMe(JsonSerializer.Serialize <UserSettingsPOCOs>(up)); File.WriteAllText(_ptch + "\\ust.dat", jstr); await Task.CompletedTask; }
public async Task Load() { string _ptch = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (File.Exists(_ptch + "\\ust.dat")) { UserSettingsPOCOs up = new UserSettingsPOCOs(); Cript cr = new Cript(); string datStr = File.ReadAllText(_ptch + "\\ust.dat"); string decriptedStr = cr.DeCriptMe(datStr); up = JsonSerializer.Deserialize <UserSettingsPOCOs>(decriptedStr); this.Host = up.Host; this.UserName = up.UserName; this.Password = up.Password; this.UsersList = up.UsersList; this.CameraList = up.CameraList; } await Task.CompletedTask; }