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, IsRemoteSession = owner.IsRemoteSession, 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 }; }
public void UpdateAvailablePackageDetails(RPackage package) {}
public void AddDetails(RPackage package, bool isInstalled) {}
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; }
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; }