Esempio n. 1
0
        /// <summary>
        /// Sets the server detials
        /// </summary>
        /// <param name="host">The network host of the database server, eg 'localhost' or '127.0.0.1'.</param>
        /// <param name="port">The network port of the database server as integer.</param>
        /// <param name="username">The username to use when connecting to the database.</param>
        /// <param name="password">The password to use in combination with the username when connecting to the database.</param>
        /// <returns>A boolean indicating if the data was filled in propperly</returns>
        public bool setServerDetails(string host, uint port, string username, string password, string databaseName)
        {
            try
            {
                server = new DatabaseServer(host, port, username, password, databaseName);
                Out.writeLine("Database connector succesfully set the connection details", Out.logFlags.ImportantLogLevel);
                return true;
            }
            catch (DatabaseException ex)
            {
                this.isConnected = false;
                Out.writeError("Database connector fialed to set the connection details: " + ex.Message);

                return false;
            }
        }
Esempio n. 2
0
 public bool setServerDetails(string host, uint port, string username, string password, string databaseName)
 {
     try
     {
         this.server = new DatabaseServer(host, port, username, password, databaseName);
         return true;
     }
     catch (DatabaseException)
     {
         this.isConnected = false;
         return false;
     }
 }
Esempio n. 3
0
		private void TryReadConfigFile()
		{
			if (!File.Exists("Settings\\Authentication data.DONG"))
			{
				Console.WriteLine();
				Console.WriteLine("Error: No SQL configuration data was found. Press any key to create a new one");
				Console.ReadKey(false);

				using (FileStream stream = File.Create("Settings\\Authentication data.DONG"))
				{
					CreateConfigurationFile(stream);
				}
			}

			using (FileStream stream = new FileStream("Settings\\Authentication data.DONG", FileMode.Open))
			{
				using (BinaryReader reader = new BinaryReader(stream))
				{
					this.server = new DatabaseServer(reader);
				}
			}
		}