Esempio n. 1
0
        public void saveFile()
        {
            saveClass sv = new saveClass();

            sv.username = username;
            sv.password = password;
            sv.address  = address;
            sv.db_name  = db_name;
            sv.db       = chpDB.getDBType();

            XmlFileIO.xmlSave(sv.GetType(), filename, sv);
        }
Esempio n. 2
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();
            }
        }