本文整理汇总了C#中IPackageManager类的典型用法代码示例。如果您正苦于以下问题:C# IPackageManager类的具体用法?C# IPackageManager怎么用?C# IPackageManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPackageManager类属于命名空间,在下文中一共展示了IPackageManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Purge
/// <summary>
/// Attempts to delete files and directories in the trash.
/// </summary>
/// <param name="pkgmgr">package manager reference</param>
public static void Purge(IPackageManager pkgmgr)
{
List<string> deleted = new List<string>();
foreach (string p in pkgmgr.Trash.OrderBy(i => i)) {
try {
if (File.Exists(p))
File.Delete(p);
else if (Directory.Exists(p) && pkgmgr.CheckPathOwned(p)) {
/* this can be removed from the trash */
} else if (Directory.Exists(p) && Directory.GetFiles(p).Length > 0)
continue;
else if (Directory.Exists(p))
Directory.Delete(p);
else {
/* orphaned file? */
}
deleted.Add(p);
} catch {
continue;
}
}
pkgmgr.DeleteTrashItems(deleted.ToArray());
}
示例2: ActionsViewModel
public ActionsViewModel(IPackageManager packageManager, List<PackageAction> actions)
{
DisplayName = "";
List = new ObservableCollection<PackageAction>(actions);
List.CollectionChanged += (sender, args) => RaisePropertyChanged(() => OrderedList);
var eventHandler = new PropertyChangedEventHandler((sender, args) =>
{
if (List.Any(n => n.Progress != 100))
return;
CanClose = true;
RaisePropertyChanged(() => CanClose);
// TODO: if autoclose in options: TryClose(true)
});
actions.ForEach(n => n.SubscribeToPropertyChanged(eventHandler));
foreach (var action in actions)
{
action.ActionAdded += a => DispatcherHelper.CheckBeginInvokeOnUI(() => List.Add(a));
}
CloseCommand = new RelayCommand(() => TryClose(true));
packageManager.Execute(actions.ToArray());
}
示例3: PackageService
public PackageService(IPackageManager packageManager, INotifier notifier)
{
_packageManager = packageManager;
_notifier = notifier;
T = NullLocalizer.Instance;
}
示例4: TryInitialize
bool TryInitialize()
{
try
{
_dte = SiteManager.GetGlobalService<DTE>();
_running = _dte != null;
}
catch
{
_running = false;
}
if (!_running) return false;
// TODO: seen in the wild, _dte.Solution is null (?), need to schedule and restart initialization for those scenarios.
_solution = new DteSolution(_dte.Solution);
_solution.ProjectChanged += HandleProjectChange;
var environment = ServiceLocator.GetService<IEnvironment>();
_packageManager = ServiceLocator.GetService<IPackageManager>();
_assembliesChanged = new EventWaitHandle(false, EventResetMode.AutoReset, System.Diagnostics.Process.GetCurrentProcess().Id + ASSEMBLY_NOTIFY);
_rootDirectory = environment.DescriptorFile.Parent;
_projectRepository = environment.ProjectRepository;
RegisterFileListener();
RefreshProjects();
_timer = new Timer(_ => RefreshProjects(), null, Timeout.Infinite, Timeout.Infinite);
return true;
}
示例5: ExtensionManagerWindow
public ExtensionManagerWindow(IPackageManager packageManager)
{
InitializeComponent();
explorer.Providers.Add(new InstalledProvider(packageManager, Resources));
explorer.Providers.Add(new GalleryProvider(packageManager, Resources));
explorer.Providers.Add(new UpdatesProvider(packageManager, Resources));
explorer.SelectedProvider = explorer.Providers[0];
//explorer.BringExtensionIntoView();
//explorer.CategorySelectionChanged+=
explorer.IsDetailPaneVisible = true;
explorer.IsLeftNavigationVisible = true;
explorer.IsPageNavigatorVisible = true;
explorer.IsProvidersListVisible = true;
explorer.IsSearchVisible = true;
//explorer.NoItemSelectedMessage = "Hello";
//explorer.NoItemsMessage = "Hi";
//explorer.PageNavigator
//explorer.ProviderSelectionChanged
//explorer.Providers
//explorer.SelectedExtension
//explorer.SelectedExtensionTreeNode
//explorer.SelectedProvider
//explorer.SelectedSortField
//explorer.SetFocusOnSearchBox();
}
示例6: ShouldElevateAsync
public async Task<bool> ShouldElevateAsync(IPackageManager sender, string operation) {
if (_alwaysElevate) {
return true;
}
return ShouldElevate(_site, sender.Factory.Configuration, operation);
}
示例7: Operation
public Operation(
PackageOperation operation,
IProjectManager projectManager,
IPackageManager packageManager)
: base(operation.Package, operation.Action)
{
if (projectManager != null && packageManager != null)
{
throw new ArgumentException("Only one of packageManager and projectManager can be non-null");
}
if (operation.Target == PackageOperationTarget.PackagesFolder && packageManager == null)
{
throw new ArgumentNullException("packageManager");
}
if (operation.Target == PackageOperationTarget.Project && projectManager == null)
{
throw new ArgumentNullException("projectManager");
}
Target = operation.Target;
PackageManager = packageManager;
ProjectManager = projectManager;
if (ProjectManager != null)
{
_projectName = ProjectManager.Project.ProjectName;
}
}
示例8: GenerateUniqueToken
/// <summary>
/// We want to base the lock name off of the full path of the package, however, the Mutex looks for files on disk if a path is given.
/// Additionally, it also fails if the string is longer than 256 characters. Therefore we obtain a base-64 encoded hash of the path.
/// </summary>
/// <seealso cref="http://social.msdn.microsoft.com/forums/en-us/clr/thread/D0B3BF82-4D23-47C8-8706-CC847157AC81"/>
private static string GenerateUniqueToken(IPackageManager packageManager, string packageId, SemanticVersion version)
{
var packagePath = packageManager.FileSystem.GetFullPath(packageManager.PathResolver.GetPackageFileName(packageId, version));
var pathBytes = Encoding.UTF8.GetBytes(packagePath);
var hashProvider = new CryptoHashProvider("SHA256");
return Convert.ToBase64String(hashProvider.CalculateHash(pathBytes)).ToUpperInvariant();
}
示例9: TestWrapCommand
public TestWrapCommand(IFileSystem fileSystem,IPackageResolver resolver, IEnvironment environment, IPackageExporter exporter, IPackageManager manager)
{
_fileSystem = fileSystem;
_exporter = exporter;
_manager = manager;
_resolver = resolver;
_environment = environment;
}
示例10: PowerShellPackageFile
public PowerShellPackageFile(
IProcess process, IPackageManager manager, IFileSystem fileSystem, string configurationPath)
{
this.process = process;
this.manager = manager;
this.fileSystem = fileSystem;
this.configurationPath = configurationPath;
}
示例11: RepositoryService
public RepositoryService(IPackageRepository packageRepository, IPackageManager packageManager, IJsonSerializer jsonSerializer)
{
if (packageRepository == null) throw new ArgumentNullException("packageRepository");
if (packageManager == null) throw new ArgumentNullException("packageManager");
_packageRepository = packageRepository;
_packageManager = packageManager;
_jsonSerializer = jsonSerializer;
}
示例12: Ps1ScaffolderLocator
public Ps1ScaffolderLocator(IPowershellCommandInvoker commandInvoker, IPackageManager packageManager, IPackagePathResolver pathResolver, FileSystem.IFileSystem fileSystem, IScaffoldingConfigStore configStore)
{
_commandInvoker = commandInvoker;
_packageManager = packageManager;
_pathResolver = pathResolver ?? packageManager.PathResolver;
_fileSystem = fileSystem;
_configStore = configStore;
}
示例13: PackageManager
NuGet.IPackageManager INuGetFactory.GetPackageManager()
{
if (_packageManager != null)
return _packageManager;
var repo = ((INuGetFactory)this).GetPackageRepository();
_packageManager = new PackageManager(repo, _arguments.GetInstallationDirectory());
return _packageManager;
}
示例14: InstallPackageCommand
public InstallPackageCommand(
IHostPlatformDetector hostPlatformDetector,
IPackageManager packageManager,
IFeatureManager featureManager)
{
this.m_HostPlatformDetector = hostPlatformDetector;
this.m_PackageManager = packageManager;
_featureManager = featureManager;
}
示例15: KnownToolProvider
public KnownToolProvider(
IPackageGlobalTool packageGlobalTool,
IPackageManager packageManager,
IHostPlatformDetector hostPlatformDetector)
{
_packageGlobalTool = packageGlobalTool;
_packageManager = packageManager;
_hostPlatformDetector = hostPlatformDetector;
}