本文整理汇总了C#中ModuleInfo.GetModuleAssemblyRef方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleInfo.GetModuleAssemblyRef方法的具体用法?C# ModuleInfo.GetModuleAssemblyRef怎么用?C# ModuleInfo.GetModuleAssemblyRef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleInfo
的用法示例。
在下文中一共展示了ModuleInfo.GetModuleAssemblyRef方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsModuleAssemblyInstalled
/// <summary>
/// Determine whether module is already installed.
/// </summary>
/// <param name="moduleInfo">The module info</param>
/// <returns><c>true</c> if the module is installed otherwise <c>false</c>.</returns>
/// <exception cref="System.ArgumentNullException">The <paramref name="moduleInfo" /> is <c>null</c>.</exception>
private bool IsModuleAssemblyInstalled(ModuleInfo moduleInfo)
{
Argument.IsNotNull(() => moduleInfo);
return moduleInfo.GetModuleAssemblyRef(OutputDirectoryAbsoluteUri).IsInstalled;
}
示例2: TryCreateInstallPackageRequest
/// <summary>
/// Tries to create and install package request from the <paramref name="moduleInfo" />.
/// </summary>
/// <param name="moduleInfo">The module info.</param>
/// <param name="installPackageRequest">The install package request.</param>
/// <returns><c>true</c> whether the install package request is created, otherwise <c>false</c></returns>
public bool TryCreateInstallPackageRequest(ModuleInfo moduleInfo, out InstallPackageRequest installPackageRequest)
{
installPackageRequest = null;
var packageName = moduleInfo.GetPackageName();
ModuleAssemblyRef moduleAssemblyRef = moduleInfo.GetModuleAssemblyRef(OutputDirectoryAbsoluteUri);
if (packageName.Version != null && moduleAssemblyRef.IsInstalled)
{
Log.Debug("Creating local install package request for '{0}'.", packageName.Name);
installPackageRequest = new InstallPackageRequest(moduleAssemblyRef);
}
else
{
var repositories = GetPackageRepositories().ToList();
int i = 0;
while (installPackageRequest == null && i < repositories.Count)
{
var repository = repositories[i++];
if (repository != null)
{
Log.Debug("Looking for package '{0}' with version '{1}' on the repository '{2}'", packageName.Id, packageName.Version, PackageSource);
try
{
var package = repository.FindPackage(packageName.Id, packageName.Version);
if (package != null)
{
/*
IEnumerable<FrameworkName> supportedFrameworks = package.GetSupportedFrameworks();
if (supportedFrameworks != null && supportedFrameworks.Any(name => FrameworkIdentifierConversionMap.ContainsKey(name.FullName) && FrameworkIdentifierConversionMap[name.FullName].Equals(Platforms.CurrentPlatform)))
{
Log.Debug("Creating remote install package request for '{0}' from '{1}'", package.GetFullName(), PackageSource);
}
*/
installPackageRequest = new RemoteInstallPackageRequest(this, package, GetModuleAssemblyRef(moduleInfo, package.Version));
}
}
catch (Exception ex)
{
Log.Error(ex, "Failed to create install package request for package '{0}'", packageName.Id);
}
}
}
}
return installPackageRequest != null;
}