/// <summary>
        /// Store user id information
        /// as well as path of user data file
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="storagePath"></param>
        public frmPlayerHome(int userID, string storagePath)
        {
            this.userID     = userID;
            userDataHandler = new TextUserDataHandler(storagePath, storagePath);

            InitializeComponent();
        }
示例#2
0
        /// <summary>
        /// Initialize the new player form with the current username
        /// and the current storage path
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="storagePath"></param>
        public frmNewPlayer(string userName, string storagePath)
        {
            this.userName    = userName;
            this.storagePath = storagePath;
            userDataHandler  = new TextUserDataHandler(storagePath, storagePath);

            InitializeComponent();
        }
示例#3
0
		static void Main(string[] args)
		{
			string writeFile = "userData.txt";
			string readFile = "userData.txt";

			Dictionary<string, string> record = new Dictionary<string, string>();

			TextUserDataHandler userDataHandler = new TextUserDataHandler(readFile, writeFile);

			if (userDataHandler.insert("Solomon", "Sally", 5, 6, 7))
			{
				Console.WriteLine("User inserted successfully");
			}
			else
			{
				Console.WriteLine("User exists");
			}

			//userDataHandler.reload();
			bool exists = userDataHandler.nameExists("Theodore");

			int? nullId = userDataHandler.login("Solomon", "Sally");
			if (nullId != null)
			{
				int id = nullId ?? default(int);
				int ties = userDataHandler.getTies(id) ?? default(int);

				userDataHandler.setTies(id, ties + 1);
				userDataHandler.UpdateAll();
			}

			Console.WriteLine("User Solomon:  " + exists);
			Console.WriteLine("User David: " + userDataHandler.nameExists("David"));
			Console.WriteLine("Solomon id: " + nullId);

			Console.ReadKey();
		}
示例#4
0
 /// <summary>
 /// Initialize login form with default
 /// storage file set to default
 /// </summary>
 public frmLogin()
 {
     userDataHandler = new TextUserDataHandler(storagePath, storagePath);
     InitializeComponent();
 }
示例#5
0
 /// <summary>
 /// Initialize the form with the default user data storage path
 /// </summary>
 public frmStatistics()
 {
     userDataHandler = new TextUserDataHandler("userData.txt", "userData.txt");
     InitializeComponent();
 }