Ejemplo n.º 1
0
 public Configer()
 {
     _configDir = _bathpath + "/" + _dir;
     createVicTranslationDir();
     _cx = (ConfigXml)(new ConfigXml().getConfigObject(_configDir, _configName));
     _sx = (SettingXml)(new SettingXml().getConfigObject(_configDir, _settingConfigName));
 }
Ejemplo n.º 2
0
        /**
         * 初始化 setting 檔
         */
        private SettingXml initSetting(string path)
        {
            SettingXml sx = new SettingXml(0);

            System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(typeof(SettingXml));
            System.IO.FileStream file = System.IO.File.Create(path);
            writer.Serialize(file, sx);
            file.Close();
            return(sx);
        }
Ejemplo n.º 3
0
        /**
         * 取得設定檔
         */
        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(SettingXml));
                System.IO.StreamReader r  = new System.IO.StreamReader(ph);
                SettingXml             sx = (SettingXml)reader.Deserialize(r);
                r.Close();
                return(sx);
            }
            return(this.initSetting(ph));
        }