• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PackageManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PackageManager的典型用法代码示例。如果您正苦于以下问题:C# PackageManager类的具体用法?C# PackageManager怎么用?C# PackageManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PackageManager类属于命名空间,在下文中一共展示了PackageManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Awake

    void Awake()
    {
        this.pack = PackageManager.Instance;
//        this.objectGroup = GetComponentsInChildren<ObjectGroup>();

        this.pack.onLoaded += pack_onLoaded;
    }
开发者ID:imlovee,项目名称:WatchRemember_Final,代码行数:7,代码来源:GameObjects.cs


示例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"));
        }
开发者ID:rikoe,项目名称:nuget,代码行数:28,代码来源:PackageManagerTest.cs


示例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" };
        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:39,代码来源:Installer.cs


示例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);
            }
        }
开发者ID:grendello,项目名称:nuget,代码行数:29,代码来源:InstallCommand.cs


示例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);
 }
开发者ID:nagyist,项目名称:PlatformInstaller,代码行数:7,代码来源:ServiceMatrix.cs


示例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"}
                });
            });
        }
开发者ID:anurse,项目名称:NuGetBuild,代码行数:33,代码来源:ResolvePackageReference.cs


示例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" ) );
        }
开发者ID:ngzero,项目名称:madb,代码行数:8,代码来源:PackageManagerTests.cs


示例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);
 }
开发者ID:nagyist,项目名称:My-StepCounter,代码行数:8,代码来源:Utils.cs


示例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);
 }
开发者ID:modulexcite,项目名称:NuGet.Extensions,代码行数:9,代码来源:FindPackageTests.cs


示例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
        }
开发者ID:phaufe,项目名称:madb,代码行数:10,代码来源:PackageManagerTests.cs


示例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;
 }
开发者ID:nulltoken,项目名称:PlatformInstaller,代码行数:10,代码来源:InstallingViewModel.cs


示例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;
    }
开发者ID:nulltoken,项目名称:PlatformInstaller,代码行数:54,代码来源:ServiceMatrix.cs


示例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
        }
开发者ID:ngzero,项目名称:madb,代码行数:12,代码来源:PackageManagerTests.cs


示例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");
            }
        }
开发者ID:tobiaszuercher,项目名称:PowerDeploy,代码行数:13,代码来源:DeployCommand.cs


示例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;
        }
开发者ID:GariceZa,项目名称:TesseractTest,代码行数:13,代码来源:CameraHelper.cs


示例16: NuGetDownloader

    public NuGetDownloader(string nugetName, IEnumerable<string> repositories)
    {
        package = nugetName;

        var nugetCacheDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "NuGet", "Cache");

        var reposToUse = new List<IPackageRepository>
        {
            PackageRepositoryFactory.Default.CreateRepository(nugetCacheDirectory)
        };

        reposToUse.AddRange(repositories.ToList().Select(r => PackageRepositoryFactory.Default.CreateRepository(r)));
        var repo = new AggregateRepository(reposToUse);

        packageManager = new PackageManager(repo, "packages");
    }
开发者ID:nulltoken,项目名称:APIComparer,代码行数:16,代码来源:NuGetDownloader.cs


示例17: UninstallingPackageWithNoDependents

        public void UninstallingPackageWithNoDependents()
        {
            // Arrange
            var localRepository = new MockPackageRepository();
            var sourceRepository = new MockPackageRepository();
            var projectSystem = new MockProjectSystem();
            var packageManager = new PackageManager(sourceRepository, new DefaultPackagePathResolver(projectSystem), projectSystem, localRepository);
            var package = PackageUtility.CreatePackage("foo", "1.2.33");
            localRepository.AddPackage(package);

            // Act
            packageManager.UninstallPackage("foo");

            // Assert
            Assert.False(packageManager.LocalRepository.Exists(package));
        }
开发者ID:atheken,项目名称:nuget,代码行数:16,代码来源:PackageManagerTest.cs


