public void Init(string binDirectoryPath) { string rootPath = Path.Combine(binDirectoryPath, @"..\"); //取PEOffice的整体系统配置 InitProductsConfig(rootPath); //设置路径信息 _systemPath = new BxSystemPath(binDirectoryPath, _culture); //加载注册信息 _regisries = new BxRegistries(_systemPath); //加载单位制 string sConfigFilePath = Path.Combine(_systemPath.GlobalConfigPath, @"BaseLayer\Unit\Unit.xml"); string sParsedFilePath = Path.Combine(_systemPath.GlobalConfigPath, @"BaseLayer\Unit\ParsedUnit.xml"); _baseUnitsCenter = new BxUnitsProvider(sConfigFilePath, sParsedFilePath); _baseUnitsCenter.Init(); string unitSetFilePath = Path.Combine(_systemPath.CultureConfigPath, @"BaseLayer\UnitSet\UnitSet.xml"); _unitsCenter = new BxSubSetUnitsCenter(_baseUnitsCenter); _unitsCenter.LoadUnitConfigFile(unitSetFilePath); }
//取PEOffice的整体系统配置 void InitProductsConfig(string rootPath) { String globalPath = Path.Combine(rootPath, @"Config\Global"); string PEOffice6Documents = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), BxSystemPath.GetPEOffice6DocumentSegment(globalPath)); string productsConfigFilePath = Path.Combine(PEOffice6Documents, @"Global\ProductsInfo\Config.xml"); XmlDocument doc = new XmlDocument(); try { doc.Load(productsConfigFilePath); } catch (Exception) { productsConfigFilePath = Path.Combine(rootPath, @"Config\Global\ProductsInfo\Config.xml"); doc = new XmlDocument(); doc.Load(productsConfigFilePath); } XmlElement cultureNode = doc.DocumentElement.SelectSingleNode("CultureInfo") as XmlElement; string language = cultureNode.GetAttribute("language"); _culture = CultureInfo.GetCultureInfo(language); }