Exemplo n.º 1
0
        public async void GetPackageInfo2()
        {
            var path   = _testFiles.GetDestinationPath(Path.Combine("Parser", "dplyr.html"));
            var actual = await RPackageWebParser.RetrievePackageInfo(new Uri(path, UriKind.Absolute));

            var expected = new RPackage()
            {
                Package          = "dplyr",
                Title            = "A Grammar of Data Manipulation",
                Description      = "A fast, consistent tool for working with data frame like objects, both in memory and out of memory.",
                Version          = "0.4.3",
                Author           = "Hadley Wickham [aut, cre], Romain Francois [aut], RStudio [cph]",
                Depends          = "R (≥ 3.1.2)",
                Published        = "2015-09-01",
                License          = "MIT + file LICENSE",
                Imports          = "assertthat, utils, R6, Rcpp, magrittr, lazyeval (≥ 0.1.10), DBI (≥ 0.3)",
                Suggests         = "RSQLite (≥ 1.0.0), RMySQL, RPostgreSQL, data.table, testthat, knitr, microbenchmark, ggplot2, mgcv, Lahman (≥ 3.0-1), nycflights13, methods",
                Maintainer       = "Hadley Wickham  <hadley at rstudio.com>",
                URL              = "https://github.com/hadley/dplyr",
                BugReports       = "https://github.com/hadley/dplyr/issues",
                LinkingTo        = "Rcpp (≥ 0.12.0), BH (≥ 1.58.0-1)",
                NeedsCompilation = "yes",
            };

            actual.ShouldBeEquivalentTo(expected);
        }
Exemplo n.º 2
0
        public static RPackageViewModel CreateInstalled(RPackage package, IRPackageManagerViewModel owner)
        {
            Uri repositoryUri;

            Uri.TryCreate(package.Repository, UriKind.Absolute, out repositoryUri);

            return(new RPackageViewModel(package.Package, owner)
            {
                Title = package.Title.NormalizeWhitespace(),
                Authors = package.Author.NormalizeWhitespace(),
                License = package.License.NormalizeWhitespace(),
                Urls = package.URL?.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries)
                       .Select(s => s.Trim())
                       .ToArray() ?? new string[0],
                NeedsCompilation = package.NeedsCompilation != null && !package.NeedsCompilation.EqualsIgnoreCase("no"),
                LibraryPath = package.LibPath,
                RepositoryUri = repositoryUri,
                RepositoryText = repositoryUri != null ? null : package.Repository,
                Description = package.Description.NormalizeWhitespace(),
                Built = package.Built,
                Depends = package.Depends.NormalizeWhitespace(),
                Imports = package.Imports.NormalizeWhitespace(),
                Suggests = package.Suggests.NormalizeWhitespace(),
                LatestVersion = package.Version,
                InstalledVersion = package.Version,
                IsInstalled = true,
                HasDetails = true
            });
        }
Exemplo n.º 3
0
        public async void GetPackageInfo1()
        {
            var path   = _testFiles.GetDestinationPath(Path.Combine("Parser", "ddpcr.html"));
            var actual = await RPackageWebParser.RetrievePackageInfo(new Uri(path, UriKind.Absolute));

            var expected = new RPackage()
            {
                Package          = "ddpcr",
                Title            = "Analysis and Visualization of Droplet Digital PCR in R and on the Web",
                Description      = "An interface to explore, analyze, and visualize droplet digital PCR (ddPCR) data in R. This is the first non-proprietary software for analyzing two-channel ddPCR data. An interactive tool was also created and is available online to facilitate this analysis for anyone who is not comfortable with using R.",
                Version          = "1.1.2",
                Author           = "Dean Attali [aut, cre]",
                Depends          = "R (≥ 3.1.0)",
                Published        = "2016-03-17",
                License          = "MIT + file LICENSE",
                Imports          = "DT (≥ 0.1), dplyr (≥ 0.4.0), ggplot2 (≥ 1.0.1.9003), lazyeval (≥ 0.1.10), magrittr (≥ 1.5), mixtools (≥ 1.0.2), plyr (≥ 1.8.1), readr (≥ 0.1.0), shiny (≥ 0.11.0), shinyjs (≥ 0.4.0)",
                Suggests         = "ggExtra (≥ 0.3.0), graphics, grid (≥ 3.2.2), gridExtra (≥ 2.0.0), knitr (≥ 1.7), rmarkdown, stats, testthat (≥ 0.9.1), utils",
                Maintainer       = "Dean Attali  <daattali at gmail.com>",
                URL              = "https://github.com/daattali/ddpcr",
                BugReports       = "https://github.com/daattali/ddpcr/issues",
                NeedsCompilation = "no",
            };

            actual.ShouldBeEquivalentTo(expected);
        }
Exemplo n.º 4
0
 public async Task AddAdditionalPackageInfoAsync(RPackage pkg)
 {
     try {
         var uri = GetPackageWebIndexUri(pkg.Package, pkg.Repository);
         await RPackageWebParser.RetrievePackageInfo(uri, pkg);
     } catch (WebException ex) {
         throw new RPackageManagerException(ex.Message, ex);
     }
 }
Exemplo n.º 5
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            package   = new RPackage();
            pending   = true;
            this.Text = "RPK Editor : New Archive (unsaved)";
            treeView1.Nodes.Clear();

            panel1.Visible       = false;
            fileDragDrop.Visible = true;
        }
Exemplo n.º 6
0
        public bool LoadPackage(string relativeFilename, string password = null)
        {
            string fullFilename = GetFilePath(relativeFilename);

            if (File.Exists(fullFilename))
            {
                RPackage package = new RPackage(fullFilename, password);
                packages.Add(package);
                return(true);
            }
            return(false);
        }
