public async static void LoadSmartLinks() { if (PABXFile <SmartLinkSettings> .Exists("smartlink.bbsconf")) { SmartLinkConfig = await PABXFile <SmartLinkSettings> .LoadObjectAsync("smartlink.bbsconf"); } }
public static async void LoadContacts() { UserContacts = await PABXFile <Dictionary <string, UserContactData> > .LoadObjectAsync("contacts.json"); DebuggingTools.VarDump(UserContacts); if (UserContacts == null) { UserContacts = new Dictionary <string, UserContactData>(); } }
public static async void LoadCalls() { if (File.Exists("recent.json")) { UserCalls = await PABXFile <List <UserCallData> > .LoadObjectAsync("recent.json"); } else { UserCalls = new List <UserCallData>(); } }
public static async void LoadSettings() { Settings = await PABXFile <Dictionary <string, SettingsStore> > .LoadObjectAsync("config.bbs") ?? new Dictionary <string, SettingsStore>(); if (!Settings.ContainsKey(CurrentUser.login.ToString())) { Settings[CurrentUser.login.ToString()] = new SettingsStore(); } #if DEBUG Settings.Dump(); #endif }
public async static void SaveCreds(LoginCredentials creds) { string credString = JsonConvert.SerializeObject(creds); if (creds.remember == true) { if (File.Exists("login_details.bbs")) //If the file exists { var auth = await PABXFile <List <LoginCredentials> > .LoadObjectAsync("login_details.bbs"); bool exists = false; foreach (LoginCredentials a in auth) { if (a.login == creds.login) { exists = true; } } if (exists == false) //Only add the login if it doesn't already exist { auth.Add(creds); } List <LoginCredentials> l = new List <LoginCredentials>(); foreach (var value in auth.OrderBy(i => i.login)) //Order the list of users numerically { l.Add(value); } PABXFile <List <LoginCredentials> > .SaveObject("login_details.bbs", l); } else //If the file doesn't exist create it and write everything to it { File.WriteAllText("login_details.bbs", BBSEncrypt("[" + credString + "]")); } } }
public static LoginCredentials LoadCreds() { return(PABXFile <LoginCredentials> .LoadObjectAsync("login_details.json").Result != null ? PABXFile <LoginCredentials> .LoadObjectAsync("login_details.json").Result : new LoginCredentials()); }