Example #1
0
        // Saves the user information to a text file
        // Returns success of saving
        public Boolean saveInfo(UserInfo info)
        {
            Boolean ret = false;
            string[] data = { info.mFirst, info.mMI, info.mLast, info.mEmail, info.mGender };
            System.IO.File.WriteAllLines(FILENAME_PATH, data);

            string[] test = System.IO.File.ReadAllLines(FILENAME_PATH);
            ret = data.SequenceEqual(test);
            return ret;
        }
Example #2
0
        // Returns the saved UserInfo data
        public UserInfo readInfo()
        {
            UserInfo info = null;
            try
            {
                string[] data = File.ReadAllLines(FILENAME_PATH);
                if (data.Length >= 5)
                {
                    info = new UserInfo(data[0], data[1], data[2], data[3], data[4]);
                }
            }
            catch(FileNotFoundException ex)
            {
                // File not found, no saved userinfo
            }

            return info;
        }
Example #3
0
 public SaveWindow(string first, string mi, string last, string email, string gender)
 {
     InitializeComponent();
     mInfo = new UserInfo(first, mi, last, email, gender);
 }