Exemplo n.º 7
0
 public static RPackageViewModel CreateAvailable(RPackage package)
 {
     return(new RPackageViewModel(package.Package)
     {
         LatestVersion = package.Version,
         Depends = package.Depends.NormalizeWhitespace(),
         Imports = package.Imports.NormalizeWhitespace(),
         Suggests = package.Suggests.NormalizeWhitespace(),
         License = package.License.NormalizeWhitespace(),
         NeedsCompilation = package.NeedsCompilation != null && !package.NeedsCompilation.EqualsIgnoreCase("no"),
         Repository = package.Repository,
     });
 }
Exemplo n.º 8
0
        public IdleTimeSource()
        {
            var crinfo = new OLECRINFO[1];

            crinfo[0].cbSize            = (uint)Marshal.SizeOf(typeof(OLECRINFO));
            crinfo[0].grfcrf            = (uint)_OLECRF.olecrfNeedIdleTime | (uint)_OLECRF.olecrfNeedPeriodicIdleTime;
            crinfo[0].grfcadvf          = (uint)_OLECADVF.olecadvfModal | (uint)_OLECADVF.olecadvfRedrawOff | (uint)_OLECADVF.olecadvfWarningsOff;
            crinfo[0].uIdleTimeInterval = 200;

            var oleComponentManager = RPackage.GetGlobalService(typeof(SOleComponentManager)) as IOleComponentManager;

            oleComponentManager.FRegisterComponent(this, crinfo, out _componentID);
        }
Exemplo n.º 9
0
        public void UpdateAvailablePackageDetails(RPackage package)
        {
            Uri repositoryUri;

            Uri.TryCreate(package.Repository, UriKind.Absolute, out repositoryUri);

            LatestVersion     = package.Version;
            Depends           = package.Depends;
            Imports           = package.Imports;
            Suggests          = package.Suggests;
            License           = package.License;
            RepositoryUri     = repositoryUri;
            RepositoryText    = repositoryUri != null ? null : package.Repository;
            IsUpdateAvailable = new RPackageVersion(LatestVersion).CompareTo(new RPackageVersion(InstalledVersion)) > 0;
        }
Exemplo n.º 10
0
        public VsAppShell()
        {
            ThreadHelper.ThrowIfNotOnUIThread("VsEditorShell constructor");
            MainThread = Thread.CurrentThread;

            IComponentModel componentModel = RPackage.GetGlobalService(typeof(SComponentModel)) as IComponentModel;

            CompositionService = componentModel.DefaultCompositionService;
            ExportProvider     = componentModel.DefaultExportProvider;

            _idleTimeSource                 = new IdleTimeSource();
            _idleTimeSource.OnIdle         += OnIdle;
            _idleTimeSource.OnTerminateApp += OnTerminateApp;

            DetemineTestEnvironment();
            EditorShell.Current = this;
        }
Exemplo n.º 11
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.FileName = "";
            var result = openFileDialog1.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                treeView1.Nodes.Clear();
                package   = new RPackage(openFileDialog1.FileName);
                pending   = false;
                this.Text = "RPK Editor : " + Path.GetFileName(openFileDialog1.FileName);
                TreeNode root = treeView1.Nodes.Add(Path.GetFileNameWithoutExtension(openFileDialog1.FileName));
                PopulateTreeNodes(root, package.GetEntries(), '/');
                panel1.Visible       = true;
                fileDragDrop.Visible = false;
            }
        }
Exemplo n.º 12
0
        public void AddDetails(RPackage package, bool isInstalled)
        {
            Title       = package.Title.NormalizeWhitespace();
            Description = package.Description.NormalizeWhitespace();
            Authors     = package.Author.NormalizeWhitespace();
            Urls        = package.URL?.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries)
                          .Select(s => s.Trim())
                          .ToArray() ?? new string[0];
            LibraryPath = package.LibPath;
            Built       = package.Built;

            if (isInstalled)
            {
                InstalledVersion  = package.Version;
                IsInstalled       = true;
                IsUpdateAvailable = new RPackageVersion(LatestVersion).CompareTo(new RPackageVersion(InstalledVersion)) > 0;
            }

            HasDetails = true;
        }
Exemplo n.º 13
0
        /// <summary>
        /// Downloads the index html page specified, and extracts a set of known fields from it.
        /// </summary>
        /// <param name="packageUri">Location of index.html page.</param>
        /// <param name="result">RPackage object to fill in. A new one is created if none is passed in.</param>
        /// <returns>RPackage object populated with the information found in the html page.</returns>
        /// <exception cref="WebException">Page cannot be loaded.</exception>
        /// <remarks>
        /// If an existing RPackage object is passed in, the fields that are already filled in
        /// won't be overwritten by the ones extracted from the html page.
        /// </remarks>
        public static async Task <RPackage> RetrievePackageInfo(Uri packageUri, RPackage result = null)
        {
            string content;

            using (var webClient = new WebClient()) {
                content = await webClient.DownloadStringTaskAsync(packageUri);
            }

            var pkg = result ?? new RPackage();

            var tree = new HtmlTree(new Microsoft.Web.Core.Text.TextStream(content));

            tree.Build();

            var search = new IndexVisitor(pkg);

            tree.Accept(search, null);

            return(pkg);
        }
Exemplo n.º 14
0
 public void UpdateAvailablePackageDetails(RPackage package)
 {
 }
Exemplo n.º 15
0
 public void AddDetails(RPackage package, bool isInstalled)
 {
 }
Exemplo n.º 16
0
 public IndexVisitor(RPackage pkg)
 {
     _pkg = pkg;
 }