//constructor public TagAdder(string ValidPassword) { m_PasswordWithoutSalt = null; m_PasswordWithoutSalt = ValidPassword; m_Tag = null; m_Salt = new GenerateSalt(); m_harshcode = new HarshCodeConverter(); m_Tag = m_Salt.RandomSalt(); }
/// <summary> /// Constructor of CredentialFile class /// </summary> public CredentialFile() { // Generate random file name string salt = new GenerateSalt().RandomSalt(); m_FullFilePath = "UserAccount_" + salt + ".txt"; m_UserInfoDatabase = new List<UserInfo>(); if (!File.Exists(m_FullFilePath)) { FileStream fs = File.Create(m_FullFilePath); fs.Close(); } else { LoadCredentialFile(); } HarshCodeConverter hashcode = new HarshCodeConverter(); //UserInfo Admin = new UserInfo("Admin", hashcode.Convert("111111111111abc"), "abc"); UserInfo Admin = new UserInfo("team1", hashcode.Convert("clientapiabc"),"abc"); Admin.m_Admin = true; m_UserInfoDatabase.Add(Admin); }
/// <summary> /// Copy constructor /// </summary> /// <param name="cf">another instance of CredentialFile class</param> public CredentialFile(CredentialFile cf) { // Generate random file name string salt = new GenerateSalt().RandomSalt(); m_FullFilePath = "UserAccount_" + salt + ".txt"; if (!File.Exists(m_FullFilePath)) { FileStream fs = File.Create(m_FullFilePath); fs.Close(); } // Copy the current user info // m_UserInfoDatabase = new List<UserInfo>(cf.m_UserInfoDatabase); this.SaveCredentialFile(); }