private void ShowRepository()
        {
            RefreshLocalPlugins();

            var plugins = new List <PluginInformationVm>();
            var repo    = PackageRepositoryFactory.Default.CreateRepository(SelectedRepoUrl);

            try
            {
                var fnd = repo.Search("XplorerPlugin", true);
                foreach (var package in fnd)
                {
                    if (LatestOnly.IsChecked.HasValue && LatestOnly.IsChecked.Value && !package.IsAbsoluteLatestVersion)
                    {
                        continue;
                    }
                    var pv = new PluginInformation(package);
                    if (_diskPlugins.ContainsKey(package.Id))
                    {
                        pv.SetDirectoryInfo(_diskPlugins[package.Id]);
                    }
                    plugins.Add(new PluginInformationVm(pv));
                }
            }
            catch (Exception ex)
            {
                Log.Error("An error occurred getting repository information.", ex);
            }

            PluginList.ItemsSource = plugins;
        }
示例#2
0
        internal IEnumerable <PluginInformation> GetPlugins(PluginChannelOption option)
        {
            RefreshLocalPlugins();
            var repo         = PackageRepositoryFactory.Default.CreateRepository(SelectedRepoUrl);
            var allowDevelop = option != PluginChannelOption.Stable;

            var fnd = repo.Search("XplorerPlugin", allowDevelop);

            foreach (var package in fnd)
            {
                if (option != PluginChannelOption.Versions)
                {
                    if (allowDevelop && !package.IsAbsoluteLatestVersion)
                    {
                        continue;
                    }
                    if (!allowDevelop && !package.IsLatestVersion)
                    {
                        continue;
                    }
                }
                var pv = new PluginInformation(package);
                if (_diskPlugins.ContainsKey(package.Id))
                {
                    pv.SetDirectoryInfo(_diskPlugins[package.Id]);
                }
                yield return(pv);
            }
        }
示例#3
0
        internal void RefreshLocalPlugins()
        {
            _diskPlugins.Clear();
            var dirs = PluginManagement.GetPluginDirectories();

            foreach (var directoryInfo in dirs)
            {
                var pc = new PluginInformation(directoryInfo);
                _diskPlugins.Add(pc.PluginId, pc);
            }
        }
示例#4
0
        internal IEnumerable <PluginInformation> GetPlugins(PluginChannelOption option, string winUiNugetVersion)
        {
            RefreshLocalPlugins();
            var repo           = PackageRepositoryFactory.Default.CreateRepository(SelectedRepoUrl);
            var allowDevelop   = option != PluginChannelOption.LatestStable;
            var invokingVerion = new SemanticVersion(winUiNugetVersion);

            var fnd         = repo.Search("XplorerPlugin", allowDevelop);
            var tmpPackages = new List <IPackage>();

            foreach (var package in fnd)
            {
                // drop develop if latest stable
                System.Diagnostics.Debug.WriteLine($"Evaluating {package}");
                if (option == PluginChannelOption.LatestStable && !string.IsNullOrEmpty(package.Version.SpecialVersion))
                {
                    continue;
                }
                // check it is compatible
                var sel = package.DependencySets.SelectMany(x => x.Dependencies.Where(y => y.Id.StartsWith("Xbim.WindowsUI"))).FirstOrDefault();
                if (sel != null && sel.VersionSpec.Satisfies(invokingVerion))
                {
                    tmpPackages.Add(package);
                }
            }

            if (option == PluginChannelOption.LatestStable || option == PluginChannelOption.LatestIncludingDevelopment)
            {
                // only one per ID
                var selPackages = new List <IPackage>();
                var grouped     = tmpPackages.GroupBy(x => x.Id);
                foreach (var element in grouped)
                {
                    var maxVersion = element.Max(x => x.Version);
                    selPackages.Add(element.FirstOrDefault(x => x.Version == maxVersion));
                }
                tmpPackages = selPackages;
            }


            foreach (var package in tmpPackages)
            {
                var pv = new PluginInformation(package);
                if (_diskPlugins.ContainsKey(package.Id))
                {
                    pv.SetDirectoryInfo(_diskPlugins[package.Id]);
                }
                yield return(pv);
            }
        }
        private void ShowRepository()
        {
            RefreshLocalPlugins();

            var plugins = new List <PluginInformationVm>();
            var repo    = PackageRepositoryFactory.Default.CreateRepository(SelectedRepoUrl);

            try
            {
                var option       = DisplayOptionText;
                var allowDevelop = option != "Stable";

                var fnd = repo.Search("XplorerPlugin", allowDevelop);
                foreach (var package in fnd)
                {
                    if (option != "All versions")
                    {
                        if (allowDevelop && !package.IsAbsoluteLatestVersion)
                        {
                            continue;
                        }
                        if (!allowDevelop && !package.IsLatestVersion)
                        {
                            continue;
                        }
                    }
                    var pv = new PluginInformation(package);
                    if (_diskPlugins.ContainsKey(package.Id))
                    {
                        pv.SetDirectoryInfo(_diskPlugins[package.Id]);
                    }
                    plugins.Add(new PluginInformationVm(pv));
                }
            }
            catch (Exception ex)
            {
                Log.Error("An error occurred getting repository information.", ex);
            }

            PluginList.ItemsSource = plugins;
        }
        private void PluginList_OnDrop(object sender, DragEventArgs e)
        {
            var d = e.Data.GetFormats();

            if (!d.Contains("FileNameW"))
            {
                return;
            }
            var fnames = e.Data.GetData("FileNameW") as IEnumerable <string>;

            if (fnames == null)
            {
                return;
            }
            foreach (var fname in fnames)
            {
                try
                {
                    var fInfo = new FileInfo(fname);
                    if (fInfo.Extension != ".nupkg")
                    {
                        continue;
                    }
                    IPackage p  = new ZipPackage(fInfo.FullName);
                    var      pi = new PluginInformation(p);
                    pi.ExtractPlugin(
                        PluginManagement.GetPluginsDirectory()
                        );
                }
                catch (Exception ex)
                {
                    Log.Error($"Error processing package file [{fname}].", ex);
                }
            }
            RefreshPluginList();
        }
示例#7
0
 internal void SetDirectoryInfo(PluginInformation otherConfiguration)
 {
     SetDirectoryInfo(otherConfiguration._directory);
 }
 public PluginInformationVm(PluginInformation model)
 {
     _model = model;
 }