예제 #1
0
        public ConfigController()    //ファイル名から作成
        {
            if (ConfigController.existConfigFile() == true)
            {
                logOutput.writeLog("設定ファイルが見つかりました。");
                object obj;

                saveClass sClass = new saveClass();
                bool      result = XmlFileIO.xmlLoad(sClass.GetType(), filename, out obj);

                if (obj is saveClass)
                {
                    sClass = obj as saveClass;

                    this.username = sClass.username;
                    this.password = sClass.password;
                    this.db_name  = sClass.db_name;
                    this.address  = sClass.address;

                    if (sClass.db == POSTGRE)
                    {
                        chpDB = new PostgreSQL_Chp(this.address, this.db_name, this.username, this.password);
                        eveDB = new PostgreSQL_Emg(this.address, this.db_name, this.username, this.password);
                    }
                    else
                    {
                        chpDB = new PostgreSQL_Chp(this.address, this.db_name, this.username, this.password);
                        eveDB = new PostgreSQL_Emg(this.address, this.db_name, this.username, this.password);
                    }
                }
            }
            else
            {
                logOutput.writeLog("設定ファイルが見つかりません。初期設定をします。");

                Console.Write("Address:");
                this.address = Console.ReadLine();
                Console.Write("Database:");
                this.db_name = Console.ReadLine();
                Console.Write("username:"******"password:");
                this.password = Console.ReadLine();

                //とりあえずPostgreSQL
                chpDB = new PostgreSQL_Chp(this.address, this.db_name, this.username, this.password);
                eveDB = new PostgreSQL_Emg(this.address, this.db_name, this.username, this.password);

                saveFile();
            }
        }
예제 #2
0
        public ConfigController(string username, string password, string address, string db_name, string db)
        {
            this.username = username;
            this.password = password;
            this.address  = address;
            this.db_name  = db_name;

            if (db == POSTGRE)
            {
                chpDB = new PostgreSQL_Chp(this.address, this.db_name, this.username, this.password);
                eveDB = new PostgreSQL_Emg(this.address, this.db_name, this.username, this.password);
            }
            else
            {
                //とりあえずPostgreSQL
                chpDB = new PostgreSQL_Chp(this.address, this.db_name, this.username, this.password);
                eveDB = new PostgreSQL_Emg(this.address, this.db_name, this.username, this.password);
            }

            saveFile();
        }
 public EmgDatabase_Writer(IEventDataBase db) : base(db, "PSO2EventTable")
 {
     EventDB = db;
 }