示例#1
0
 public static async Task<PackageManager> Create(Repository repo, IAbsoluteDirectoryPath workDir,
     bool createWhenNotExisting = false,
     string remote = null) {
     var pm = new PackageManager(repo, workDir, createWhenNotExisting, remote);
     await repo.RefreshRemotes().ConfigureAwait(false);
     return pm;
 }
        public async Task Uninstall(IUninstallableContent content) {
            await new ContentStatusChanged(content, ItemState.Uninstalling).RaiseEvent().ConfigureAwait(false);
            var dir = _action.Paths.Path.GetChildDirectoryWithName(content.PackageName);
            if (dir.Exists)
                dir.DirectoryInfo.Delete(true);

            using (_repository = new Repository(GetRepositoryPath(), true)) {
                _pm = new PackageManager(_repository, _action.Paths.Path, true);
                _pm.DeletePackageIfExists(new SpecificVersion(content.PackageName));
            }

            var lc = content as LocalContent;
            if (lc != null && lc.ContentId != Guid.Empty) {
                if (lc is ModLocalContent)
                    _action.Status.Mods.Uninstall.Add(lc.ContentId);
                else if (lc is MissionLocalContent) {
                    _action.Status.Missions.Uninstall.Add(lc.ContentId);
                    // TODO
                    //} else if (lc is CollectionLocalContent)
                    //{
                    //_action.Status.Collections.Uninstall.Add(lc.ContentId);
                }
            }
            await new ContentStatusChanged(content, ItemState.Uninstalled).RaiseEvent().ConfigureAwait(false);
        }
示例#3
0
 public BundleManager(PackageManager packageManager) {
     Contract.Requires<ArgumentNullException>(packageManager != null);
     PackageManager = packageManager;
 }
 void SetupPackageManager() {
     _pm = new PackageManager(_repository, _action.Paths.Path, true);
     Sync.Core.Packages.CheckoutType ct;
     if (!Enum.TryParse(_action.CheckoutType.ToString(), out ct))
         throw new InvalidOperationException("Unsupported checkout type");
     _pm.Settings.CheckoutType = ct;
     _pm.Settings.GlobalWorkingPath = _action.GlobalWorkingPath;
 }