public static User Fetch() { User usr = new User("", ""); StreamReader sr = null; //if (File.Exists(_dataFilePath)) try { string line; sr = new StreamReader(_dataFilePath); while ((line = sr.ReadLine()) != null) { string[] data = line.Split(':'); if (data[0].Contains("username")) usr.username = data[1]; else if (data[0].Contains("password")) usr.password = data[1]; } } //else catch (Exception e) { Console.WriteLine(e.Message + "\n"); Console.WriteLine(e.StackTrace); } finally { if (sr != null) sr.Close(); } return usr; }
static void Main(string[] args) { string username, password; Console.Write("Username: "******"Password: "); password = Console.ReadLine(); User userInfo = new User(username, password); Authenticator authorize = new Authenticator(userInfo); Login toLogin = new Login(authorize.Check(), userInfo); Console.WriteLine(toLogin.LoginTask()); Console.ReadLine(); }
public Authenticator(User usr) { this._inputUser = usr; }
public Login(bool status, User usr) { this._authSuccess = status; this._inputUser = usr; }