internal static LoginInfo Load(string path) { BinaryReader br = new BinaryReader(new FileStream(path, FileMode.Open)); LoginInfo li = new LoginInfo(); li.name = br.ReadString(); li.password = br.ReadString(); br.Close(); return li; }
public static LoginInfo LoadFromMemory(byte[] data) { MemoryStream ms = new MemoryStream(data); BinaryReader br = new BinaryReader(ms); LoginInfo li = new LoginInfo(); li.name = br.ReadString(); li.password = br.ReadString(); br.Close(); return li; }
public static new LoginInfo Show() { LoginInput frm = new LoginInput(); DialogResult r = frm.ShowDialog(); if (r == DialogResult.OK) { LoginInfo li = new LoginInfo(frm.textBox1.Text,frm.textBox2.Text); return li; } else { return null; } }
public static void DeleteLoginInfo() { login = null; }
public static void SetLoginInfo(LoginInfo Login) { login = Login; }
private static void Main() { //Init windows visuals Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Init data & load plugins Data.CheckStartupFolders(); PluginLoader.LoadPlugins(); DataHolder.LoadConfigs(); DataHolder.LoadImages(); //Check for updates if (!DataHolder.GetConfig().Has("autoupdate")) { DataHolder.GetConfig().Set("autoupdate", Plugin_API.Config.Type.Bool, false); } if ((bool)DataHolder.GetConfig().Get("autoupdate")) { Thread updateThread = new Thread(() => { Data.CheckForUpdate(); DataHolder.UpdatePlugins(); Data.PreformUpdate(); if (Data.updateData.ToString() != "") { DialogResult r = MessageBox.Show("New Update Available! Download?", "Update", MessageBoxButtons.YesNo); if (r == DialogResult.Yes) { Process.Start(Data.updaterExe); Thread.Sleep(100); Application.Exit(); } } }); updateThread.Start(); } if (File.Exists(Data.logininfo)) { DataHolder.SetLoginInfo(LoginInfo.Load(Data.logininfo)); } DataHolder.SetBackups(BackupLoader.LoadBackups()); //try //{ DataHolder.mainWindow = new MainWindow(); Application.Run(DataHolder.mainWindow); DataHolder.StopPlugins(); //} //catch (Exception ex) //{ // ErrorPage ep = new ErrorPage(ex.ToString()); // Application.Run(ep); //} BackupLoader.SaveBackups(DataHolder.GetBackups()); if (DataHolder.HasLoginInfo) { DataHolder.GetLoginInfo().Save(Data.logininfo); } else { if (File.Exists(Data.logininfo)) { File.Delete(Data.logininfo); } } DataHolder.SaveConfigs(); }
public Backup_LoginInfo(LoginInfo loginI, string displayname, string file) { this.login = loginI; this.displayname = displayname; this.file = file; }