private void CreatePackage(PackageInfo package, int dependentPackageID, string basePath, string fileName, bool createZip) { string manifest; Locale language = LocaleController.Instance.GetLocale(cboLanguage.SelectedValue); var languagePack = new LanguagePackInfo(); languagePack.LanguageID = language.LanguageId; languagePack.DependentPackageID = dependentPackageID; if (dependentPackageID == -2) { package.PackageType = "CoreLanguagePack"; } else { package.PackageType = "ExtensionLanguagePack"; } package.Name += " " + language.Text; package.FriendlyName += " " + language.Text; packageWriter = PackageWriterFactory.GetWriter(package) as DotNetNuke.Services.Installer.Writers.LanguagePackWriter; packageWriter.Language = language; packageWriter.LanguagePack = languagePack; packageWriter.BasePath = basePath; packageWriter.GetFiles(false); if (packageWriter.Files.Count > 0) { _IsPackCreated = true; if (createZip) { manifest = packageWriter.WriteManifest(true); fileName = fileName + "." + package.Version.ToString(3) + "." + language.Code + ".zip"; packageWriter.CreatePackage(fileName, package.Name + ".dnn", manifest, true); } else if (!_Manifest.Contains(string.Format(@"package name=""{0}""", package.Name))) { packageWriter.BasePath = ""; _Manifest += packageWriter.WriteManifest(true); foreach (KeyValuePair <string, InstallFile> kvp in packageWriter.Files) { _Files[kvp.Key] = kvp.Value; } } } else { _IsPackCreated = false; } }
private void CreateFullPackage() { Locale language = LocaleController.Instance.GetLocale(cboLanguage.SelectedValue); var Package = new PackageInfo(); Package.Name = Globals.CleanFileName(txtFileName.Text); Package.Version = DotNetNukeContext.Current.Application.Version; Package.License = Util.PACKAGE_NoLicense; Package.PackageType = "CoreLanguagePack"; _Files = new Dictionary <string, InstallFile>(); CreateCorePackage(false); foreach (DesktopModuleInfo desktopModule in DesktopModuleController.GetDesktopModules(Null.NullInteger).Values) { if (!desktopModule.FolderName.StartsWith("Admin/")) { CreateModulePackage(desktopModule, false); } } foreach (PackageInfo provider in PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "Provider")) { CreateProviderPackage(provider, false); } foreach (PackageInfo authSystem in PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "Auth_System")) { CreateAuthSystemPackage(authSystem, false); } foreach (PackageInfo library in PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "Library" || p.PackageType == "EvoqConnector")) { //only generate if a folder name is known for the library if (library.FolderName != null) { CreateLibraryPackage(library, false); } } string fileName = Path.Combine(BasePath, "ResourcePack." + Package.Name); fileName = fileName + "." + Package.Version.ToString(3) + "." + language.Code + ".zip"; packageWriter = PackageWriterFactory.GetWriter(Package) as DotNetNuke.Services.Installer.Writers.LanguagePackWriter; packageWriter.Language = language; packageWriter.BasePath = ""; foreach (KeyValuePair <string, InstallFile> kvp in _Files) { packageWriter.Files.Add(kvp.Key, kvp.Value); } packageWriter.CreatePackage(fileName, Package.Name + " " + language.Text + ".dnn", _Manifest, true); }