示例18: CreatePackageInstaller

        public IPackageInstaller CreatePackageInstaller(string installationPath, string configurationPath)
        {
            var packagePath = this.configurationManager.PackagePath;
            var sourceRepository = this.source.CreatePackageRepository();
            var logger = new PackageLogger();
            var packagePathResolver = new DefaultPackagePathResolver(packagePath);
            var fileSystem = new PhysicalFileSystem(installationPath ?? this.directorySystem.CurrentDirectory) { Logger = logger };
            var destinationRepository = new LocalPackageRepository(packagePath);
            var manager = new PackageManager(
                sourceRepository, packagePathResolver, fileSystem, destinationRepository) { Logger = logger };
            var powerShellPackageFile = new PowerShellPackageFile(
                new BackgroundProcess(),
                manager,
                new PhysicalFileSystem(this.directorySystem.TemporaryPath),
                configurationPath);

            return new DefaultPackageInstaller(manager, powerShellPackageFile, logger);
        }
开发者ID:alexfalkowski,项目名称:NuGet.AdvancedPackagingTool,代码行数:18,代码来源:PackageInstallerFactory.cs


示例19: InstallPackage

        /// <summary>
        /// Install package
        /// </summary>
        /// <param name="pkgId"></param>
        public static JsonResponse InstallPackage(string pkgId)
        {
            try
            {
                if(BlogService.InstalledFromGalleryPackages() != null && 
                    BlogService.InstalledFromGalleryPackages().Find(p => p.PackageId == pkgId) != null)
                    UninstallPackage(pkgId);

                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);

                packageManager.InstallPackage(package, false, true);

                var iPkg = new InstalledPackage { PackageId = package.Id, Version = package.Version.ToString() };
                BlogService.InsertPackage(iPkg);

                var packageFiles = FileSystem.InstallPackage(package.Id, package.Version.ToString());
                BlogService.InsertPackageFiles(packageFiles);

                Blog.CurrentInstance.Cache.Remove(Constants.CacheKey);

                Utils.Log(string.Format("Installed package {0} by {1}", pkgId, Security.CurrentUser.Identity.Name));
            }
            catch (Exception ex)
            {
                Utils.Log("BlogEngine.Core.Packaging.Installer.InstallPackage(" + pkgId + ")", ex);
                try
                {
                    UninstallPackage(pkgId);
                }
                catch (Exception)
                {
                    // just trying to clean up if package did not installed properly
                }
                return new JsonResponse { Success = false, Message = "Error installing package, see logs for details" };
            }

            return new JsonResponse { Success = true, Message = "Package successfully installed" };
        }
开发者ID:sagasu,项目名称:tddLegacy,代码行数:48,代码来源:Installer.cs


示例20: Main

    public static int Main(string[] args)
    {
        Console.WriteLine("Copyright (c) Microsoft Corporation. All rights reserved.");
        Console.WriteLine("FindPackagesWithPackageTypes sample");
        Console.WriteLine();

        PackageManager packageManager = new PackageManager();

        try
        {
            PackageTypes type = PackageTypes.Main;
            IEnumerable<Package> packages = (IEnumerable<Package>) packageManager.FindPackagesWithPackageTypes(type);

            int packageCount = 0;
            foreach (var package in packages)
            {
                DisplayPackageInfo(package);

                Console.WriteLine();
                packageCount += 1;
            }

            if (packageCount < 1)
            {
                Console.WriteLine("No packages were found.");
            }

        }
        catch (UnauthorizedAccessException)
        {
            Console.WriteLine("packageManager.FindPackagesWithPackageTypes() failed because access was denied. This program must be run from an elevated command prompt.");
            
            return 1;
        }
        catch (Exception ex)
        {
            Console.WriteLine("packageManager.FindPackagesWithPackageTypes() failed, error message: {0}", ex.Message);
            Console.WriteLine("Full Stacktrace: {0}", ex.ToString());

            return 1;
        }

        return 0;
    }
开发者ID:dhanzhang,项目名称:Windows-classic-samples,代码行数:44,代码来源:FindPackagesWithPackageTypesSample.cs



注:本文中的PackageManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PackagePartName类代码示例发布时间:2022-05-24
下一篇:
C# PackageInfo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap