コード例 #1
0
ファイル: ModuleInstaller.cs プロジェクト: kc85/znxtapp.core
        private void UpdateModuleInfo(string baseModulePath, string moduleName, string moduleVersion, ref JObject moduleObject)
        {
            string filePath = string.Format("{0}\\Content\\{1}", baseModulePath, MODULE_INFO_FILE);

            if (File.Exists(filePath))
            {
                var moduleFileData = JObjectHelper.GetJObjectFromFile(filePath);
                moduleFileData[CommonConst.CommonField.NAME]    = moduleName;
                moduleFileData[CommonConst.CommonField.VERSION] = moduleVersion;
                moduleObject = JObjectHelper.Marge(moduleObject, moduleFileData, MergeArrayHandling.Union);
            }
            string fileNugetPackageInfo = string.Format("{0}\\{1}.nuspec", baseModulePath, moduleName);

            if (File.Exists(fileNugetPackageInfo))
            {
                XmlDocument xdoc = new XmlDocument();
                xdoc.LoadXml(File.ReadAllText(fileNugetPackageInfo));
                var packageData = JObjectHelper.Serialize <XmlDocument>(xdoc);
                moduleObject[CommonConst.CommonField.PACKAGE_CONFIG] = packageData["package"]["metadata"];
            }
        }