本文整理汇总了C#中DotNetNuke.Services.Installer.Packages.PackageInfo类的典型用法代码示例。如果您正苦于以下问题:C# PackageInfo类的具体用法?C# PackageInfo怎么用?C# PackageInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PackageInfo类属于DotNetNuke.Services.Installer.Packages命名空间,在下文中一共展示了PackageInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PackageInstaller
/// -----------------------------------------------------------------------------
/// <summary>
/// This Constructor creates a new PackageInstaller instance
/// </summary>
/// <param name="package">A PackageInfo instance</param>
/// <history>
/// [cnurse] 01/21/2008 created
/// </history>
/// -----------------------------------------------------------------------------
public PackageInstaller(PackageInfo package)
{
IsValid = true;
DeleteFiles = Null.NullBoolean;
Package = package;
if (!string.IsNullOrEmpty(package.Manifest))
{
//Create an XPathDocument from the Xml
var doc = new XPathDocument(new StringReader(package.Manifest));
XPathNavigator nav = doc.CreateNavigator().SelectSingleNode("package");
ReadComponents(nav);
}
else
{
ComponentInstallerBase installer = InstallerFactory.GetInstaller(package.PackageType);
if (installer != null)
{
//Set package
installer.Package = package;
//Set type
installer.Type = package.PackageType;
_componentInstallers.Add(0, installer);
}
}
}
示例2: WidgetPackageWriter
public WidgetPackageWriter(PackageInfo package) : base(package)
{
string company = package.Name;
if(company.Contains("."))
{
company = company.Substring(0, company.IndexOf("."));
}
BasePath = Path.Combine("Resources\\Widgets\\User", company);
}
示例3: CreateCorePackage
private void CreateCorePackage(bool createZip)
{
var Package = new PackageInfo();
Package.Name = Globals.CleanFileName(txtFileName.Text);
Package.Version = DotNetNukeContext.Current.Application.Version;
Package.License = Util.PACKAGE_NoLicense;
string fileName = Path.Combine(BasePath, "ResourcePack." + Package.Name);
CreatePackage(Package, -2, "", fileName, createZip);
}
示例4: ModulePackageWriter
public ModulePackageWriter(DesktopModuleInfo desktopModule, XPathNavigator manifestNav, PackageInfo package) : base(package)
{
DesktopModule = desktopModule;
Initialize(desktopModule.FolderName);
if (manifestNav != null)
{
ReadLegacyManifest(manifestNav.SelectSingleNode("folders/folder"), false);
}
string physicalFolderPath = Path.Combine(Globals.ApplicationMapPath, BasePath);
ProcessModuleFolders(physicalFolderPath, physicalFolderPath);
}
示例5: ProviderPackageWriter
public ProviderPackageWriter(PackageInfo package) : base(package)
{
XmlDocument configDoc = Config.Load();
XPathNavigator providerNavigator = configDoc.CreateNavigator().SelectSingleNode("/configuration/dotnetnuke/*/providers/add[@name='" + package.Name + "']");
string providerPath = Null.NullString;
if (providerNavigator != null)
{
providerPath = Util.ReadAttribute(providerNavigator, "providerPath");
}
if (!string.IsNullOrEmpty(providerPath))
{
BasePath = providerPath.Replace("~/", "").Replace("/", "\\");
}
}
示例6: CreateAuthSystemPackage
private void CreateAuthSystemPackage(PackageInfo authPackage, bool createZip)
{
var Package = new PackageInfo();
Package.Name = authPackage.Name;
Package.FriendlyName = authPackage.Name;
Package.Version = authPackage.Version;
Package.License = Util.PACKAGE_NoLicense;
string fileName = Path.Combine(BasePath, "ResourcePack." + Package.Name);
AuthenticationInfo authSystem = AuthenticationController.GetAuthenticationServiceByPackageID(authPackage.PackageID);
string authPath = authSystem.LoginControlSrc.Substring(0, authSystem.LoginControlSrc.LastIndexOf("/"));
CreatePackage(Package, authPackage.PackageID, authPath.Replace("/", "\\"), fileName, createZip);
}
示例7: CreateSkinPackage
private static PackageInfo CreateSkinPackage(SkinPackageInfo skin)
{
//Create a Package
var package = new PackageInfo(new InstallerInfo());
package.Name = skin.SkinName;
package.FriendlyName = skin.SkinName;
package.Description = Null.NullString;
package.Version = new Version(1, 0, 0);
package.PackageType = skin.SkinType;
package.License = Util.PACKAGE_NoLicense;
//See if the Skin is using a Namespace (or is a known skin)
ParsePackageName(package);
return package;
}
示例8: GetWriter
/// -----------------------------------------------------------------------------
/// <summary>
/// The GetWriter method instantiates the relevant PackageWriter Installer
/// </summary>
/// <param name="package">The associated PackageInfo instance</param>
/// <history>
/// [cnurse] 01/31/2008 created
/// </history>
/// -----------------------------------------------------------------------------
public static PackageWriterBase GetWriter(PackageInfo package)
{
PackageWriterBase writer = null;
switch (package.PackageType)
{
case "Auth_System":
writer = new AuthenticationPackageWriter(package);
break;
case "Module":
writer = new ModulePackageWriter(package);
break;
case "Container":
writer = new ContainerPackageWriter(package);
break;
case "Skin":
writer = new SkinPackageWriter(package);
break;
case "CoreLanguagePack":
case "ExtensionLanguagePack":
writer = new LanguagePackWriter(package);
break;
case "SkinObject":
writer = new SkinControlPackageWriter(package);
break;
case "Provider":
writer = new ProviderPackageWriter(package);
break;
case "Library":
writer = new LibraryPackageWriter(package);
break;
case "Widget":
writer = new WidgetPackageWriter(package);
break;
default:
//PackageType is defined in the List
var listController = new ListController();
ListEntryInfo entry = listController.GetListEntryInfo("PackageWriter", package.PackageType);
if (entry != null && !string.IsNullOrEmpty(entry.Text))
{
//The class for the Installer is specified in the Text property
writer = (PackageWriterBase) Reflection.CreateObject(entry.Text, "PackageWriter_" + entry.Value);
}
break;
}
return writer;
}
示例9: SkinControlPackageWriter
public SkinControlPackageWriter(XPathNavigator manifestNav, InstallerInfo installer)
{
SkinControl = new SkinControlInfo();
//Create a Package
Package = new PackageInfo(installer);
ReadLegacyManifest(manifestNav, true);
Package.Description = Null.NullString;
Package.Version = new Version(1, 0, 0);
Package.PackageType = "SkinObject";
Package.License = Util.PACKAGE_NoLicense;
BasePath = Path.Combine("DesktopModules", Package.Name.ToLower()).Replace("/", "\\");
AppCodePath = Path.Combine("App_Code", Package.Name.ToLower()).Replace("/", "\\");
}
示例10: LanguagePackWriter
public LanguagePackWriter(PackageInfo package) : base(package)
{
_LanguagePack = LanguagePackController.GetLanguagePackByPackage(package.PackageID);
if (LanguagePack != null)
{
_Language = LocaleController.Instance.GetLocale(_LanguagePack.LanguageID);
if (LanguagePack.PackageType == LanguagePackType.Core)
{
BasePath = Null.NullString;
}
else
{
//Get the BasePath of the Dependent Package
PackageInfo dependendentPackage = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.PackageID == LanguagePack.DependentPackageID);
PackageWriterBase dependentPackageWriter = PackageWriterFactory.GetWriter(dependendentPackage);
BasePath = dependentPackageWriter.BasePath;
}
}
else
{
BasePath = Null.NullString;
}
}
示例11: BindLanguageList
private void BindLanguageList()
{
try
{
var myResponseReader = UpdateService.GetLanguageList();
//empty language list
languageList.Items.Clear();
//Loading into XML doc
var xmlDoc = new XmlDocument();
xmlDoc.Load(myResponseReader);
var languages = xmlDoc.SelectNodes("available/language");
var packages = new List<PackageInfo>();
if (languages != null)
{
foreach (XmlNode language in languages)
{
string cultureCode = "";
string version = "";
foreach (XmlNode child in language.ChildNodes)
{
if (child.Name == "culturecode")
{
cultureCode = child.InnerText;
}
if (child.Name == "version")
{
version = child.InnerText;
}
}
if (!string.IsNullOrEmpty(cultureCode) && !string.IsNullOrEmpty(version) && version.Length == 6)
{
var myCIintl = new CultureInfo(cultureCode, true);
version = version.Insert(4, ".").Insert(2, ".");
var package = new PackageInfo { Name = "LanguagePack-" + myCIintl.Name, FriendlyName = myCIintl.NativeName };
package.Name = myCIintl.NativeName;
package.Description = cultureCode;
Version ver = null;
Version.TryParse(version, out ver);
package.Version = ver;
if (packages.Any(p => p.Name == package.Name))
{
var existPackage = packages.First(p => p.Name == package.Name);
if (package.Version > existPackage.Version)
{
packages.Remove(existPackage);
packages.Add(package);
}
}
else
{
packages.Add(package);
}
}
}
}
foreach (var package in packages)
{
var li = new ListItem { Value = package.Description, Text = package.Name };
languageList.AddItem(li.Text, li.Value);
RadComboBoxItem lastItem = languageList.Items[languageList.Items.Count - 1];
if (DotNetNukeContext.Current.Application.Version.Major != package.Version.Major
|| DotNetNukeContext.Current.Application.Version.Minor != package.Version.Minor
|| DotNetNukeContext.Current.Application.Version.Build != package.Version.Build)
{
lastItem.Attributes.Add("onclick", "javascript:LegacyLangaugePack('" + package.Version + "');");
}
}
}
catch (Exception)
{
//suppress for now - need to decide what to do when webservice is unreachable
//throw;
}
finally
{
//ensure there is always an en-us
if (languageList.Items.FindItemByValue("en-US") == null)
{
var myCIintl = new CultureInfo("en-US", true);
var li = new ListItem {Value = "en-US", Text = myCIintl.NativeName};
languageList.AddItem(li.Text, li.Value);
RadComboBoxItem lastItem = languageList.Items[languageList.Items.Count - 1];
lastItem.Attributes.Add("onclick", "javascript:ClearLegacyLangaugePack();");
languageList.Sort = RadComboBoxSort.Ascending;
languageList.Items.Sort();
}
var item = languageList.Items.FindItemByValue(_culture);
languageList.SelectedIndex = item != null ? item.Index : languageList.Items.FindItemByValue("en-US").Index;
languageList.Sort = RadComboBoxSort.Ascending;
languageList.Items.Sort();
}
}
示例12: BindGrid
private void BindGrid(string installPath, DataGrid grid)
{
var packages = new List<PackageInfo>();
var invalidPackages = new List<string>();
foreach (string file in Directory.GetFiles(installPath))
{
if (file.ToLower().EndsWith(".zip") || file.ToLower().EndsWith(".resources"))
{
Stream inputStream = new FileStream(file, FileMode.Open, FileAccess.Read);
var unzip = new ZipInputStream(inputStream);
try
{
ZipEntry entry = unzip.GetNextEntry();
while (entry != null)
{
if (!entry.IsDirectory)
{
var fileName = entry.Name;
string extension = System.IO.Path.GetExtension(fileName);
if (extension.ToLower() == ".dnn" || extension.ToLower() == ".dnn5")
{
//Manifest
var manifestReader = new StreamReader(unzip);
var manifest = manifestReader.ReadToEnd();
var package = new PackageInfo();
package.Manifest = manifest;
if (!string.IsNullOrEmpty(manifest))
{
var doc = new XPathDocument(new StringReader(manifest));
XPathNavigator rootNav = doc.CreateNavigator().SelectSingleNode("dotnetnuke");
string packageType = String.Empty;
if (rootNav.Name == "dotnetnuke")
{
packageType = XmlUtils.GetAttributeValue(rootNav, "type");
}
else if (rootNav.Name.ToLower() == "languagepack")
{
packageType = "LanguagePack";
}
XPathNavigator nav = null;
switch (packageType.ToLower())
{
case "package":
nav = rootNav.SelectSingleNode("packages/package");
break;
case "module":
case "languagepack":
case "skinobject":
nav = Installer.ConvertLegacyNavigator(rootNav, new InstallerInfo()).SelectSingleNode("packages/package");
break;
}
if (nav != null)
{
package.Name = XmlUtils.GetAttributeValue(nav, "name");
package.PackageType = XmlUtils.GetAttributeValue(nav, "type");
package.IsSystemPackage = XmlUtils.GetAttributeValueAsBoolean(nav, "isSystem", false);
package.Version = new Version(XmlUtils.GetAttributeValue(nav, "version"));
package.FriendlyName = XmlUtils.GetNodeValue(nav, "friendlyName");
if (String.IsNullOrEmpty(package.FriendlyName))
{
package.FriendlyName = package.Name;
}
package.Description = XmlUtils.GetNodeValue(nav, "description");
package.FileName = file.Replace(installPath + "\\", "");
XPathNavigator foldernameNav = null;
switch (package.PackageType)
{
case "Module":
case "Auth_System":
foldernameNav = nav.SelectSingleNode("components/component/files");
if (foldernameNav != null) package.FolderName = Util.ReadElement(foldernameNav, "basePath").Replace('\\', '/');
break;
case "Container":
foldernameNav = nav.SelectSingleNode("components/component/containerFiles");
if (foldernameNav != null) package.FolderName = Globals.glbContainersPath + Util.ReadElement(foldernameNav, "containerName").Replace('\\', '/');
break;
case "Skin":
foldernameNav = nav.SelectSingleNode("components/component/skinFiles");
if (foldernameNav != null) package.FolderName = Globals.glbSkinsPath + Util.ReadElement(foldernameNav, "skinName").Replace('\\', '/');
break;
default:
break;
}
XPathNavigator iconFileNav = nav.SelectSingleNode("iconFile");
if (package.FolderName != string.Empty && iconFileNav != null)
{
if ((iconFileNav.Value != string.Empty) && (package.PackageType == "Module" || package.PackageType == "Auth_System" || package.PackageType == "Container" || package.PackageType == "Skin"))
{
package.IconFile = package.FolderName + "/" + iconFileNav.Value;
package.IconFile = (!package.IconFile.StartsWith("~/")) ? "~/" + package.IconFile : package.IconFile;
}
}
//.........这里部分代码省略.........
示例13: ProcessLegacySkinControls
public static void ProcessLegacySkinControls()
{
foreach (SkinControlInfo skinControl in SkinControlController.GetSkinControls().Values)
{
if (skinControl.PackageID == Null.NullInteger)
{
try
{
//SkinControl is not affiliated with a Package
var package = new PackageInfo(new InstallerInfo());
package.Name = skinControl.ControlKey;
package.FriendlyName = skinControl.ControlKey;
package.Description = Null.NullString;
package.Version = new Version(1, 0, 0);
package.PackageType = "SkinObject";
//See if the SkinControl is using a "Namespace" for its name
ParsePackageName(package);
var skinControlWriter = new SkinControlPackageWriter(skinControl, package);
package.Manifest = skinControlWriter.WriteManifest(true);
//Save Package
PackageController.Instance.SaveExtensionPackage(package);
//Update SkinControl with new PackageID
skinControl.PackageID = package.PackageID;
//Save SkinControl
SkinControlController.SaveSkinControl(skinControl);
}
catch (Exception exc)
{
Logger.Error(exc);
}
}
}
}
示例14: ParsePackageName
public static void ParsePackageName(PackageInfo package)
{
ParsePackageName(package, ".");
if (string.IsNullOrEmpty(package.Owner))
{
ParsePackageName(package, "\\");
}
if (string.IsNullOrEmpty(package.Owner))
{
ParsePackageName(package, "_");
}
if (package.PackageType == "Module" && AdminModules.Contains(package.Name + ",") || package.PackageType == "Module" && CoreModules.Contains(package.Name + ",") ||
(package.PackageType == "Container" || package.PackageType == "Skin") && KnownSkins.Contains(package.Name + ",") ||
package.PackageType == "SkinObject" && KnownSkinObjects.Contains(package.Name + ","))
{
if (string.IsNullOrEmpty(package.Owner))
{
package.Owner = "DotNetNuke";
package.Name = "DotNetNuke." + package.Name;
switch (package.PackageType)
{
case "Skin":
package.Name += ".Skin";
package.FriendlyName += " Skin";
break;
case "Container":
package.Name += ".Container";
package.FriendlyName += " Container";
break;
case "SkinObject":
package.Name += "SkinObject";
package.FriendlyName += " SkinObject";
break;
}
}
}
if (package.Owner == "DotNetNuke" || package.Owner == "DNN")
{
package.License = Localization.Localization.GetString("License", Localization.Localization.GlobalResourceFile);
package.Organization = "DNN Corp.";
package.Url = "http://www.dnnsoftware.com";
package.Email = "[email protected]";
package.ReleaseNotes = "There are no release notes for this version.";
}
else
{
package.License = Util.PACKAGE_NoLicense;
}
}
示例15: ProcessLegacyLanguages
public static void ProcessLegacyLanguages()
{
string filePath = Globals.ApplicationMapPath + Localization.Localization.SupportedLocalesFile.Substring(1).Replace("/", "\\");
if (File.Exists(filePath))
{
var doc = new XPathDocument(filePath);
//Check for Browser and Url settings
XPathNavigator browserNav = doc.CreateNavigator().SelectSingleNode("root/browserDetection");
if (browserNav != null)
{
HostController.Instance.Update("EnableBrowserLanguage", Util.ReadAttribute(browserNav, "enabled", false, null, Null.NullString, "true"));
}
XPathNavigator urlNav = doc.CreateNavigator().SelectSingleNode("root/languageInUrl");
if (urlNav != null)
{
HostController.Instance.Update("EnableUrlLanguage", Util.ReadAttribute(urlNav, "enabled", false, null, Null.NullString, "true"));
}
//Process each language
foreach (XPathNavigator nav in doc.CreateNavigator().Select("root/language"))
{
if (nav.NodeType != XPathNodeType.Comment)
{
var language = new Locale();
language.Text = Util.ReadAttribute(nav, "name");
language.Code = Util.ReadAttribute(nav, "key");
language.Fallback = Util.ReadAttribute(nav, "fallback");
//Save Language
Localization.Localization.SaveLanguage(language);
if (language.Code != Localization.Localization.SystemLocale)
{
//Create a Package
var package = new PackageInfo(new InstallerInfo())
{
Name = language.Text,
FriendlyName = language.Text,
Description = Null.NullString,
Version = new Version(1, 0, 0),
PackageType = "CoreLanguagePack",
License = Util.PACKAGE_NoLicense
};
//Create a LanguagePackWriter
var packageWriter = new LanguagePackWriter(language, package);
//Save the manifest
package.Manifest = packageWriter.WriteManifest(true);
//Save Package
PackageController.Instance.SaveExtensionPackage(package);
var languagePack = new LanguagePackInfo
{
LanguageID = language.LanguageId,
PackageID = package.PackageID,
DependentPackageID = -2
};
LanguagePackController.SaveLanguagePack(languagePack);
}
}
}
}
//Process Portal Locales files
foreach (PortalInfo portal in PortalController.Instance.GetPortals())
{
int portalID = portal.PortalID;
filePath = string.Format(Globals.ApplicationMapPath + Localization.Localization.ApplicationResourceDirectory.Substring(1).Replace("/", "\\") + "\\Locales.Portal-{0}.xml", portalID);
if (File.Exists(filePath))
{
var doc = new XPathDocument(filePath);
//Check for Browser and Url settings
XPathNavigator browserNav = doc.CreateNavigator().SelectSingleNode("locales/browserDetection");
if (browserNav != null)
{
PortalController.UpdatePortalSetting(portalID, "EnableBrowserLanguage", Util.ReadAttribute(browserNav, "enabled", false, null, Null.NullString, "true"));
}
XPathNavigator urlNav = doc.CreateNavigator().SelectSingleNode("locales/languageInUrl");
if (urlNav != null)
{
PortalController.UpdatePortalSetting(portalID, "EnableUrlLanguage", Util.ReadAttribute(urlNav, "enabled", false, null, Null.NullString, "true"));
}
foreach (Locale installedLanguage in LocaleController.Instance.GetLocales(Null.NullInteger).Values)
{
string code = installedLanguage.Code;
bool bFound = false;
//Check if this language is "inactive"
foreach (XPathNavigator inactiveNav in doc.CreateNavigator().Select("locales/inactive/locale"))
{
if (inactiveNav.Value == code)
{
bFound = true;
break;
}
}
if (!bFound)
//.........这里部分代码省略.........