本文整理汇总了C#中PackageManager类的典型用法代码示例。如果您正苦于以下问题:C# PackageManager类的具体用法?C# PackageManager怎么用?C# PackageManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PackageManager类属于命名空间,在下文中一共展示了PackageManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
void Awake()
{
this.pack = PackageManager.Instance;
// this.objectGroup = GetComponentsInChildren<ObjectGroup>();
this.pack.onLoaded += pack_onLoaded;
}
示例2: InstallPackageAddsAllFilesToFileSystem
public void InstallPackageAddsAllFilesToFileSystem()
{
// Arrange
var projectSystem = new MockProjectSystem();
var sourceRepository = new MockPackageRepository();
var pathResolver = new DefaultPackagePathResolver(projectSystem);
var packageManager = new PackageManager(sourceRepository, pathResolver, projectSystem,
new SharedPackageRepository(pathResolver, projectSystem, projectSystem));
IPackage packageA = PackageUtility.CreatePackage("A", "1.0",
new[] { "contentFile", @"sub\contentFile" },
new[] { @"lib\reference.dll" },
new[] { @"readme.txt" });
sourceRepository.AddPackage(packageA);
// Act
Install("A", new NullProjectManager(packageManager));
// Assert
Assert.Equal(0, projectSystem.References.Count);
Assert.Equal(5, projectSystem.Paths.Count);
Assert.True(projectSystem.FileExists(@"A.1.0\content\contentFile"));
Assert.True(projectSystem.FileExists(@"A.1.0\content\sub\contentFile"));
Assert.True(projectSystem.FileExists(@"A.1.0\lib\reference.dll"));
Assert.True(projectSystem.FileExists(@"A.1.0\tools\readme.txt"));
Assert.True(projectSystem.FileExists(@"A.1.0\A.1.0.nupkg"));
}
示例3: UninstallPackage
/// <summary>
/// Uninstall package
/// </summary>
/// <param name="pkgId"></param>
/// <returns></returns>
public static JsonResponse UninstallPackage(string pkgId)
{
try
{
var packageManager = new PackageManager(
_repository,
new DefaultPackagePathResolver(BlogSettings.Instance.GalleryFeedUrl),
new PhysicalFileSystem(HttpContext.Current.Server.MapPath(Utils.ApplicationRelativeWebRoot + "App_Data/packages"))
);
var package = _repository.FindPackage(pkgId);
if (package == null)
return new JsonResponse { Success = false, Message = "Package " + pkgId + " not found" };
packageManager.UninstallPackage(package, true);
FileSystem.UninstallPackage(package.Id);
BlogService.DeletePackage(pkgId);
// reset cache
Blog.CurrentInstance.Cache.Remove(Constants.CacheKey);
Utils.Log(string.Format("Uninstalled package {0} by {1}", pkgId, Security.CurrentUser.Identity.Name));
}
catch (Exception ex)
{
Utils.Log("BlogEngine.Core.Packaging.Installer.UninstallPackage(" + pkgId + ")", ex);
return new JsonResponse { Success = false, Message = "Error uninstalling package, see logs for details" };
}
return new JsonResponse { Success = true, Message = "Package successfully uninstalled" };
}
示例4: ExecuteCommand
public override void ExecuteCommand()
{
var feedUrl = DefaultFeedUrl;
if (!String.IsNullOrEmpty(Source)) {
feedUrl = Source;
}
IPackageRepository packageRepository = RepositoryFactory.CreateRepository(new PackageSource(feedUrl));
// Use the passed in install path if any, and default to the current dir
string installPath = OutputDirectory ?? Directory.GetCurrentDirectory();
var packageManager = new PackageManager(packageRepository,
new DefaultPackagePathResolver(installPath, useSideBySidePaths: !ExcludeVersion),
new PhysicalFileSystem(installPath));
packageManager.Logger = Console;
// If the first argument is a packages.config file, install everything it lists
// Otherwise, treat the first argument as a package Id
if (Path.GetFileName(Arguments[0]).Equals(PackageReferenceRepository.PackageReferenceFile, StringComparison.OrdinalIgnoreCase)) {
InstallPackagesFromConfigFile(packageManager, installPath);
}
else {
string packageId = Arguments[0];
Version version = Version != null ? new Version(Version) : null;
packageManager.InstallPackage(packageId, version);
}
}
示例5: InstallationDefinition
public static InstallationDefinition InstallationDefinition(PackageManager packageManager, string visualStudioVersion)
{
var isVisualStudioInstalled = VisualStudioDetecter.InstalledVersions.Contains(visualStudioVersion);
var packageName = string.Format("ServiceMatrix.{0}.install", visualStudioVersion);
var isChocolateyPackageInstalled = packageManager.IsInstalled(packageName);
return GetInstallationDefinition(visualStudioVersion, isVisualStudioInstalled, isChocolateyPackageInstalled, packageName);
}
示例6: ResolvePackage
private IEnumerable<ITaskItem> ResolvePackage(ITaskItem package)
{
string id = package.ItemSpec;
string version = package.GetMetadata("Version");
Log.LogMessage(MessageImportance.Normal, "Resolving Package Reference {0} {1}...", id, version);
// Initial version just searches a machine-level repository
var localFs = new PhysicalFileSystem(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "NuGet", "Lib"));
var defaultResolver = new DefaultPackagePathResolver(localFs);
var machineRepo = new LocalPackageRepository(defaultResolver, localFs);
var buildRepo = new BuildPackageRepository();
var remoteRepo = new DataServicePackageRepository(new Uri("https://nuget.org/api/v2"));
var project = new BuildProjectSystem(ProjectDirectory, new FrameworkName(TargetFramework), CurrentReferences);
var manager = new PackageManager(remoteRepo, defaultResolver, localFs, machineRepo);
var projectManager = new ProjectManager(remoteRepo, defaultResolver, project, buildRepo);
// Install the package
var ver = new SemanticVersion(version);
manager.PackageInstalling += manager_PackageInstalling;
manager.InstallPackage(id, ver);
projectManager.AddPackageReference(id, ver);
return project.OutputReferences.Select(item =>
{
var name = AssemblyName.GetAssemblyName(item);
return new TaskItem(name.FullName, new Dictionary<string, string>() {
{"HintPath", item },
{"Private", "true"}
});
});
}
示例7: ExistsTest
public void ExistsTest( )
{
Device device = GetFirstDevice ( );
PackageManager pm = new PackageManager ( device );
Assert.True ( pm.Exists ( "com.android.contacts" ) );
Assert.False ( pm.Exists ( "foo.bar.package" ) );
}
示例8: IsKitKatWithStepCounter
public static bool IsKitKatWithStepCounter(PackageManager pm)
{
// Require at least Android KitKat
int currentApiVersion = (int)Build.VERSION.SdkInt;
// Check that the device supports the step counter and detector sensors
return currentApiVersion >= 19
&& pm.HasSystemFeature (Android.Content.PM.PackageManager.FeatureSensorStepCounter);
}
示例9: TestFixtureSetUp
public void TestFixtureSetUp()
{
_mockFileSystem = new MockFileSystem();
_packageManager = new PackageManager(
AggregateRepositoryHelper.CreateAggregateRepositoryFromSources(Utilities.GetFactory(),
Utilities.GetSourceProvider(),
new List<string>() { "Dev" }),
new DefaultPackagePathResolver(_mockFileSystem), _mockFileSystem);
}
示例10: RefreshPackagesTest
public void RefreshPackagesTest( )
{
Device device = GetFirstDevice ( );
PackageManager pm = new PackageManager ( device );
pm.RefreshPackages ( );
Assert.IsTrue ( pm.Packages.ContainsKey ( "com.android.contacts" ) );
Assert.IsTrue ( pm.Packages.ContainsKey ( "android" ) ); // the framework
}
示例11: InstallingViewModel
public InstallingViewModel(PackageDefinitionService packageDefinitionDiscovery, ChocolateyInstaller chocolateyInstaller, IEventAggregator eventAggregator, PackageManager packageManager, IWindowManager windowManager, PowerShellRunner powerShellRunner, List<string> itemsToInstall)
{
PackageDefinitionService = packageDefinitionDiscovery;
this.chocolateyInstaller = chocolateyInstaller;
this.eventAggregator = eventAggregator;
this.packageManager = packageManager;
this.windowManager = windowManager;
this.powerShellRunner = powerShellRunner;
this.itemsToInstall = itemsToInstall;
}
示例12: InstallationDefinition
public static InstallationDefinition InstallationDefinition(PackageManager packageManager)
{
var versionsToInstall = VisualStudioDetecter.InstalledVersions.Where(version => supportedVersions.Contains(version));
var installationDefinition = new InstallationDefinition
{
SortOrder = 20,
Name = "ServiceMatrix",
Image = "/Images/SM.png",
Disabled = true,
ToolTip = "ServiceMatrix requires Visual Studio 2012 to be installed,",
PackageDefinitions = new List<PackageDefinition>(),
SelectedByDefault = false
};
foreach (var version in versionsToInstall)
{
var packageName = "ServiceMatrix." + version + ".install";
if (packageManager.IsInstalled(packageName))
{
continue;
}
installationDefinition.PackageDefinitions.Add(new PackageDefinition
{
Name =packageName,
DisplayName = "ServiceMatrix for " + version
});
}
if (installationDefinition.PackageDefinitions.Any())
{
installationDefinition.Status = "Install";
installationDefinition.SelectedByDefault = true;
installationDefinition.Disabled = false;
installationDefinition.ToolTip = "Install ServiceMatrix";
}
else
{
if (versionsToInstall.Any())
{
installationDefinition.Status = "Already installed";
installationDefinition.ToolTip = "ServiceMatrix for Visual Studio 2012";
}
else
{
installationDefinition.Status = "VS 2012 required";
installationDefinition.ToolTip = "ServiceMatrix requires Visual Studio 2012";
}
}
return installationDefinition;
}
示例13: RefreshPackagesTest
public void RefreshPackagesTest( )
{
Device device = GetFirstDevice ( );
PackageManager pm = new PackageManager ( device );
Assert.DoesNotThrow ( new Assert.ThrowsDelegate ( delegate ( ) {
pm.RefreshPackages ( );
} ) );
Assert.True ( pm.Packages.ContainsKey ( "com.android.contacts" ) );
Assert.True ( pm.Packages.ContainsKey ( "android" ) ); // the framework
}
示例14: Execute
public void Execute(IPackage package, string packagePath)
{
var dialog = new OpenFileDialog();
var result = dialog.ShowDialog();
if (result == DialogResult.OK)
{
var provider = new EnvironmentProvider();
var packageManager = new PackageManager(provider);
packageManager.ConfigurePackage(packagePath, dialog.FileNames[0], @"c:\temp\packageexplorer");
}
}
示例15: AppToTakePicturesExists
internal bool AppToTakePicturesExists(PackageManager pkgManager)
{
// Check if there is an application that can take pictures
var intent = new Intent (MediaStore.ActionImageCapture);
IList<ResolveInfo> availableActivities = pkgManager.QueryIntentActivities (intent, PackageInfoFlags.MatchDefaultOnly);
foreach (var item in availableActivities) {
Log.Info ("AVAILABLE CAMERA APPS", item.ToString());
}
return availableActivities != null && availableActivities.Count > 0;
}