Example #1
0
 public Configer()
 {
     _configDir = _bathpath + "/" + _dir;
     createVicTranslationDir();
     _cx = (ConfigXml)(new ConfigXml().getConfigObject(_configDir, _configName));
     _sx = (SettingXml)(new SettingXml().getConfigObject(_configDir, _settingConfigName));
 }
Example #2
0
        /**
         * 初始化 config檔
         */
        private ConfigXml initConfig(string dir, string name)
        {
            ConfigXml cx = new ConfigXml(dir, dir, "credential.json");

            System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(typeof(ConfigXml));
            System.IO.FileStream file = System.IO.File.Create(dir + "/" + name);
            writer.Serialize(file, cx);
            file.Close();
            return(cx);
        }
Example #3
0
        /**
         * 取得config檔
         */
        public override ConfigObject getConfigObject(string dir, string name)
        {
            string ph = dir + "/" + name;

            if (System.IO.File.Exists(ph))
            {
                System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(typeof(ConfigXml));
                System.IO.StreamReader r = new System.IO.StreamReader(ph);
                ConfigXml cx             = (ConfigXml)reader.Deserialize(r);
                r.Close();
                return(cx);
            }
            return(this.initConfig(dir, name));
        }