├── src ├── Directory.Build.targets ├── Orc.NuGetExplorer │ ├── Interface │ │ └── ICloneable.cs │ ├── Enums │ │ ├── MetadataOrigin.cs │ │ ├── PackageStatus.cs │ │ └── CredentialStoragePolicy.cs │ ├── Messaging │ │ ├── Base │ │ │ └── NuGetExplorerServiceMessage.cs │ │ └── PackagingDeletemeMessage.cs │ ├── Management │ │ ├── Interfaces │ │ │ ├── IPackageManager.cs │ │ │ ├── IDefaultExtensibleProjectProvider.cs │ │ │ └── IExtensibleProjectLocator.cs │ │ ├── NuGetProjectMetadata.cs │ │ ├── Exceptions │ │ │ ├── ProjectStateException.cs │ │ │ ├── ProjectManageException.cs │ │ │ ├── MissingPackageException.cs │ │ │ ├── IncompatiblePackageException.cs │ │ │ └── ProjectInstallException.cs │ │ ├── EventArgs │ │ │ ├── NuGetProjectEventArgs.cs │ │ │ ├── InstallNuGetProjectEventArgs.cs │ │ │ ├── UninstallNuGetProjectEventArgs.cs │ │ │ └── UpdateNuGetProjectEventArgs.cs │ │ ├── Projects │ │ │ └── Interfaces │ │ │ │ └── IExtensibleProject.cs │ │ ├── DefaultExtensibleProjectProvider.cs │ │ ├── BatchUpdateToken.cs │ │ └── SourceContext.cs │ ├── Scenario │ │ ├── Interfaces │ │ │ └── IUpgradeScenario.cs │ │ └── Base │ │ │ └── UpgradeListenerBase.cs │ ├── Services │ │ ├── Enums │ │ │ ├── PackageOperationType.cs │ │ │ └── FeedVerificationResult.cs │ │ ├── Interfaces │ │ │ ├── IPleaseWaitInterruptService.cs │ │ │ ├── IFileSystemService.cs │ │ │ ├── IBackupFileSystemService.cs │ │ │ ├── IApiPackageRegistry.cs │ │ │ ├── ITemporaryFIleSystemContextService.cs │ │ │ ├── IDefferedPackageLoaderService.cs │ │ │ ├── INuGetExplorerInitializationService.cs │ │ │ ├── IRollbackPackageOperationService.cs │ │ │ ├── ICredentialProviderLoaderService.cs │ │ │ ├── IRepositoryService.cs │ │ │ ├── IPackageOperationContextService.cs │ │ │ ├── IRepositoryContextService.cs │ │ │ ├── INuGetFeedVerificationService.cs │ │ │ ├── INuGetProjectUpgradeService.cs │ │ │ ├── IDownloadingProgressTrackerService.cs │ │ │ ├── INuGetLogListeningSevice.cs │ │ │ ├── IPackageLoaderService.cs │ │ │ ├── IPackageOperationService.cs │ │ │ ├── IPackagesUpdatesSearcherService.cs │ │ │ ├── IPackageQueryService.cs │ │ │ ├── INuGetConfigurationService.cs │ │ │ ├── IPackageOperationNotificationService.cs │ │ │ └── IPackageInstallationService.cs │ │ ├── EventArgs │ │ │ ├── NuGetLogRecordEventArgs.cs │ │ │ ├── OperationContextEventArgs.cs │ │ │ ├── PackageOperationBatchEventArgs.cs │ │ │ └── PackageOperationEventArgs.cs │ │ ├── Exceptions │ │ │ ├── InvalidPathException.cs │ │ │ └── ApiValidationException.cs │ │ ├── Tokens │ │ │ └── CredentialsToken.cs │ │ └── TemporaryFIleSystemContextService.cs │ ├── Web │ │ ├── Interfaces │ │ │ └── IHttpExceptionHandler.cs │ │ ├── FatalProtocolExceptionExtension.cs │ │ └── HttpWebExceptionHandler.cs │ ├── Windows │ │ └── Enums │ │ │ └── DownlevelTextMode.cs │ ├── Providers │ │ ├── Interfaces │ │ │ ├── IApplicationCacheProvider.cs │ │ │ ├── INuGetProjectContextProvider.cs │ │ │ ├── IModelProvider.cs │ │ │ ├── IDefaultPackageSourcesProvider.cs │ │ │ ├── IExtendedSourceRepositoryProvider.cs │ │ │ └── INuGetProjectConfigurationProvider.cs │ │ ├── EmptyProjectContextProvider.cs │ │ ├── ExplorerCacheProvider.cs │ │ ├── EmptyDefaultPackageSourcesProvider.cs │ │ ├── ModelProvider.cs │ │ └── NuGetPackageSourceProvider.cs │ ├── Factories │ │ └── Interfaces │ │ │ └── IPackageSourceFactory.cs │ ├── NuGet │ │ ├── Interfaces │ │ │ ├── IPackageSource.cs │ │ │ └── IDefaultNuGetFramework.cs │ │ ├── Resolver │ │ │ └── Extensions │ │ │ │ └── PackageResolverExtensions.cs │ │ ├── Packaging │ │ │ ├── PackageOperationInfo.cs │ │ │ ├── UpdatePackageSearchMetadata.cs │ │ │ ├── PackageCollectionItem.cs │ │ │ └── PackageCollection.cs │ │ ├── Install │ │ │ └── InstallerResult.cs │ │ ├── PackageSearchParameters.cs │ │ ├── DefaultNuGetFolders.cs │ │ └── Helpers │ │ │ └── V2SearchHelper.cs │ ├── Models │ │ ├── Interfaces │ │ │ ├── INuGetSettings.cs │ │ │ ├── IObservablePackage.cs │ │ │ ├── IRepository.cs │ │ │ ├── INuGetSource.cs │ │ │ └── IPackageDetails.cs │ │ ├── EventArgs │ │ │ ├── PackageModelStatusEventArgs.cs │ │ │ └── PropertyChangedExtendedEventArgs.cs │ │ ├── PackageInstallationContext.cs │ │ ├── InstallationContext.cs │ │ ├── NuGetActionTarget.cs │ │ └── Repository.cs │ ├── Configuration │ │ ├── Enums │ │ │ └── ConfigurationSection.cs │ │ ├── Interfaces │ │ │ └── IVersionedSettings.cs │ │ ├── Base │ │ │ └── ConfigurationListenerBase.cs │ │ └── NuGetSettingsSection.cs │ ├── Win32 │ │ └── User32.cs │ ├── Validation │ │ ├── Providers │ │ │ ├── Interfaces │ │ │ │ └── IPackageValidatorProvider.cs │ │ │ └── DefaultPackageValidatorProvider.cs │ │ └── Interfaces │ │ │ └── IPackageValidator.cs │ ├── Context │ │ ├── Interfaces │ │ │ ├── ITemporaryFileSystemContext.cs │ │ │ └── IPackageOperationContext.cs │ │ └── PackageOperationContext.cs │ ├── Extensions │ │ ├── IRepositoryExtensions.cs │ │ ├── NuGetFrameworkExtensions.cs │ │ ├── PackageIdentityExtensions.cs │ │ ├── FolderNuGetProjectExtension.cs │ │ ├── IExtensibleProjectExtensions.cs │ │ ├── PackageSearchMetadataExtensions.cs │ │ ├── IConfigurationServiceExtensions.cs │ │ ├── IPackageLoaderServiceExtensions.cs │ │ ├── PackageCollectionExtensions.cs │ │ ├── PackageSourceExtensions.cs │ │ ├── TaskExtensions.cs │ │ ├── DownloadResourceResultExtensions.cs │ │ ├── UriExtensions.cs │ │ ├── StringExtensions.cs │ │ ├── HttpHandlerResourceV3Extensions.cs │ │ └── IFileServiceExtensions.cs │ ├── Cache │ │ └── Interfaces │ │ │ └── INuGetCacheManager.cs │ ├── FodyWeavers.xml │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.de.resx │ │ ├── Resources.es.resx │ │ ├── Resources.fr.resx │ │ ├── Resources.nl.resx │ │ └── Resources.ru.resx │ ├── Scopes │ │ └── AuthenticationScope.cs │ ├── ResultOrException.cs │ ├── Helpers │ │ └── LogHelper.cs │ ├── Watchers │ │ └── Base │ │ │ ├── PackageSourcesWatcherBase.cs │ │ │ ├── PackageManagerContextWatcherBase.cs │ │ │ └── PackageManagerWatcherBase.cs │ ├── Logging │ │ ├── Listeners │ │ │ ├── Base │ │ │ │ └── NuGetToCatelLogTranslator.cs │ │ │ └── PackageManagerLogListenerBase.cs │ │ └── Services │ │ │ └── NuGetLogListeningSevice.cs │ ├── Pagination │ │ └── DeferToken.cs │ └── MultilingualResources │ │ ├── Orc.NuGetExplorer.de.xlf │ │ ├── Orc.NuGetExplorer.es.xlf │ │ ├── Orc.NuGetExplorer.fr.xlf │ │ ├── Orc.NuGetExplorer.nl.xlf │ │ └── Orc.NuGetExplorer.ru.xlf ├── global.json ├── Directory.Build.nullable.props ├── Orc.NuGetExplorer.Xaml │ ├── Resources │ │ └── Images │ │ │ └── default-package-icon.png │ ├── Services │ │ ├── Interfaces │ │ │ ├── INuGetConfigurationResetService.cs │ │ │ ├── IPackageDetailsService.cs │ │ │ ├── IPackageMetadataMediaDownloadService.cs │ │ │ ├── IImageResolveService.cs │ │ │ ├── IPackagesUIService.cs │ │ │ └── IPackageCommandService.cs │ │ └── XamlPleaseWaitInterruptService.cs │ ├── Explorer │ │ ├── Interfaces │ │ │ └── INuGetExplorerInitialState.cs │ │ ├── ExplorerTab.cs │ │ └── NuGetExplorerInitialState.cs │ ├── Windows │ │ ├── Interfaces │ │ │ └── IProgressManager.cs │ │ └── Service │ │ │ ├── Interfaces │ │ │ ├── ISynchronousUiVisualizer.cs │ │ │ └── IAnimationService.cs │ │ │ └── AnimationService.cs │ ├── Views │ │ ├── PageActionBar.xaml.cs │ │ ├── PageItemView.xaml.cs │ │ ├── ExtensiblesWindow.xaml.cs │ │ ├── ProjectsView.xaml.cs │ │ ├── FeedDetailView.xaml.cs │ │ ├── PackageDetailsView.xaml.cs │ │ ├── DependenciesView.xaml.cs │ │ ├── NuGetSettingsWindow.xaml │ │ ├── ProjectsView.xaml │ │ ├── NuGetSettingsWindow.xaml.cs │ │ └── ExtensiblesWindow.xaml │ ├── IManagerPage.cs │ ├── Models │ │ ├── ExplorerPage.cs │ │ └── PackagesBatch.cs │ ├── Messaging │ │ └── ActivatedExplorerTabMessage.cs │ ├── Converters │ │ ├── BoolToIntConverter.cs │ │ ├── PackageStatusEnumToBoolConverter.cs │ │ ├── NuGetVersionToStringConverter.cs │ │ ├── InvalidFeedToBoolConverter.cs │ │ ├── ExtendedUriToStringConverter.cs │ │ ├── NuGetFrameworkToStringConverter.cs │ │ ├── EmptyCollectionToVisibleConverter.cs │ │ ├── NuGetFrameworkToVisibilityConverter.cs │ │ ├── NullableBooleanTrueConverter.cs │ │ ├── RemoveTransparencyColorBrushConverter.cs │ │ ├── PackageStatusEnumToBrushConverter.cs │ │ └── UriToBitmapConverter.cs │ ├── FodyWeavers.xml │ ├── Extensions │ │ ├── InlineCollectionExtensions.cs │ │ ├── StringExtensions.cs │ │ ├── IValidationContextExtensions.cs │ │ ├── ObservableCollectionExtensions.cs │ │ └── InlineExtensions.cs │ ├── Behaviors │ │ ├── SelectFirstItemOnContextBehavior.cs │ │ ├── FocusOnVisibleBehavior.cs │ │ ├── UpdateSourceOnVisibleBehavior.cs │ │ ├── UpdateSelectedItemSourceBehavior.cs │ │ └── LoadItemsOnDropDownBehavior.cs │ ├── Mvvm │ │ └── BindingProxy.cs │ ├── ViewModels │ │ ├── DependenciesViewModel.cs │ │ └── FeedDetailViewModel.cs │ ├── Helpers │ │ └── AccentColorHelper.cs │ ├── Providers │ │ └── NuGetProjectContextProvider.cs │ ├── Themes │ │ ├── Animations.xaml │ │ └── CompiledResources.xaml │ ├── CheckableUnit.cs │ ├── Controls │ │ ├── Helpers │ │ │ └── WpfHelper.cs │ │ └── Templating │ │ │ └── BadgeContentTemplateSelector.cs │ ├── Web │ │ └── IconDownloader.cs │ └── Synchronization │ │ └── SynchronizationContextScopeManager.cs ├── Orc.NuGetExplorer.Tests │ ├── Services │ │ ├── PackageInstallationServiceFacts.cs │ │ ├── ApiPackageRegistryFacts.The_Validate_Method.Returns_Error_When_Current_Version_Is_Smaller_Than_Minimum_Required_Version_Async.verified.txt │ │ ├── PackageInstallationServiceFacts.InstallAsync.cs │ │ ├── UpdatePackagesLoaderServiceFacts.cs │ │ └── CredentialsKeyHelperFacts.cs │ ├── Management │ │ └── NuGetProjectPackageManagerFacts.cs │ ├── Providers │ │ └── PackageMetadataProviderFacts.GetHighestPackageMetadataAsync.cs │ ├── Validation │ │ └── PackageTargetFrameworkValidatorFacts.The_Validate_Method.Returns_Error_When_TargetFramework_Is_Too_High_Async.verified.txt │ ├── FodyWeavers.xml │ ├── ModuleInitializer.cs │ ├── TestFixtureBase.cs │ ├── NuGet │ │ └── FrameworkParserFacts.The_ToSpecificPlatform_Method.Returns_Correct_Minimum_Version_For_Windows.verified.txt │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Helpers │ │ └── EncryptionHelperFacts.cs │ ├── Extensions │ │ └── UriExtensionsFacts.cs │ └── PublicApiFacts.cs ├── Orc.NuGetExplorer.Example │ ├── Services │ │ ├── Interfaces │ │ │ └── IEchoService.cs │ │ ├── ExampleNuGetConfigurationResetService.cs │ │ └── EchoService.cs │ ├── FodyWeavers.xml │ ├── ModuleInitializer.cs │ ├── Models │ │ └── PackageManagementEcho.cs │ ├── Themes │ │ └── Generic.xaml │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Providers │ │ ├── DefaultPackageSourcesProvider.cs │ │ └── NuGetProjectProvider.cs │ ├── App.xaml │ ├── PackageManagement │ │ └── ExampleUpgradeListener.cs │ └── Views │ │ └── MainWindow.xaml.cs ├── Directory.Build.implicitusings.props ├── GlobalSuppressions.cs ├── Directory.Build.project.props ├── SolutionAssemblyInfo.cs ├── Directory.Build.shared.mat.props ├── GlobalSuppressions.global.cs ├── nuget.config ├── MethodTimeLogger.cs └── Directory.Build.shared.tests.props ├── design └── Package │ └── Icon.png ├── GitVersion.yml ├── cake.config ├── deployment └── cake │ ├── codesigning-tasks.cake │ ├── templates-variables.cake │ ├── issuetrackers.cake │ └── codesigning-variables.cake ├── .config └── dotnet-tools.json ├── .github ├── ISSUE_TEMPLATE │ ├── --thank-you.md │ ├── ---support-request.md │ ├── --bug.md │ └── --feature-request.md ├── FUNDING.yml ├── dependabot.yml ├── stale.yml ├── support.yml ├── workflows │ └── build-and-test.yml ├── PULL_REQUEST_TEMPLATE.md └── lock.yml ├── GitReleaseManager.yaml ├── AUTHORS ├── CONTRIBUTORS └── README.md /src/Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /design/Package/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WildGums/Orc.NuGetExplorer/HEAD/design/Package/Icon.png -------------------------------------------------------------------------------- /GitVersion.yml: -------------------------------------------------------------------------------- 1 | mode: ContinuousDeployment 2 | assembly-versioning-scheme: MajorMinorPatch 3 | next-version: 5.0.0 -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Interface/ICloneable.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public interface ICloneable 4 | { 5 | T Clone(); 6 | } -------------------------------------------------------------------------------- /src/global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "10.0.0", 4 | "rollForward": "latestMinor", 5 | "allowPrerelease": false 6 | } 7 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Enums/MetadataOrigin.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Enums; 2 | 3 | public enum MetadataOrigin 4 | { 5 | Browse, 6 | Installed, 7 | Updates 8 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Messaging/Base/NuGetExplorerServiceMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Messaging; 2 | 3 | public interface INuGetExplorerServiceMessage 4 | { 5 | 6 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/Interfaces/IPackageManager.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public interface IPackageManager //: IPackageOperationNotificationService 4 | { 5 | } -------------------------------------------------------------------------------- /src/Directory.Build.nullable.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | enable 4 | 5 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Resources/Images/default-package-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WildGums/Orc.NuGetExplorer/HEAD/src/Orc.NuGetExplorer.Xaml/Resources/Images/default-package-icon.png -------------------------------------------------------------------------------- /cake.config: -------------------------------------------------------------------------------- 1 | ; The configuration file for Cake. 2 | 3 | [Settings] 4 | SkipVerification=true 5 | 6 | [Settings] 7 | EnableScriptCache=true 8 | 9 | [Paths] 10 | Cache=%temp%/cake-build/cache/ -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/Services/PackageInstallationServiceFacts.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Tests.Services 2 | { 3 | public partial class PackageInstallationServiceFacts 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Example/Services/Interfaces/IEchoService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Example; 2 | 3 | public interface IEchoService 4 | { 5 | PackageManagementEcho GetPackageManagementEcho(); 6 | } 7 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/Management/NuGetProjectPackageManagerFacts.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Tests.Management 2 | { 3 | public partial class NuGetProjectPackageManagerFacts 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /deployment/cake/codesigning-tasks.cake: -------------------------------------------------------------------------------- 1 | #l "codesigning-variables.cake" 2 | 3 | using System.Xml.Linq; 4 | 5 | //------------------------------------------------------------- 6 | 7 | // Empty by design for now 8 | -------------------------------------------------------------------------------- /src/Directory.Build.implicitusings.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | enable 4 | 5 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Scenario/Interfaces/IUpgradeScenario.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Scenario; 2 | 3 | using System.Threading.Tasks; 4 | 5 | public interface IUpgradeScenario 6 | { 7 | Task RunAsync(); 8 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/Providers/PackageMetadataProviderFacts.GetHighestPackageMetadataAsync.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Tests 2 | { 3 | public partial class PackageMetadataProviderFacts 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Enums/PackageOperationType.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public enum PackageOperationType 4 | { 5 | None = 0, // default value 6 | Install, 7 | Uninstall, 8 | Update 9 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IPleaseWaitInterruptService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | public interface IPleaseWaitInterruptService 6 | { 7 | IDisposable InterruptTemporarily(); 8 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Web/Interfaces/IHttpExceptionHandler.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Web; 2 | 3 | public interface IHttpExceptionHandler 4 | { 5 | FeedVerificationResult HandleException(T exception, string source); 6 | } -------------------------------------------------------------------------------- /.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "cake.tool": { 6 | "version": "6.0.0", 7 | "commands": [ 8 | "dotnet-cake" 9 | ] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Enums/PackageStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Enums; 2 | 3 | public enum PackageStatus 4 | { 5 | NotInstalled = -2, 6 | UpdateAvailable = -1, 7 | LastVersionInstalled = 0, 8 | Pending = 1 9 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/Interfaces/IDefaultExtensibleProjectProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management; 2 | 3 | public interface IDefaultExtensibleProjectProvider 4 | { 5 | IExtensibleProject GetDefaultProject(); 6 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Windows/Enums/DownlevelTextMode.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Windows; 2 | 3 | internal enum DownlevelTextMode 4 | { 5 | MainInstructionAndContent = 0, 6 | MainInstructionOnly = 1, 7 | ContentOnly = 2, 8 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Services/Interfaces/INuGetConfigurationResetService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Threading.Tasks; 4 | 5 | public interface INuGetConfigurationResetService 6 | { 7 | Task ResetAsync(); 8 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Enums/CredentialStoragePolicy.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public enum CredentialStoragePolicy 4 | { 5 | None = 0, 6 | WindowsVault, 7 | WindowsVaultConfigurationFallback, 8 | Configuration 9 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Providers/Interfaces/IApplicationCacheProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Providers; 2 | 3 | using NuGetExplorer.Cache; 4 | 5 | public interface IApplicationCacheProvider 6 | { 7 | IconCache EnsureIconCache(); 8 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/NuGetProjectMetadata.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management; 2 | 3 | using System.Collections.Generic; 4 | 5 | internal class NuGetProjectMetadata 6 | { 7 | public Dictionary Data = new(); 8 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IFileSystemService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public interface IFileSystemService 4 | { 5 | void CreateDeleteme(string name, string path); 6 | void RemoveDeleteme(string name, string path); 7 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Factories/Interfaces/IPackageSourceFactory.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public interface IPackageSourceFactory 4 | { 5 | IPackageSource CreatePackageSource(string source, string name, bool isEnabled, bool isOfficial); 6 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/NuGet/Interfaces/IPackageSource.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public interface IPackageSource 4 | { 5 | bool IsEnabled { get; } 6 | bool IsOfficial { get; } 7 | string Name { get; } 8 | string Source { get; } 9 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Enums/FeedVerificationResult.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public enum FeedVerificationResult 4 | { 5 | Unknown, 6 | Valid, 7 | AuthenticationRequired, 8 | AuthorizationRequired, 9 | Invalid 10 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Explorer/Interfaces/INuGetExplorerInitialState.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public interface INuGetExplorerInitialState 4 | { 5 | ExplorerTab Tab { get; } 6 | 7 | PackageSearchParameters? InitialSearchParameters { get; } 8 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Services/Interfaces/IPackageDetailsService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Windows.Documents; 4 | 5 | internal interface IPackageDetailsService 6 | { 7 | FlowDocument PackageToFlowDocument(IPackageDetails package); 8 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Windows/Interfaces/IProgressManager.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Windows; 2 | 3 | using Catel.MVVM; 4 | 5 | public interface IProgressManager 6 | { 7 | void ShowBar(IViewModel vm); 8 | 9 | void HideBar(IViewModel vm); 10 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Models/Interfaces/INuGetSettings.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Collections.Generic; 4 | using NuGet.Configuration; 5 | 6 | public interface INuGetSettings 7 | { 8 | IReadOnlyList GetAllPackageSources(); 9 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/--thank-you.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "❤️Thank You" 3 | about: Just want to say thank you, this is the one to do it in 4 | title: Thank You 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Leave Your Message Below (don't delete this line though) -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Models/Interfaces/IObservablePackage.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | internal interface IObservablePackage 6 | { 7 | event EventHandler StatusChanged; 8 | bool IsDelisted { get; } 9 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Configuration/Enums/ConfigurationSection.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Configuration; 2 | 3 | // Note: do not use plural name if this is not a collection property 4 | public enum ConfigurationSection 5 | { 6 | Feeds = 0, 7 | ProjectExtensions = 1 8 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IBackupFileSystemService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public interface IBackupFileSystemService 4 | { 5 | void BackupFolder(string fullPath); 6 | void BackupFile(string filePath); 7 | void Restore(string fullPath); 8 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Win32/User32.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Win32; 2 | 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | internal static class User32 7 | { 8 | [DllImport("user32.dll")] 9 | internal static extern IntPtr GetActiveWindow(); 10 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Models/Interfaces/IRepository.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public interface IRepository 4 | { 5 | string Name { get; } 6 | string Source { get; } 7 | PackageOperationType OperationType { get; } 8 | 9 | bool IsLocal { get; } 10 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Views/PageActionBar.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Views; 2 | 3 | using Catel.Windows.Controls; 4 | 5 | internal partial class PageActionBar : UserControl 6 | { 7 | public PageActionBar() 8 | { 9 | InitializeComponent(); 10 | } 11 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Providers/Interfaces/INuGetProjectContextProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using NuGet.ProjectManagement; 4 | 5 | public interface INuGetProjectContextProvider 6 | { 7 | INuGetProjectContext? GetProjectContext(FileConflictAction fileConflictAction); 8 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/Validation/PackageTargetFrameworkValidatorFacts.The_Validate_Method.Returns_Error_When_TargetFramework_Is_Too_High_Async.verified.txt: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | ValidationResultType: Error, 4 | Message: Package is not compatible with the current target framework (net8.0) 5 | } 6 | ] -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/Exceptions/ProjectStateException.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management; 2 | 3 | using System; 4 | 5 | public class ProjectStateException : Exception 6 | { 7 | public ProjectStateException(string message) 8 | : base(message) 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Validation/Providers/Interfaces/IPackageValidatorProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer 2 | { 3 | using System.Collections.Generic; 4 | 5 | public interface IPackageValidatorProvider 6 | { 7 | IReadOnlyList GetValidators(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Providers/Interfaces/IModelProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Providers; 2 | 3 | using System.ComponentModel; 4 | using Catel.Data; 5 | 6 | public interface IModelProvider : INotifyPropertyChanged where T : ModelBase 7 | { 8 | T? Model { get; set; } 9 | 10 | T Create(); 11 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IApiPackageRegistry.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public interface IApiPackageRegistry 4 | { 5 | void Register(string packageName, string version); 6 | 7 | bool IsRegistered(string packageName); 8 | 9 | void Validate(IPackageDetails package); 10 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/ITemporaryFIleSystemContextService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | internal interface ITemporaryFIleSystemContextService 6 | { 7 | ITemporaryFileSystemContext? Context { get; } 8 | 9 | IDisposable UseTemporaryFIleSystemContext(); 10 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Models/Interfaces/INuGetSource.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public interface INuGetSource : IPackageSource 4 | { 5 | bool IsAccessible { get; } 6 | 7 | bool IsVerified { get; } 8 | 9 | bool IsSelected { get; set; } 10 | 11 | PackageSourceWrapper GetPackageSource(); 12 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/NuGet/Interfaces/IDefaultNuGetFramework.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Collections.Generic; 4 | using NuGet.Frameworks; 5 | 6 | public interface IDefaultNuGetFramework 7 | { 8 | IEnumerable GetHighest(); 9 | IEnumerable GetLowest(); 10 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Providers/Interfaces/IDefaultPackageSourcesProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Collections.Generic; 4 | 5 | public interface IDefaultPackageSourcesProvider 6 | { 7 | string DefaultSource { get; set; } 8 | 9 | IEnumerable GetDefaultPackages(); 10 | } -------------------------------------------------------------------------------- /src/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | // This file is used by Code Analysis to maintain SuppressMessage 4 | // attributes that are applied to this project. 5 | // Project-level suppressions either have no target or are given 6 | // a specific target and scoped to a namespace, type, member, etc. 7 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Example/Services/ExampleNuGetConfigurationResetService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Example; 2 | 3 | using System.Threading.Tasks; 4 | 5 | public class ExampleNuGetConfigurationResetService : INuGetConfigurationResetService 6 | { 7 | public async Task ResetAsync() 8 | { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IDefferedPackageLoaderService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Services; 2 | 3 | using System.Threading.Tasks; 4 | using NuGetExplorer.Pagination; 5 | 6 | public interface IDefferedPackageLoaderService 7 | { 8 | void Add(DeferToken token); 9 | 10 | Task StartLoadingAsync(); 11 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Validation/Interfaces/IPackageValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer 2 | { 3 | using Catel.Data; 4 | using NuGet.Protocol.Core.Types; 5 | 6 | public interface IPackageValidator 7 | { 8 | IValidationContext Validate(IPackageSearchMetadata packageSearchMetadata); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Services/Interfaces/IPackageMetadataMediaDownloadService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Threading.Tasks; 4 | using NuGet.Protocol.Core.Types; 5 | 6 | public interface IPackageMetadataMediaDownloadService 7 | { 8 | Task DownloadMediaForMetadataAsync(IPackageSearchMetadata packageMetadata); 9 | } -------------------------------------------------------------------------------- /GitReleaseManager.yaml: -------------------------------------------------------------------------------- 1 | issue-labels-include: 2 | - Breaking change 3 | - Feature 4 | - Bug 5 | - Improvement 6 | - Documentation 7 | - Dependencies 8 | issue-labels-exclude: 9 | - Build 10 | - Won't fix 11 | issue-labels-alias: 12 | - name: Documentation 13 | header: Documentation 14 | plural: Documentation -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Context/Interfaces/ITemporaryFileSystemContext.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | public interface ITemporaryFileSystemContext : IDisposable 6 | { 7 | string RootDirectory { get; } 8 | 9 | string GetDirectory(string relativeDirectoryName); 10 | string GetFile(string relativeFilePath); 11 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Services/Interfaces/IImageResolveService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Threading.Tasks; 5 | using System.Windows.Media; 6 | 7 | public interface IImageResolveService 8 | { 9 | ImageSource ResolveImageFromUri(Uri uri); 10 | Task ResolveImageFromUriAsync(Uri uri); 11 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Windows/Service/Interfaces/ISynchronousUiVisualizer.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Windows; 2 | 3 | using System; 4 | using Catel.MVVM; 5 | using Catel.Services; 6 | 7 | internal interface ISynchronousUiVisualizer 8 | { 9 | bool? ShowDialog(IViewModel viewModel, EventHandler? completedProc = null); 10 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Views/PageItemView.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Views; 2 | 3 | using Catel.Windows.Controls; 4 | 5 | /// 6 | /// Interaction logic for PageItemView.xaml 7 | /// 8 | internal partial class PageItemView : UserControl 9 | { 10 | public PageItemView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Example/Services/EchoService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Example; 2 | 3 | public class EchoService : IEchoService 4 | { 5 | private PackageManagementEcho _echo; 6 | 7 | public PackageManagementEcho GetPackageManagementEcho() 8 | { 9 | _echo ??= new PackageManagementEcho(); 10 | 11 | return _echo; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/INuGetExplorerInitializationService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Services; 2 | 3 | using System.Threading.Tasks; 4 | 5 | public interface INuGetExplorerInitializationService 6 | { 7 | string DefaultSourceKey { get; } 8 | 9 | int PackageQuerySize { get; set; } 10 | 11 | Task UpgradeNuGetPackagesIfNeededAsync(); 12 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/Services/ApiPackageRegistryFacts.The_Validate_Method.Returns_Error_When_Current_Version_Is_Smaller_Than_Minimum_Required_Version_Async.verified.txt: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | ValidationResultType: Error, 4 | Message: Package 'MyPackage' depends on API 'MyApp.Api' min version '3.0.0-alpha.9999' but the installed version is '2.0.0-alpha.9999', 5 | Tag: API 6 | } 7 | ] -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/IManagerPage.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Orc.NuGetExplorer; 3 | 4 | using Catel.Collections; 5 | 6 | internal interface IManagerPage 7 | { 8 | FastObservableCollection PackageItems { get; } 9 | 10 | bool CanBatchUpdateOperations { get; } 11 | 12 | bool CanBatchInstallOperations { get; } 13 | 14 | void StartLoadingTimerOrInvalidateData(); 15 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Windows/Service/Interfaces/IAnimationService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Windows; 2 | 3 | using System.Windows; 4 | using System.Windows.Media.Animation; 5 | 6 | internal interface IAnimationService 7 | { 8 | Storyboard GetFadeInAnimation(DependencyObject dependencyObject); 9 | 10 | Storyboard GetFadeOutAnimation(DependencyObject dependencyObject); 11 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Providers/EmptyProjectContextProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Providers; 2 | 3 | using NuGet.ProjectManagement; 4 | 5 | public class EmptyProjectContextProvider : INuGetProjectContextProvider 6 | { 7 | public INuGetProjectContext? GetProjectContext(FileConflictAction fileConflictAction) 8 | { 9 | //no project context 10 | return null; 11 | } 12 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Providers/ExplorerCacheProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Providers; 2 | 3 | using NuGetExplorer.Cache; 4 | 5 | public class ExplorerCacheProvider : IApplicationCacheProvider 6 | { 7 | private IconCache? _iconCache; 8 | 9 | public IconCache EnsureIconCache() 10 | { 11 | _iconCache ??= new IconCache(); 12 | 13 | return _iconCache; 14 | } 15 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Models/ExplorerPage.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using Catel.Data; 4 | 5 | internal class ExplorerPage : ModelBase 6 | { 7 | public ExplorerPage(INuGetExplorerInitialState parameters) 8 | { 9 | Parameters = parameters; 10 | } 11 | 12 | public bool IsActive { get; set; } 13 | 14 | public INuGetExplorerInitialState Parameters { get; set; } 15 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IRollbackPackageOperationService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | public interface IRollbackPackageOperationService 6 | { 7 | void PushRollbackAction(Action rollbackAction, IPackageOperationContext? context); 8 | void Rollback(IPackageOperationContext context); 9 | void ClearRollbackActions(IPackageOperationContext context); 10 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Providers/Interfaces/IExtendedSourceRepositoryProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using NuGet.Configuration; 4 | using NuGet.Protocol.Core.Types; 5 | 6 | public interface IExtendedSourceRepositoryProvider : ISourceRepositoryProvider 7 | { 8 | SourceRepository CreateLocalRepository(string source); 9 | 10 | SourceRepository CreateRepository(PackageSource source, bool forceUpdate); 11 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/EventArgs/NuGetLogRecordEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using Catel; 5 | 6 | public class NuGetLogRecordEventArgs : EventArgs 7 | { 8 | public NuGetLogRecordEventArgs(string message) 9 | { 10 | Argument.IsNotNullOrEmpty(() => message); 11 | 12 | Message = message; 13 | } 14 | 15 | public string Message { get; private set; } 16 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Views/ExtensiblesWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Views; 2 | 3 | using Catel.Windows; 4 | 5 | /// 6 | /// Interaction logic for ExtensiblesWindow.xaml 7 | /// 8 | internal partial class ExtensiblesWindow : DataWindow 9 | { 10 | public ExtensiblesWindow() 11 | : base(Catel.Windows.DataWindowMode.Close) 12 | { 13 | InitializeComponent(); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Context/Interfaces/IPackageOperationContext.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | public interface IPackageOperationContext 7 | { 8 | ITemporaryFileSystemContext FileSystemContext { get; set; } 9 | IList? Exceptions { get; } 10 | IPackageOperationContext? Parent { get; set; } 11 | IRepository? Repository { get; set; } 12 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Providers/Interfaces/INuGetProjectConfigurationProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using NuGet.Frameworks; 4 | using NuGet.ProjectManagement; 5 | 6 | public interface INuGetProjectConfigurationProvider 7 | { 8 | NuGetProject GetPackagesConfig(string packagesConfigPath, NuGetFramework targetFramework, string projectName); 9 | NuGetProject GetProjectConfig(IExtensibleProject project); 10 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/ICredentialProviderLoaderService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | using NuGet.Credentials; 6 | 7 | public interface ICredentialProviderLoaderService 8 | { 9 | Task> GetCredentialProvidersAsync(); 10 | void SetCredentialPolicy(CredentialStoragePolicy storagePolicy); 11 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Messaging/ActivatedExplorerTabMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Messaging; 2 | 3 | using Catel.Messaging; 4 | 5 | public class ActivatedExplorerTabMessage : MessageBase 6 | { 7 | public ActivatedExplorerTabMessage() 8 | { 9 | } 10 | 11 | public ActivatedExplorerTabMessage(ExplorerTab data) 12 | : base(data) 13 | { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/IRepositoryExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using NuGet.Configuration; 5 | 6 | public static class IRepositoryExtensions 7 | { 8 | public static PackageSource ToPackageSource(this IRepository repository) 9 | { 10 | ArgumentNullException.ThrowIfNull(repository); 11 | 12 | return new PackageSource(repository.Source, repository.Name); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/Exceptions/ProjectManageException.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management; 2 | 3 | using System; 4 | 5 | public class ProjectManageException : Exception 6 | { 7 | public ProjectManageException(string message) : base(message) 8 | { 9 | } 10 | 11 | public ProjectManageException(string message, Exception innerException) 12 | : base(message, innerException) 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS file. 3 | # See the latter for an explanation. 4 | 5 | # Names should be added to this file as 6 | # Name or Organization 7 | # The email address is not required for organizations. 8 | 9 | # Please keep the list sorted. 10 | # Please notify the first person on the list to be added here. 11 | 12 | WildGums 13 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IRepositoryService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Collections.Generic; 4 | 5 | public interface IRepositoryService 6 | { 7 | IRepository LocalRepository { get; } 8 | 9 | IEnumerable GetRepositories(PackageOperationType packageOperationType); 10 | IEnumerable GetSourceRepositories(); 11 | IEnumerable GetUpdateRepositories(); 12 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Cache/Interfaces/INuGetCacheManager.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Cache; 2 | 3 | using NuGet.Protocol.Core.Types; 4 | public interface INuGetCacheManager 5 | { 6 | bool ClearAll(); 7 | bool ClearHttpCache(); 8 | SourceCacheContext GetCacheContext(); 9 | 10 | HttpSourceCacheContext GetHttpCacheContext(); 11 | 12 | HttpSourceCacheContext GetHttpCacheContext(int retryCount, bool directDownload = false); 13 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IPackageOperationContextService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | public interface IPackageOperationContextService 6 | { 7 | IPackageOperationContext? CurrentContext { get; } 8 | 9 | event EventHandler? OperationContextDisposing; 10 | IDisposable UseOperationContext(PackageOperationType operationType, params IPackageDetails[] packages); 11 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Catel.* 7 | Orc.* 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Converters/BoolToIntConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Converters; 2 | 3 | using System; 4 | using Catel.MVVM.Converters; 5 | 6 | [System.Windows.Data.ValueConversion(typeof(bool), typeof(int))] 7 | public class BoolToIntConverter : ValueConverterBase 8 | { 9 | protected override object Convert(bool value, Type targetType, object? parameter) 10 | { 11 | return value ? 1 : 0; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Services/Interfaces/IPackagesUIService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Threading.Tasks; 4 | using Catel.Services; 5 | 6 | public interface IPackagesUIService 7 | { 8 | string SettingsTitle { get; set; } 9 | 10 | Task ShowPackagesExplorerAsync(); 11 | Task ShowPackagesExplorerAsync(INuGetExplorerInitialState initialState); 12 | Task ShowPackagesSourceSettingsAsync(); 13 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/EventArgs/OperationContextEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | public class OperationContextEventArgs : EventArgs 6 | { 7 | public OperationContextEventArgs(IPackageOperationContext packageOperationContext) 8 | { 9 | PackageOperationContext = packageOperationContext; 10 | } 11 | 12 | public IPackageOperationContext PackageOperationContext { get; private set; } 13 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/ModuleInitializer.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | /// 3 | /// Used by the ModuleInit. All code inside the Initialize method is ran as soon as the assembly is loaded. 4 | /// 5 | public static class ModuleInitializer 6 | { 7 | /// 8 | /// Initializes the module. 9 | /// 10 | [ModuleInitializer] 11 | public static void Initialize() 12 | { 13 | 14 | } 15 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IRepositoryContextService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using NuGet.Configuration; 4 | using NuGet.Protocol.Core.Types; 5 | using NuGetExplorer.Management; 6 | 7 | public interface IRepositoryContextService 8 | { 9 | SourceRepository? GetRepository(PackageSource source); 10 | SourceContext AcquireContext(PackageSource source); 11 | SourceContext AcquireContext(bool ignoreLocal = false); 12 | 13 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Example/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Catel.* 6 | Orc.* 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/Exceptions/MissingPackageException.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management.Exceptions; 2 | 3 | using System; 4 | 5 | public class MissingPackageException : ProjectInstallException 6 | { 7 | public MissingPackageException(string message) : base(message) 8 | { 9 | } 10 | 11 | public MissingPackageException(string message, Exception innerException) 12 | : base(message, innerException) 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Example/ModuleInitializer.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | /// 3 | /// Used by the ModuleInit. All code inside the Initialize method is ran as soon as the assembly is loaded. 4 | /// 5 | public static class ModuleInitializer 6 | { 7 | /// 8 | /// Initializes the module. 9 | /// 10 | [ModuleInitializer] 11 | public static void Initialize() 12 | { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Catel.* 9 | Orc.* 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Catel.* 9 | Orc.* 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Models/PackagesBatch.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Collections.ObjectModel; 4 | using Catel.Collections; 5 | 6 | public class PackagesBatch 7 | { 8 | public PackagesBatch() 9 | { 10 | PackageList = new FastObservableCollection(); 11 | } 12 | 13 | public ObservableCollection PackageList { get; set; } 14 | public PackageOperationType OperationType { get; set; } 15 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Configuration/Interfaces/IVersionedSettings.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Configuration; 2 | 3 | using System; 4 | using NuGet.Configuration; 5 | 6 | public interface IVersionedSettings : ISettings 7 | { 8 | bool IsLastVersion { get; } 9 | 10 | Version? Version { get; } 11 | 12 | Version? MinimalVersion { get; } 13 | 14 | event EventHandler SettingsRead; 15 | 16 | void UpdateMinimalVersion(); 17 | void UpdateVersion(); 18 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/INuGetFeedVerificationService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | public interface INuGetFeedVerificationService 7 | { 8 | Task VerifyFeedAsync(string source, bool authenticateIfRequired = true, CancellationToken cancellationToken = default); 9 | FeedVerificationResult VerifyFeed(string source, bool authenticateIfRequired = true); 10 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/INuGetProjectUpgradeService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Services; 2 | 3 | using System; 4 | using System.Threading.Tasks; 5 | using Orc.NuGetExplorer.Scenario; 6 | 7 | public interface INuGetProjectUpgradeService 8 | { 9 | event EventHandler? UpgradeStart; 10 | event EventHandler? UpgradeEnd; 11 | 12 | void AddUpgradeScenario(IUpgradeScenario scenario); 13 | Task CheckCurrentConfigurationAndRunAsync(); 14 | } -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: WildGums-oss # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | custom: # Replace with a single custom sponsorship URL -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IDownloadingProgressTrackerService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Services; 2 | 3 | using System; 4 | using System.Threading.Tasks; 5 | using Catel; 6 | using NuGet.Protocol.Core.Types; 7 | 8 | public interface IDownloadingProgressTrackerService 9 | { 10 | Task>> TrackDownloadOperationAsync(IPackageInstallationService packageInstallationService, SourcePackageDependencyInfo packageDependencyInfo); 11 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/Exceptions/IncompatiblePackageException.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management.Exceptions; 2 | 3 | using System; 4 | 5 | public class IncompatiblePackageException : ProjectInstallException 6 | { 7 | public IncompatiblePackageException(string message, Exception innerException) 8 | : base(message, innerException) 9 | { 10 | } 11 | 12 | public IncompatiblePackageException(string message) : base(message) 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Example/Models/PackageManagementEcho.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Example; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Collections.ObjectModel; 6 | using Catel.Data; 7 | 8 | [Serializable] 9 | public class PackageManagementEcho : ModelBase 10 | { 11 | public PackageManagementEcho() 12 | { 13 | Lines = new ObservableCollection(); 14 | } 15 | 16 | public IList Lines { get; private set; } 17 | } 18 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/EventArgs/NuGetProjectEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management; 2 | 3 | using NuGet.Packaging.Core; 4 | 5 | public class NuGetProjectEventArgs : System.EventArgs 6 | { 7 | public NuGetProjectEventArgs(IExtensibleProject project, PackageIdentity package) 8 | { 9 | Project = project; 10 | Package = package; 11 | } 12 | 13 | public IExtensibleProject Project { get; } 14 | 15 | public PackageIdentity Package { get; } 16 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/NuGet/Resolver/Extensions/PackageResolverExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Resolver; 2 | 3 | using System.Collections.Generic; 4 | using System.Threading; 5 | using NuGet.Packaging.Core; 6 | 7 | public static class PackageResolverExtensions 8 | { 9 | public static IEnumerable Resolve(this PackageResolver resolver, PackageResolverContext context, CancellationToken token) 10 | { 11 | return resolver.Resolve(context, token); 12 | } 13 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Messaging/PackagingDeletemeMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Messaging; 2 | 3 | using Catel.Messaging; 4 | using Packaging; 5 | 6 | public class PackagingDeletemeMessage : MessageBase, INuGetExplorerServiceMessage 7 | { 8 | public PackagingDeletemeMessage() 9 | { 10 | 11 | } 12 | 13 | public PackagingDeletemeMessage(PackageOperationInfo content) 14 | : base(content) 15 | { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Models/EventArgs/PackageModelStatusEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using Enums; 5 | 6 | public class PackageModelStatusEventArgs : EventArgs 7 | { 8 | public PackageModelStatusEventArgs(PackageStatus oldStatus, PackageStatus newStatus) 9 | { 10 | OldStatus = oldStatus; 11 | NewStatus = newStatus; 12 | } 13 | 14 | public PackageStatus OldStatus { get; } 15 | 16 | public PackageStatus NewStatus { get; } 17 | } 18 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | 5 | // All other assembly info is defined in SolutionAssemblyInfo.cs 6 | 7 | [assembly: AssemblyTitle("Orc.NuGetExplorer")] 8 | [assembly: AssemblyProduct("Orc.NuGetExplorer")] 9 | [assembly: AssemblyDescription("Orc.NuGetExplorer library")] 10 | [assembly: NeutralResourcesLanguage("en-US")] 11 | 12 | [assembly: InternalsVisibleTo("Orc.NuGetExplorer.Tests")] -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Example/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Exceptions/InvalidPathException.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | public class InvalidPathException : Exception 6 | { 7 | public InvalidPathException() 8 | { 9 | } 10 | 11 | public InvalidPathException(string? message) 12 | : base(message) 13 | { 14 | } 15 | 16 | public InvalidPathException(string? message, Exception? innerException) 17 | : base(message, innerException) 18 | { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Directory.Build.project.props: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | wildgums 8 | https://github.com/WildGums/Orc.NuGetExplorer 9 | MIT 10 | https://github.com/WildGums/Orc.NuGetExplorer 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Explorer/ExplorerTab.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public class ExplorerTab 4 | { 5 | public readonly static ExplorerTab Browse = new(ExplorerPageName.Browse); 6 | 7 | public readonly static ExplorerTab Update = new(ExplorerPageName.Updates); 8 | 9 | public readonly static ExplorerTab Installed = new(ExplorerPageName.Installed); 10 | 11 | private ExplorerTab(string name) 12 | { 13 | Name = name; 14 | } 15 | 16 | public string Name { get; } 17 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Exceptions/ApiValidationException.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | [Serializable] 6 | public class ApiValidationException : Exception 7 | { 8 | public ApiValidationException() 9 | { 10 | } 11 | 12 | public ApiValidationException(string message) 13 | : base(message) 14 | { 15 | } 16 | 17 | public ApiValidationException(string message, Exception innerException) 18 | : base(message, innerException) 19 | { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/TestFixtureBase.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Tests; 2 | 3 | using NuGet.Protocol.Core.Types; 4 | 5 | public abstract class TestFixtureBase 6 | { 7 | public static IPackageSearchMetadata CreatePackageSearchMetadata(string id, string version) 8 | { 9 | var builder = PackageSearchMetadataBuilder.FromIdentity(new NuGet.Packaging.Core.PackageIdentity(id, new NuGet.Versioning.NuGetVersion(version))); 10 | var package = builder.Build(); 11 | 12 | return package; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Extensions/InlineCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Windows.Documents; 5 | 6 | public static class InlineCollectionExtensions 7 | { 8 | public static void AddIfNotNull(this InlineCollection inlineCollection, Inline inline) 9 | { 10 | ArgumentNullException.ThrowIfNull(inlineCollection); 11 | 12 | if (inline is null) 13 | { 14 | return; 15 | } 16 | 17 | inlineCollection.Add(inline); 18 | } 19 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/NuGetFrameworkExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using NuGet.Frameworks; 5 | 6 | public static class NuGetFrameworkExtensions 7 | { 8 | public static bool IsNet5Era(this NuGetFramework nuGetFramework) 9 | { 10 | ArgumentNullException.ThrowIfNull(nuGetFramework); 11 | 12 | return (nuGetFramework.Version.Major >= 5 && StringComparer.OrdinalIgnoreCase.Equals(FrameworkConstants.FrameworkIdentifiers.NetCoreApp, nuGetFramework.Framework)); 13 | } 14 | } -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This is the official list of people who have contributed 2 | # to this repository. 3 | # The AUTHORS file lists the copyright holders; this file 4 | # lists people. 5 | 6 | # People submitting code should be listed in this file (by email address). 7 | 8 | # Names should be added to this file like so: 9 | # Name 10 | 11 | # Please keep the list sorted. 12 | 13 | Geert van Horrik 14 | Maksim Khomutov 15 | Igr Alexánder Fernández Saúco -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Converters/PackageStatusEnumToBoolConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Converters; 2 | 3 | using System; 4 | using Catel.MVVM.Converters; 5 | using NuGetExplorer.Enums; 6 | 7 | [System.Windows.Data.ValueConversion(typeof(PackageStatus), typeof(bool))] 8 | public class PackageStatusEnumToBoolConverter : ValueConverterBase 9 | { 10 | protected override object Convert(PackageStatus value, Type targetType, object? parameter) 11 | { 12 | return Math.Abs((int)value) <= 1; 13 | } 14 | } -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | registries: 3 | nuget-feed-default: 4 | type: nuget-feed 5 | url: https://api.nuget.org/v3/index.json 6 | 7 | updates: 8 | - package-ecosystem: github-actions 9 | directory: "/" 10 | schedule: 11 | interval: weekly 12 | 13 | - package-ecosystem: nuget 14 | directories: 15 | - "/src" 16 | schedule: 17 | interval: daily 18 | open-pull-requests-limit: 10 19 | ignore: 20 | - dependency-name: "*Analyzers" 21 | versions: 22 | - ">= 0" 23 | registries: 24 | - nuget-feed-default -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Converters/NuGetVersionToStringConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Converters; 2 | 3 | using System; 4 | using Catel.MVVM.Converters; 5 | using NuGet.Versioning; 6 | 7 | [System.Windows.Data.ValueConversion(typeof(NuGetVersion), typeof(string))] 8 | public class NuGetVersionToStringConverter : ValueConverterBase 9 | { 10 | protected override object Convert(NuGetVersion? value, Type targetType, object? parameter) 11 | { 12 | return value?.ToString() ?? Constants.NotInstalled; 13 | } 14 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Views/ProjectsView.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Views; 2 | 3 | using Catel.Windows.Controls; 4 | using Orc.NuGetExplorer.ViewModels; 5 | 6 | /// 7 | /// Interaction logic for ProjectsView.xaml 8 | /// 9 | internal partial class ProjectsView : UserControl 10 | { 11 | public ProjectsView() 12 | { 13 | InitializeComponent(); 14 | } 15 | 16 | public ProjectsView(ProjectsViewModel viewModel) 17 | : base(viewModel) 18 | { 19 | InitializeComponent(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/PackageIdentityExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using NuGet.Packaging.Core; 5 | 6 | public static class PackageIdentityExtensions 7 | { 8 | public static string ToFullString(this PackageIdentity packageIdentity) 9 | { 10 | ArgumentNullException.ThrowIfNull(packageIdentity); 11 | 12 | return packageIdentity.HasVersion 13 | ? $"{packageIdentity} {packageIdentity.Version.ToFullString()}" 14 | : packageIdentity.ToString(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Views/FeedDetailView.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Views; 2 | 3 | using Catel.Windows.Controls; 4 | using NuGetExplorer.ViewModels; 5 | 6 | /// 7 | /// Interaction logic for FeedDetailView.xaml 8 | /// 9 | internal partial class FeedDetailView : UserControl 10 | { 11 | public FeedDetailView() 12 | { 13 | InitializeComponent(); 14 | } 15 | 16 | public FeedDetailView(FeedDetailViewModel viewModel) 17 | : base(viewModel) 18 | { 19 | InitializeComponent(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/FolderNuGetProjectExtension.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using NuGet.ProjectManagement; 7 | 8 | public static class FolderNuGetProjectExtension 9 | { 10 | public static IEnumerable GetPackageDirectories(this FolderNuGetProject project) 11 | { 12 | ArgumentNullException.ThrowIfNull(project); 13 | 14 | var packageDirs = Directory.GetDirectories(project.Root); 15 | 16 | return packageDirs; 17 | } 18 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Models/PackageInstallationContext.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using NuGet.Packaging.Core; 5 | 6 | public class PackageInstallationContext 7 | { 8 | public required PackageIdentity Package { get; set; } 9 | public required IExtensibleProject Project { get; set; } 10 | public Func? PackagePredicate { get; set; } 11 | public bool AllowMultipleVersions { get; set; } 12 | public bool IgnoreMissingPackages { get; set; } 13 | public bool ShowErrors { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/Services/PackageInstallationServiceFacts.InstallAsync.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Tests.Services 2 | { 3 | using System.Threading.Tasks; 4 | using NUnit.Framework; 5 | 6 | public partial class PackageInstallationServiceFacts 7 | { 8 | [TestFixture] 9 | public class The_InstallAsync_Method 10 | { 11 | [TestCase] 12 | public async Task Allows_Installation_When_Api_Registry_Returns_Dependency_Async() 13 | { 14 | 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Converters/InvalidFeedToBoolConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Converters; 2 | 3 | using System; 4 | using Catel.MVVM.Converters; 5 | using Orc.NuGetExplorer; 6 | 7 | [System.Windows.Data.ValueConversion(typeof(FeedVerificationResult), typeof(bool))] 8 | public class InvalidFeedToBoolConverter : ValueConverterBase 9 | { 10 | protected override object Convert(FeedVerificationResult value, Type targetType, object? parameter) 11 | { 12 | return value == FeedVerificationResult.Invalid; 13 | } 14 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/NuGet/Packaging/PackageOperationInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Packaging; 2 | 3 | public class PackageOperationInfo 4 | { 5 | public PackageOperationInfo(string operationPath, PackageOperationType operationType, IPackageDetails package) 6 | { 7 | OperationPath = operationPath; 8 | OperationType = operationType; 9 | Package = package; 10 | } 11 | 12 | public string OperationPath { get; } 13 | 14 | public PackageOperationType OperationType { get; } 15 | 16 | public IPackageDetails Package { get; } 17 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Providers/EmptyDefaultPackageSourcesProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | public class EmptyDefaultPackageSourcesProvider : IDefaultPackageSourcesProvider 7 | { 8 | public EmptyDefaultPackageSourcesProvider() 9 | { 10 | DefaultSource = string.Empty; 11 | } 12 | 13 | public string DefaultSource { get; set; } 14 | 15 | public IEnumerable GetDefaultPackages() 16 | { 17 | return Enumerable.Empty(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/INuGetLogListeningSevice.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | public interface INuGetLogListeningSevice 6 | { 7 | void SendInfo(string message); 8 | void SendWarning(string message); 9 | void SendDebug(string message); 10 | void SendError(string message); 11 | event EventHandler Info; 12 | event EventHandler Warning; 13 | event EventHandler Debug; 14 | event EventHandler Error; 15 | } -------------------------------------------------------------------------------- /src/SolutionAssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by Cake. 4 | // 5 | //------------------------------------------------------------------------------ 6 | using System.Reflection; 7 | 8 | [assembly: AssemblyCompany("WildGums")] 9 | [assembly: AssemblyVersion("5.4.0")] 10 | [assembly: AssemblyFileVersion("5.4.0")] 11 | [assembly: AssemblyInformationalVersion("5.4.0")] 12 | [assembly: AssemblyCopyright("Copyright © WildGums 2014 - 2024")] 13 | 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Orc.NuGetExplorer 2 | ================= 3 | 4 | Name|Badge 5 | ---|--- 6 | Downloads|![NuGet downloads](https://img.shields.io/nuget/dt/orc.nugetexplorer.svg) 7 | Stable version|![Version](https://img.shields.io/nuget/v/orc.nugetexplorer.svg) 8 | Unstable version|![Pre-release version](https://img.shields.io/nuget/vpre/orc.nugetexplorer.svg) 9 | 10 | This library provides everything you need to explore and download packages from the NuGet gallery as well as any private feed. 11 | 12 | For documentation, please visit the [documentation portal](http://opensource.wildgums.com) -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Converters/ExtendedUriToStringConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Converters; 2 | 3 | using System; 4 | using Catel.MVVM.Converters; 5 | 6 | [System.Windows.Data.ValueConversion(typeof(Uri), typeof(string))] 7 | public class ExtendedUriToStringConverter : ValueConverterBase 8 | { 9 | protected override object? Convert(Uri? value, Type targetType, object? parameter) 10 | { 11 | if (value is null) 12 | { 13 | return string.Empty; 14 | } 15 | 16 | return value.ToString(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Explorer/NuGetExplorerInitialState.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | public class NuGetExplorerInitialState : INuGetExplorerInitialState 6 | { 7 | public NuGetExplorerInitialState(ExplorerTab tab, PackageSearchParameters? packageSearchParameters = null) 8 | { 9 | ArgumentNullException.ThrowIfNull(tab); 10 | 11 | Tab = tab; 12 | InitialSearchParameters = packageSearchParameters; 13 | } 14 | 15 | public ExplorerTab Tab { get; } 16 | public PackageSearchParameters? InitialSearchParameters { get; } 17 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Scopes/AuthenticationScope.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Scopes; 2 | 3 | using Catel; 4 | 5 | public class AuthenticationScope : Disposable 6 | { 7 | private readonly bool _canPromptForAuthentication; 8 | 9 | public AuthenticationScope(bool? canPromptForAuthentication = null) 10 | { 11 | _canPromptForAuthentication = canPromptForAuthentication ?? true; 12 | } 13 | 14 | public bool CanPromptForAuthentication => !HasPromptedForAuthentication && _canPromptForAuthentication; 15 | 16 | public bool HasPromptedForAuthentication { get; set; } 17 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IPackageLoaderService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Collections.Generic; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using NuGet.Protocol.Core.Types; 7 | using Orc.NuGetExplorer.Pagination; 8 | using Orc.NuGetExplorer.Providers; 9 | 10 | public interface IPackageLoaderService 11 | { 12 | IPackageMetadataProvider? PackageMetadataProvider { get; } 13 | 14 | Task> LoadAsync(string searchTerm, PageContinuation pageContinuation, SearchFilter searchFilter, CancellationToken token); 15 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Models/EventArgs/PropertyChangedExtendedEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.ComponentModel; 4 | using System.Runtime.CompilerServices; 5 | 6 | public class PropertyChangedExtendedEventArgs : PropertyChangedEventArgs 7 | { 8 | public virtual T? OldValue { get; } 9 | public virtual T? NewValue { get; } 10 | 11 | public PropertyChangedExtendedEventArgs(T? oldValue, T? newValue, [CallerMemberName] string propertyName = "") 12 | : base(propertyName) 13 | { 14 | OldValue = oldValue; 15 | NewValue = newValue; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/---support-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F62C Support Request" 3 | about: Having Trouble - ONLY contributors to other OSS projects OR people who are 4 | funding this project can submit these! If you aren't one of these, expect the ban 5 | hammer to fall 6 | title: '' 7 | labels: '' 8 | assignees: '' 9 | 10 | --- 11 | 12 | ONLY active OSS contributors OR people who buy us a coffee can ask questions here. If you don't do either of these things - DO NOT FILE HERE :) 13 | 14 | Give as much details as humanly possible if you want any sort of answer! 15 | 16 | Enter Question Below (don't delete this line) -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/NuGet/FrameworkParserFacts.The_ToSpecificPlatform_Method.Returns_Correct_Minimum_Version_For_Windows.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Framework: .NETCoreApp, 3 | Version: 8.0.0.0, 4 | Platform: windows, 5 | PlatformVersion: 10.0.22631.0, 6 | HasPlatform: true, 7 | HasProfile: false, 8 | Profile: , 9 | DotNetFrameworkName: .NETCoreApp,Version=v8.0, 10 | DotNetPlatformName: windows,Version=10.0.22631, 11 | IsPCL: false, 12 | IsPackageBased: true, 13 | AllFrameworkVersions: false, 14 | IsUnsupported: false, 15 | IsAgnostic: false, 16 | IsAny: false, 17 | IsSpecificFramework: true 18 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/Exceptions/ProjectInstallException.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using NuGet.Packaging.Core; 6 | 7 | public class ProjectInstallException : ProjectManageException 8 | { 9 | 10 | public ProjectInstallException(string message) 11 | : base(message) 12 | { 13 | 14 | } 15 | 16 | public ProjectInstallException(string message, Exception innerException) 17 | : base(message, innerException) 18 | { 19 | } 20 | 21 | public IEnumerable? CurrentBatch { get; set; } 22 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/ResultOrException.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | public class TaskResultOrException 6 | { 7 | public TaskResultOrException(T result) 8 | { 9 | IsSuccess = true; 10 | Result = result; 11 | } 12 | 13 | public TaskResultOrException(Exception ex) 14 | { 15 | IsSuccess = false; 16 | Exception = ex; 17 | } 18 | 19 | public bool IsSuccess { get; } 20 | 21 | public T? Result { get; } 22 | 23 | public Exception? Exception { get; } 24 | 25 | public T? UnwrapResult() 26 | { 27 | return Result; 28 | } 29 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Example/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // All other assembly info is defined in SharedAssembly.cs 5 | 6 | [assembly: AssemblyTitle("Orc.NuGetExplorer example")] 7 | [assembly: AssemblyProduct("Orc.NuGetExplorer example")] 8 | [assembly: AssemblyDescription("Orc NuGetExplorer example")] 9 | 10 | // Setting ComVisible to false makes the types in this assembly not visible 11 | // to COM components. If you need to access a type in this assembly from 12 | // COM, set the ComVisible attribute to true on that type. 13 | 14 | #if !PCL 15 | [assembly: ComVisible(false)] 16 | #endif -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // All other assembly info is defined in SharedAssembly.cs 5 | 6 | [assembly: AssemblyTitle("Orc.NuGetExplorer.Tests")] 7 | [assembly: AssemblyProduct("Orc.NuGetExplorer.Tests")] 8 | [assembly: AssemblyDescription("Orc NuGetExplorer.Tests")] 9 | 10 | // Setting ComVisible to false makes the types in this assembly not visible 11 | // to COM components. If you need to access a type in this assembly from 12 | // COM, set the ComVisible attribute to true on that type. 13 | 14 | #if !PCL 15 | 16 | [assembly: ComVisible(false)] 17 | #endif -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/IExtensibleProjectExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using NuGet.Configuration; 5 | using NuGet.Protocol.Core.Types; 6 | 7 | public static class IExtensibleProjectExtensions 8 | { 9 | public static SourceRepository AsSourceRepository(this IExtensibleProject project, ISourceRepositoryProvider repositoryProvider) 10 | { 11 | ArgumentNullException.ThrowIfNull(project); 12 | ArgumentNullException.ThrowIfNull(repositoryProvider); 13 | 14 | return repositoryProvider.CreateRepository(new PackageSource(project.ContentPath), NuGet.Protocol.FeedType.FileSystemV2); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Properties/Resources.de.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Properties/Resources.es.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Properties/Resources.fr.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Properties/Resources.nl.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Properties/Resources.ru.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Converters/NuGetFrameworkToStringConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Converters; 2 | 3 | using System; 4 | using Catel.MVVM.Converters; 5 | using NuGet.Frameworks; 6 | 7 | [System.Windows.Data.ValueConversion(typeof(NuGetFramework), typeof(string))] 8 | public class NuGetFrameworkToStringConverter : ValueConverterBase 9 | { 10 | protected override object Convert(NuGetFramework? value, Type targetType, object? parameter) 11 | { 12 | if (value is null) 13 | { 14 | return string.Empty; 15 | } 16 | 17 | return value.IsSpecificFramework ? value.ToString() : value.Framework; 18 | } 19 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Services/XamlPleaseWaitInterruptService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using Catel.Services; 5 | 6 | public class XamlPleaseWaitInterruptService : IPleaseWaitInterruptService 7 | { 8 | private readonly IBusyIndicatorService _busyIndicatorService; 9 | 10 | public XamlPleaseWaitInterruptService(IBusyIndicatorService busyIndicatorService) 11 | { 12 | ArgumentNullException.ThrowIfNull(busyIndicatorService); 13 | 14 | _busyIndicatorService = busyIndicatorService; 15 | } 16 | 17 | public IDisposable InterruptTemporarily() 18 | { 19 | return _busyIndicatorService.HideTemporarily(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Directory.Build.shared.mat.props: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | <_ResxFiles Remove="Properties\*.resx" /> 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Scenario/Base/UpgradeListenerBase.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Scenario; 2 | 3 | using System; 4 | using Orc.NuGetExplorer.Services; 5 | 6 | public abstract class UpgradeListenerBase 7 | { 8 | protected UpgradeListenerBase(INuGetProjectUpgradeService upgradeRunner) 9 | { 10 | ArgumentNullException.ThrowIfNull(upgradeRunner); 11 | 12 | upgradeRunner.UpgradeEnd += OnUpgraded; 13 | upgradeRunner.UpgradeStart += OnUpgrading; 14 | } 15 | 16 | protected virtual void OnUpgrading(object? sender, EventArgs e) 17 | { 18 | 19 | } 20 | 21 | protected virtual void OnUpgraded(object? sender, EventArgs e) 22 | { 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Converters/EmptyCollectionToVisibleConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Converters; 2 | 3 | using System; 4 | using System.Collections; 5 | using System.Windows; 6 | using System.Windows.Data; 7 | using Catel.MVVM.Converters; 8 | 9 | [ValueConversion(typeof(ICollection), typeof(Visibility))] 10 | public class EmptyCollectionToVisibleConverter : CollectionToCollapsingVisibilityConverter 11 | { 12 | protected override object? Convert(object? value, Type targetType, object? parameter) 13 | { 14 | var isVisible = IsVisible(value, targetType, parameter); 15 | return isVisible ? Visibility.Collapsed : Visibility.Visible; // reverse visibility; 16 | } 17 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Example/Providers/DefaultPackageSourcesProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Example; 2 | 3 | using System.Collections.Generic; 4 | 5 | public class DefaultPackageSourcesProvider : IDefaultPackageSourcesProvider 6 | { 7 | public string DefaultSource { get; set; } = Constants.DefaultNuGetOrgUri; 8 | 9 | public IEnumerable GetDefaultPackages() 10 | { 11 | return new List 12 | { 13 | new NuGetFeed("nuget.org", "https://api.nuget.org/v3/index.json"), 14 | new NuGetFeed("Microsoft Visual Studio Offline Packages", @"C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\") 15 | }; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Converters/NuGetFrameworkToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Converters; 2 | 3 | using System; 4 | using System.Windows; 5 | using Catel.MVVM.Converters; 6 | using NuGet.Frameworks; 7 | 8 | [System.Windows.Data.ValueConversion(typeof(NuGetFramework), typeof(Visibility))] 9 | public class NuGetFrameworkToVisibilityConverter : ValueConverterBase 10 | { 11 | protected override object Convert(NuGetFramework? value, Type targetType, object? parameter) 12 | { 13 | if (value is null || value.IsAny) 14 | { 15 | return Visibility.Collapsed; 16 | } 17 | 18 | return Visibility.Visible; 19 | } 20 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Converters/NullableBooleanTrueConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Converters; 2 | 3 | using System; 4 | using Catel.MVVM.Converters; 5 | 6 | [System.Windows.Data.ValueConversion(typeof(bool?), typeof(bool))] 7 | public class NullableBooleanTrueConverter : ValueConverterBase 8 | { 9 | protected override object Convert(bool? value, Type targetType, object? parameter) 10 | { 11 | return value ?? true; 12 | } 13 | 14 | protected override object ConvertBack(object? value, Type targetType, object? parameter) 15 | { 16 | if (value is null) 17 | { 18 | return false; 19 | } 20 | return (bool)value; 21 | } 22 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Extensions/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Windows.Documents; 5 | using System.Windows.Media; 6 | 7 | public static class StringExtensions 8 | { 9 | public static Inline ToInline(this string text) 10 | { 11 | ArgumentNullException.ThrowIfNull(text); 12 | 13 | return text.ToInline(Brushes.Black); 14 | } 15 | 16 | public static Inline ToInline(this string text, Brush brush) 17 | { 18 | ArgumentNullException.ThrowIfNull(text); 19 | 20 | var inline = new Run(text) 21 | { 22 | Foreground = brush ?? Brushes.Black 23 | }; 24 | 25 | return inline; 26 | } 27 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/Helpers/EncryptionHelperFacts.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Tests; 2 | 3 | using NuGetExplorer; 4 | using NUnit.Framework; 5 | 6 | [TestFixture] 7 | public class EncryptionHelperFacts 8 | { 9 | [TestCase("sadf32ASDF43", "some password")] 10 | [TestCase("very long string with spaces", "another password")] 11 | public void EncryptsAndDecryptsCorrectly(string input, string password) 12 | { 13 | var encrypted = EncryptionHelper.Encrypt(input, password); 14 | 15 | Assert.That(encrypted, Is.Not.EqualTo(input)); 16 | 17 | var decrypted = EncryptionHelper.Decrypt(encrypted, password); 18 | 19 | Assert.That(decrypted, Is.EqualTo(input)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Behaviors/SelectFirstItemOnContextBehavior.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Behaviors; 2 | 3 | using System.Windows.Controls; 4 | using System.Windows.Controls.Primitives; 5 | using Catel.Windows.Interactivity; 6 | 7 | internal class SelectFirstItemOnContextBehavior : BehaviorBase 8 | { 9 | protected override void OnAssociatedObjectLoaded() 10 | { 11 | TrySelectFirstItemFromSource(); 12 | } 13 | 14 | private void TrySelectFirstItemFromSource() 15 | { 16 | if (AssociatedObject.Items is not null && AssociatedObject.Items.Count > 0) 17 | { 18 | AssociatedObject.SetCurrentValue(Selector.SelectedIndexProperty, 0); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/NuGet/Packaging/UpdatePackageSearchMetadata.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Packaging; 2 | 3 | using System.Collections.Generic; 4 | using NuGet.Common; 5 | using NuGet.Protocol.Core.Types; 6 | using static NuGet.Protocol.Core.Types.PackageSearchMetadataBuilder; 7 | 8 | public class UpdatePackageSearchMetadata : ClonedPackageSearchMetadata 9 | { 10 | public UpdatePackageSearchMetadata(VersionInfo from, AsyncLazy> versionsInitialization) 11 | { 12 | FromVersion = from; 13 | LazyVersionsFactory = versionsInitialization; 14 | } 15 | 16 | public VersionInfo FromVersion { get; set; } 17 | public AsyncLazy> LazyVersionsFactory { get; set; } 18 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Mvvm/BindingProxy.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.MVVM; 2 | 3 | using System.Windows; 4 | 5 | public class BindingProxy : Freezable 6 | { 7 | public object? Data 8 | { 9 | get { return GetValue(DataProperty); } 10 | set { SetValue(DataProperty, value); } 11 | } 12 | 13 | /// 14 | /// Identifies the dependency property. 15 | /// 16 | public static readonly DependencyProperty DataProperty = 17 | DependencyProperty.Register(nameof(Data), typeof(object), typeof(BindingProxy), new UIPropertyMetadata(null)); 18 | 19 | protected override Freezable CreateInstanceCore() 20 | { 21 | return new BindingProxy(); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Example/App.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/NuGet/Packaging/PackageCollectionItem.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Packaging; 2 | 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using NuGet.Packaging; 6 | using NuGet.Packaging.Core; 7 | using NuGet.Versioning; 8 | 9 | public sealed class PackageCollectionItem : PackageIdentity 10 | { 11 | /// 12 | /// Installed package references. 13 | /// 14 | public List PackageReferences { get; } 15 | 16 | public PackageCollectionItem(string id, NuGetVersion version, IEnumerable installedReferences) 17 | : base(id, version) 18 | { 19 | PackageReferences = installedReferences?.ToList() ?? new List(); 20 | } 21 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/--bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F99FBug" 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: "s/unverified, t/bug \U0001F47E" 6 | assignees: '' 7 | 8 | --- 9 | 10 | # IF YOU DON'T ANSWER THIS TEMPLATE - THE BOT WILL AUTOMATICALLY CLOSE YOUR ISSUE! 11 | 12 | ## Please check all of the platforms you are having the issue on (if platform is not listed, it is not supported) 13 | 14 | - [ ] WPF 15 | - [ ] Blazor WASM 16 | - [ ] .NET Core 17 | 18 | ## Component 19 | 20 | What component is this issue occurring in? 21 | 22 | ## Version of Library 23 | 24 | 25 | ## Version of OS(s) listed above with issue 26 | 27 | 28 | ## Steps to Reproduce 29 | 1. 30 | 2. 31 | 3. 32 | 33 | ## Expected Behavior 34 | 35 | 36 | ## Actual Behavior -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/ViewModels/DependenciesViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.ViewModels; 2 | 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using Catel.MVVM; 6 | using NuGet.Packaging; 7 | 8 | internal class DependenciesViewModel : ViewModelBase 9 | { 10 | /// 11 | /// This is property mapped via attribute 12 | /// 13 | public object? Collection { get; set; } 14 | 15 | protected override void OnPropertyChanged(PropertyChangedEventArgs e) 16 | { 17 | if (e.HasPropertyChanged(nameof(Collection))) 18 | { 19 | HasDependency = ((Collection as List)?.Count ?? 0) > 0; 20 | } 21 | } 22 | 23 | public bool HasDependency { get; set; } 24 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IPackageOperationService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using NuGet.Packaging.Core; 7 | 8 | public interface IPackageOperationService 9 | { 10 | Task UninstallPackageAsync(IPackageDetails package, Func? packagePredicate = null, CancellationToken token = default); 11 | Task InstallPackageAsync(IPackageDetails package, bool allowedPrerelease = false, Func? packagePredicate = null, CancellationToken token = default); 12 | Task UpdatePackagesAsync(IPackageDetails package, bool allowedPrerelease = false, Func? packagePredicate = null, CancellationToken token = default); 13 | } 14 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/EventArgs/InstallNuGetProjectEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management; 2 | 3 | using NuGet.Packaging.Core; 4 | 5 | public class InstallNuGetProjectEventArgs : NuGetProjectEventArgs 6 | { 7 | public InstallNuGetProjectEventArgs(IExtensibleProject project, PackageIdentity package, bool result) : base(project, package) 8 | { 9 | Result = result; 10 | } 11 | 12 | public bool Result { get; } 13 | } 14 | 15 | public class BatchedInstallNuGetProjectEventArgs : InstallNuGetProjectEventArgs 16 | { 17 | public BatchedInstallNuGetProjectEventArgs(InstallNuGetProjectEventArgs eventArgs) : base(eventArgs.Project, eventArgs.Package, eventArgs.Result) 18 | { 19 | } 20 | 21 | public bool IsBatchEnd { get; set; } 22 | } -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 60 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | - planned 10 | - nostale 11 | # Label to use when marking an issue as stale 12 | staleLabel: wontfix 13 | # Comment to post when marking an issue as stale. Set to `false` to disable 14 | markComment: > 15 | This issue has been automatically marked as stale because it has not had 16 | recent activity. It will be closed if no further activity occurs. Thank you 17 | for your contributions. 18 | # Comment to post when closing a stale issue. Set to `false` to disable 19 | closeComment: false -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Helpers/LogHelper.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using Catel.Logging; 7 | 8 | public class LogHelper 9 | { 10 | public static void LogUnclearedPaths(List? unclearedPaths, ILog log) 11 | { 12 | ArgumentNullException.ThrowIfNull(log); 13 | 14 | if (unclearedPaths?.Any() ?? false) 15 | { 16 | log.Info("Some directories cannot be deleted, directory tree was partially cleared:"); 17 | 18 | foreach (var failedDelete in unclearedPaths.OrderBy(f => f, StringComparer.OrdinalIgnoreCase)) 19 | { 20 | log.Info($"Failed to delete path {failedDelete}"); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Validation/Providers/DefaultPackageValidatorProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer 2 | { 3 | using System.Collections.Generic; 4 | 5 | public class DefaultPackageValidatorProvider : IPackageValidatorProvider 6 | { 7 | private readonly IDefaultNuGetFramework _defaultNuGetFramework; 8 | 9 | public DefaultPackageValidatorProvider(IDefaultNuGetFramework defaultNuGetFramework) 10 | { 11 | _defaultNuGetFramework = defaultNuGetFramework; 12 | } 13 | 14 | public virtual IReadOnlyList GetValidators() 15 | { 16 | return new[] 17 | { 18 | new PackageTargetFrameworkValidator(_defaultNuGetFramework) 19 | }; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/EventArgs/UninstallNuGetProjectEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management; 2 | 3 | using NuGet.Packaging.Core; 4 | 5 | public class UninstallNuGetProjectEventArgs : NuGetProjectEventArgs 6 | { 7 | public UninstallNuGetProjectEventArgs(IExtensibleProject project, PackageIdentity package, bool result) : base(project, package) 8 | { 9 | Result = result; 10 | } 11 | 12 | public bool Result { get; } 13 | } 14 | 15 | public class BatchedUninstallNuGetProjectEventArgs : UninstallNuGetProjectEventArgs 16 | { 17 | public BatchedUninstallNuGetProjectEventArgs(UninstallNuGetProjectEventArgs eventArgs) : base(eventArgs.Project, eventArgs.Package, eventArgs.Result) 18 | { 19 | } 20 | 21 | public bool IsBatchEnd { get; set; } 22 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/NuGet/Install/InstallerResult.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Collections.Generic; 4 | using NuGet.Protocol.Core.Types; 5 | 6 | public class InstallerResult 7 | { 8 | public InstallerResult(string errorMessage) 9 | { 10 | ErrorMessage = errorMessage; 11 | Result = new Dictionary(); 12 | } 13 | 14 | public InstallerResult(IDictionary downloadResult) 15 | { 16 | Result = downloadResult; 17 | ErrorMessage = string.Empty; 18 | } 19 | 20 | public IDictionary Result { get; private set; } 21 | 22 | public string ErrorMessage { get; private set; } 23 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Models/InstallationContext.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using NuGet.Packaging.Core; 6 | using NuGet.Protocol.Core.Types; 7 | 8 | public class InstallationContext 9 | { 10 | public InstallationContext() 11 | { 12 | IgnoreMissingPackages = false; 13 | AllowMultipleVersions = false; 14 | } 15 | 16 | public required PackageIdentity Package { get; set; } 17 | public required IExtensibleProject Project { get; set; } 18 | public required IReadOnlyList Repositories { get; set; } 19 | public bool IgnoreMissingPackages { get; set; } 20 | public Func? PackagePredicate { get; set; } 21 | public bool AllowMultipleVersions { get; set; } 22 | } 23 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IPackagesUpdatesSearcherService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Collections.Generic; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using NuGet.Protocol.Core.Types; 7 | 8 | public interface IPackagesUpdatesSearcherService 9 | { 10 | Task> SearchForUpdatesAsync(bool? allowPrerelease = null, bool authenticateIfRequired = true, CancellationToken token = default); 11 | Task> SearchForPackagesUpdatesAsync(bool? allowPrerelease = null, bool authenticateIfRequired = true, CancellationToken token = default); 12 | Task> SearchForUpdatesAsync(string[] excludeReleasesTag, bool? allowPrerelease = null, CancellationToken token = default); 13 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Helpers/AccentColorHelper.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Windows.Media; 4 | 5 | internal static class AccentColorHelper 6 | { 7 | public static Color ConvertToNonAlphaColor(Color backgroundColor, Color accentColor) 8 | { 9 | var alphaNormalized = accentColor.A / (double)255; 10 | 11 | //calculate rgb from argb with same color 12 | var newColorR = (byte)(accentColor.R * alphaNormalized + backgroundColor.R * (1 - alphaNormalized)); 13 | byte newColorG = (byte)(accentColor.G * alphaNormalized + backgroundColor.G * (1 - alphaNormalized)); 14 | var newColorB = (byte)(accentColor.B * alphaNormalized + backgroundColor.B * (1 - alphaNormalized)); 15 | 16 | return Color.FromRgb(newColorR, newColorG, newColorB); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Tokens/CredentialsToken.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Threading.Tasks; 5 | using NuGet.Protocol; 6 | using NuGet.Protocol.Core.Types; 7 | 8 | internal sealed class CredentialsToken : IDisposable 9 | { 10 | private readonly HttpHandlerResourceV3 _repositoryHttpHandler; 11 | 12 | public static async Task CreateAsync(SourceRepository repository) 13 | { 14 | return new CredentialsToken(await repository.GetResourceAsync()); 15 | } 16 | 17 | public CredentialsToken(HttpHandlerResourceV3 httpHandler) 18 | { 19 | _repositoryHttpHandler = httpHandler; 20 | } 21 | 22 | public void Dispose() 23 | { 24 | _repositoryHttpHandler.ResetCredentials(); 25 | } 26 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/Interfaces/IExtensibleProjectLocator.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management; 2 | 3 | using System.Collections.Generic; 4 | 5 | public interface IExtensibleProjectLocator 6 | { 7 | IEnumerable GetAllExtensibleProjects(bool onlyEnabled = true); 8 | 9 | void Register(IExtensibleProject project); 10 | 11 | void Register() where T : IExtensibleProject; 12 | 13 | void Register(params object[] parameters) where T : IExtensibleProject; 14 | 15 | void Enable(IExtensibleProject extensibleProject); 16 | 17 | void Disable(IExtensibleProject extensibleProject); 18 | 19 | bool IsEnabled(IExtensibleProject extensibleProject); 20 | 21 | bool IsConfigLoaded { get; } 22 | 23 | void PersistChanges(); 24 | 25 | void RestoreStateFromConfig(); 26 | } -------------------------------------------------------------------------------- /src/GlobalSuppressions.global.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | // This file is used by Code Analysis to maintain SuppressMessage 4 | // attributes that are applied to this project. 5 | // Project-level suppressions either have no target or are given 6 | // a specific target and scoped to a namespace, type, member, etc. 7 | 8 | [assembly: SuppressMessage("WpfAnalyzers.DependencyProperties", "WPF1010:Property '[property]' must notify when value changes.", Justification = "Don't enforce this")] 9 | [assembly: SuppressMessage("WpfAnalyzers.DependencyProperties", "WPF1011:Implement INotifyPropertyChanged.", Justification = "Don't enforce this")] 10 | [assembly: SuppressMessage("Usage", "CA2255:The 'ModuleInitializer' attribute should not be used in libraries", Justification = "Used to register language resources and types")] 11 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/NuGet/PackageSearchParameters.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | public class PackageSearchParameters 4 | { 5 | public PackageSearchParameters(bool prereleasIncluded, string searchString, bool isRecommendedOnly) 6 | { 7 | SearchString = searchString; 8 | IsPrereleaseIncluded = prereleasIncluded; 9 | IsRecommendedOnly = isRecommendedOnly; 10 | } 11 | 12 | public PackageSearchParameters() 13 | { 14 | SearchString = string.Empty; 15 | IsPrereleaseIncluded = false; 16 | IsRecommendedOnly = false; 17 | } 18 | 19 | public bool IsPrereleaseIncluded { get; set; } 20 | 21 | public string SearchString { get; set; } 22 | 23 | /// 24 | /// Option for updates 25 | /// 26 | public bool IsRecommendedOnly { get; set; } 27 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/EventArgs/PackageOperationBatchEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.ComponentModel; 4 | using Catel; 5 | 6 | public class PackageOperationBatchEventArgs : CancelEventArgs 7 | { 8 | internal PackageOperationBatchEventArgs(PackageOperationType operationType, params IPackageDetails[] packages) 9 | { 10 | Argument.IsNotNullOrEmptyArray(nameof(packages), packages); 11 | 12 | Packages = packages; 13 | OperationType = operationType; 14 | } 15 | 16 | public IPackageDetails[] Packages { get; private set; } 17 | 18 | public PackageOperationType OperationType { get; private set; } 19 | 20 | /// 21 | /// Determine is event raised by user actions or automatically 22 | /// 23 | public bool IsAutomatic { get; set; } 24 | } 25 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Web/FatalProtocolExceptionExtension.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Web; 2 | 3 | using System; 4 | using NuGet.Protocol.Core.Types; 5 | 6 | public static class FatalProtocolExceptionExtension 7 | { 8 | public static bool HidesUnauthorizedError(this FatalProtocolException fatalProtocolException) 9 | { 10 | ArgumentNullException.ThrowIfNull(fatalProtocolException); 11 | 12 | return fatalProtocolException.Message.Contains("returned an unexpected status code '401 Unauthorized'"); 13 | } 14 | 15 | public static bool HidesForbiddenError(this FatalProtocolException fatalProtocolException) 16 | { 17 | ArgumentNullException.ThrowIfNull(fatalProtocolException); 18 | 19 | return fatalProtocolException.Message.Contains("returned an unexpected status code '403 Forbidden'"); 20 | } 21 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/--feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F354Feature Request" 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: "s/unverified, t/enhancement \U0001F423" 6 | assignees: '' 7 | 8 | --- 9 | 10 | # IF YOU DON'T ANSWER THIS TEMPLATE - THE BOT WILL AUTOMATICALLY CLOSE YOUR ISSUE! 11 | 12 | ## Summary 13 | Please provide a brief summary of your proposal. Two to three sentences is best here. 14 | 15 | ## API Changes 16 | Include a list of all API changes, additions, subtractions as would be required by your proposal. These APIs should be considered placeholders, so the naming is not as important as getting the concepts correct. If possible you should include some "example" code of usage of your new API. 17 | 18 | ## Intended Use Case 19 | Provide a detailed example of where your proposal would be used and for what purpose. -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Providers/NuGetProjectContextProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Providers; 2 | 3 | using System; 4 | using Catel.IoC; 5 | using NuGet.ProjectManagement; 6 | using Orc.NuGetExplorer.Management; 7 | 8 | 9 | public class NuGetProjectContextProvider : INuGetProjectContextProvider 10 | { 11 | private readonly ITypeFactory _typeFactory; 12 | 13 | public NuGetProjectContextProvider(ITypeFactory typeFactory) 14 | { 15 | ArgumentNullException.ThrowIfNull(typeFactory); 16 | 17 | _typeFactory = typeFactory; 18 | } 19 | 20 | public INuGetProjectContext GetProjectContext(FileConflictAction fileConflictAction) 21 | { 22 | var projectContext = _typeFactory.CreateRequiredInstanceWithParametersAndAutoCompletion(fileConflictAction); 23 | 24 | return projectContext; 25 | } 26 | } -------------------------------------------------------------------------------- /.github/support.yml: -------------------------------------------------------------------------------- 1 | # Configuration for Support Requests - https://github.com/dessant/support-requests 2 | 3 | # Label used to mark issues as support requests 4 | supportLabel: support 5 | 6 | # Comment to post on issues marked as support requests, `{issue-author}` is an 7 | # optional placeholder. Set to `false` to disable 8 | supportComment: > 9 | :wave: @{issue-author}, we use the issue tracker exclusively for bug reports 10 | and feature requests. However, this issue appears to be a support request. 11 | Please use our support channels to get help with the project. 12 | 13 | # Close issues marked as support requests 14 | close: true 15 | 16 | # Lock issues marked as support requests 17 | lock: false 18 | 19 | # Assign `off-topic` as the reason for locking. Set to `false` to disable 20 | setLockReason: true 21 | 22 | # Repository to extend settings from 23 | # _extends: repo -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Extensions/IValidationContextExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Linq; 5 | using Catel.Data; 6 | 7 | public static class IValidationContextExtensions 8 | { 9 | public static string[]? GetAlertMessages(this IValidationContext validationContext, string validationTag) 10 | { 11 | ArgumentNullException.ThrowIfNull(validationContext); 12 | 13 | var stringLines = validationContext.GetErrors(validationTag).Select(s => " - " + s.Message).ToArray(); 14 | 15 | if (stringLines is null) 16 | { 17 | return null; 18 | } 19 | 20 | var valuableLines = stringLines.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray(); 21 | 22 | if (!valuableLines.Any()) 23 | { 24 | return null; 25 | } 26 | 27 | return valuableLines; 28 | } 29 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/PackageSearchMetadataExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using NuGet.Protocol.Core.Types; 7 | using NuGet.Versioning; 8 | 9 | public static class PackageSearchMetadataExtensions 10 | { 11 | public static IEnumerable ToVersionInfo(this IEnumerable packages, bool includePrerelease) 12 | { 13 | ArgumentNullException.ThrowIfNull(packages); 14 | 15 | return packages 16 | .Where(v => includePrerelease || !v.Identity.Version.IsPrerelease) 17 | .OrderByDescending(m => m.Identity.Version, VersionComparer.VersionRelease) 18 | .Select(m => new VersionInfo(m.Identity.Version, m.DownloadCount) 19 | { 20 | PackageSearchMetadata = m 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Themes/Animations.xaml: -------------------------------------------------------------------------------- 1 | 4 | 9 | 10 | 11 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/IConfigurationServiceExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using Catel.Configuration; 5 | 6 | public static class IConfigurationServiceExtensions 7 | { 8 | public static CredentialStoragePolicy GetCredentialStoragePolicy(this IConfigurationService configurationService) 9 | { 10 | ArgumentNullException.ThrowIfNull(configurationService); 11 | 12 | return configurationService.GetRoamingValue(Settings.NuGet.CredentialStorage, CredentialStoragePolicy.WindowsVaultConfigurationFallback); 13 | } 14 | 15 | public static void SetCredentialStoragePolicy(this IConfigurationService configurationService, CredentialStoragePolicy value) 16 | { 17 | ArgumentNullException.ThrowIfNull(configurationService); 18 | 19 | configurationService.SetRoamingValue(Settings.NuGet.CredentialStorage, value); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/IPackageLoaderServiceExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using NuGet.Protocol.Core.Types; 8 | using Pagination; 9 | 10 | public static class IPackageLoaderServiceExtensions 11 | { 12 | public static async Task> LoadWithDefaultsAsync(this IPackageLoaderService packageLoaderService, string repository, CancellationToken token = default) 13 | { 14 | ArgumentNullException.ThrowIfNull(packageLoaderService); 15 | 16 | var defaultFilter = new SearchFilter(true); 17 | var localPagination = new PageContinuation(0, new PackageSourceWrapper(repository)); 18 | 19 | return await packageLoaderService.LoadAsync(string.Empty, localPagination, defaultFilter, token); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/PackageCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Linq; 5 | using NuGet.Packaging.Core; 6 | using NuGet.Versioning; 7 | using Packaging; 8 | 9 | public static class PackageCollectionExtensions 10 | { 11 | public static PackageIdentity[] GetLatest(this PackageCollection packages, IVersionComparer versionComparer) 12 | { 13 | ArgumentNullException.ThrowIfNull(packages); 14 | ArgumentNullException.ThrowIfNull(versionComparer); 15 | 16 | return packages 17 | .GroupBy(p => p.Id, p => p.Version, StringComparer.OrdinalIgnoreCase) 18 | //max or default 19 | .Select(g => new PackageIdentity( 20 | g.Key, 21 | g.OrderByDescending(v => v, versionComparer) 22 | .FirstOrDefault())) 23 | .ToArray(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/PackageSourceExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using NuGet.Configuration; 7 | 8 | internal static class PackageSourceExtensions 9 | { 10 | internal static IEnumerable ToPackageSourceInstances(this IEnumerable packageSources) 11 | { 12 | ArgumentNullException.ThrowIfNull(packageSources); 13 | 14 | return packageSources.Select(x => new PackageSource(x.Source, x.Name, x.IsEnabled, x.IsOfficial)); 15 | } 16 | 17 | internal static IEnumerable ToPackageSourceInterfaces(this IEnumerable packageSources) 18 | { 19 | ArgumentNullException.ThrowIfNull(packageSources); 20 | 21 | return packageSources.Select(x => new NuGetFeed(x.Name, x.Source, x.IsEnabled, x.IsOfficial)); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Behaviors/FocusOnVisibleBehavior.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Behaviors; 2 | 3 | using System.Windows; 4 | using Catel.Windows.Interactivity; 5 | 6 | internal class FocusOnVisibleBehavior : BehaviorBase 7 | { 8 | protected override void OnAssociatedObjectLoaded() 9 | { 10 | base.OnAssociatedObjectLoaded(); 11 | 12 | AssociatedObject.IsVisibleChanged += OnIsVisibleChanged; 13 | } 14 | 15 | protected override void OnAssociatedObjectUnloaded() 16 | { 17 | AssociatedObject.IsVisibleChanged -= OnIsVisibleChanged; 18 | 19 | base.OnAssociatedObjectUnloaded(); 20 | } 21 | 22 | private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) 23 | { 24 | if (!(bool)e.NewValue) 25 | { 26 | return; 27 | } 28 | 29 | AssociatedObject.Focus(); 30 | } 31 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/Projects/Interfaces/IExtensibleProject.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Collections.Generic; 4 | using NuGet.Frameworks; 5 | using NuGet.Packaging; 6 | using NuGet.Packaging.Core; 7 | 8 | public interface IExtensibleProject 9 | { 10 | string Name { get; } 11 | 12 | string Framework { get; } 13 | 14 | string ContentPath { get; } 15 | 16 | IReadOnlyList SupportedPlatforms { get; set; } 17 | 18 | PackagePathResolver GetPathResolver(); 19 | 20 | [ObsoleteEx(ReplacementTypeOrMember = "IgnoreMissingDependencies", TreatAsErrorFromVersion = "6.0", RemoveInVersion = "6.0")] 21 | bool IgnoreDependencies { get; } 22 | 23 | bool IgnoreMissingDependencies { get; } 24 | 25 | bool SupportSideBySide { get; } 26 | 27 | bool NoCache { get; } 28 | 29 | string GetInstallPath(PackageIdentity packageIdentity); 30 | } 31 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/EventArgs/PackageOperationEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.ComponentModel; 4 | 5 | public class PackageOperationEventArgs : CancelEventArgs 6 | { 7 | internal PackageOperationEventArgs(IPackageDetails packageDetails, string installPath, PackageOperationType packageOperationType, bool isAutomatic = false) 8 | { 9 | PackageDetails = packageDetails; 10 | InstallPath = installPath; 11 | PackageOperationType = packageOperationType; 12 | } 13 | 14 | public string InstallPath { get; private set; } 15 | 16 | public PackageOperationType PackageOperationType { get; private set; } 17 | 18 | public IPackageDetails PackageDetails { get; private set; } 19 | 20 | /// 21 | /// Determine is event raised by user actions or automatically 22 | /// 23 | public bool IsAutomatic { get; set; } 24 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/TemporaryFIleSystemContextService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using Catel; 5 | using Catel.IoC; 6 | 7 | internal class TemporaryFIleSystemContextService : ITemporaryFIleSystemContextService 8 | { 9 | private readonly ITypeFactory _typeFactory; 10 | 11 | public TemporaryFIleSystemContextService(ITypeFactory typeFactory) 12 | { 13 | ArgumentNullException.ThrowIfNull(typeFactory); 14 | 15 | _typeFactory = typeFactory; 16 | } 17 | 18 | public ITemporaryFileSystemContext? Context { get; private set; } 19 | 20 | public IDisposable UseTemporaryFIleSystemContext() 21 | { 22 | using (var context = _typeFactory.CreateRequiredInstance()) 23 | { 24 | return new DisposableToken(context, token => { }, token => { }); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Configuration/Base/ConfigurationListenerBase.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Configuration; 2 | 3 | using System; 4 | using System.Threading.Tasks; 5 | using NuGet.Configuration; 6 | 7 | public abstract class ConfigurationListenerBase 8 | { 9 | private readonly IVersionedSettings _settings; 10 | 11 | protected ConfigurationListenerBase(ISettings settings) 12 | { 13 | ArgumentNullException.ThrowIfNull(settings); 14 | 15 | _settings = settings as IVersionedSettings ?? throw new InvalidOperationException($"'{nameof(settings)}' must have defined Version"); 16 | 17 | _settings.SettingsRead += OnConfigurationSettingsRead; 18 | } 19 | 20 | public virtual async Task OnSettingsReadAsync() 21 | { 22 | 23 | } 24 | 25 | private async void OnConfigurationSettingsRead(object? sender, EventArgs e) 26 | { 27 | await OnSettingsReadAsync(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Behaviors/UpdateSourceOnVisibleBehavior.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Behaviors; 2 | 3 | using System.Windows; 4 | using Catel.Windows.Interactivity; 5 | 6 | internal class UpdateSourceOnVisibleBehavior : BehaviorBase 7 | { 8 | protected override void OnAssociatedObjectLoaded() 9 | { 10 | base.OnAssociatedObjectLoaded(); 11 | 12 | AssociatedObject.IsVisibleChanged += OnIsVisibleChanged; 13 | } 14 | 15 | protected override void OnAssociatedObjectUnloaded() 16 | { 17 | AssociatedObject.IsVisibleChanged -= OnIsVisibleChanged; 18 | 19 | base.OnAssociatedObjectUnloaded(); 20 | } 21 | 22 | private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) 23 | { 24 | if (!(bool)e.NewValue) 25 | { 26 | return; 27 | } 28 | 29 | AssociatedObject.UpdateItemSource(); 30 | } 31 | } -------------------------------------------------------------------------------- /src/nuget.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/NuGet/DefaultNuGetFolders.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.IO; 4 | using NuGet.Common; 5 | 6 | public static class DefaultNuGetFolders 7 | { 8 | public static readonly string DefaultGlobalPackagesFolderPath = "packages" + Path.DirectorySeparatorChar; 9 | 10 | public static string GetGlobalPackagesFolder() 11 | { 12 | return Path.Combine(NuGetEnvironment.GetFolderPath(NuGetFolderPath.NuGetHome), DefaultGlobalPackagesFolderPath); 13 | } 14 | 15 | public static string GetApplicationRoamingFolder() 16 | { 17 | return Catel.IO.Path.GetApplicationDataDirectory(Catel.IO.ApplicationDataTarget.UserRoaming, Constants.CompanyName, Constants.ProductName); 18 | } 19 | 20 | public static string GetApplicationLocalFolder() 21 | { 22 | return Catel.IO.Path.GetApplicationDataDirectory(Catel.IO.ApplicationDataTarget.UserLocal, Constants.CompanyName, Constants.ProductName); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/CheckableUnit.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.ComponentModel; 5 | using Catel.Data; 6 | 7 | internal class CheckableUnit : ObservableObject 8 | { 9 | private readonly Action _onCheckedChangedCallback; 10 | 11 | public CheckableUnit(bool isChecked, T value, Action onCheckedChangedCallback) 12 | { 13 | IsChecked = isChecked; 14 | Value = value; 15 | 16 | _onCheckedChangedCallback = onCheckedChangedCallback; 17 | } 18 | 19 | public bool IsChecked { get; set; } 20 | 21 | protected override void OnPropertyChanged(PropertyChangedEventArgs e) 22 | { 23 | if (Value is null) 24 | { 25 | return; 26 | } 27 | 28 | if (e.HasPropertyChanged(nameof(IsChecked))) 29 | { 30 | _onCheckedChangedCallback(Value, IsChecked); 31 | } 32 | } 33 | 34 | public T Value { get; set; } 35 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Example/PackageManagement/ExampleUpgradeListener.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Example; 2 | 3 | using System; 4 | using Catel.Services; 5 | using Orc.NuGetExplorer.Scenario; 6 | using Orc.NuGetExplorer.Services; 7 | 8 | internal class ExampleUpgradeListener : UpgradeListenerBase 9 | { 10 | private readonly IMessageService _messageService; 11 | 12 | public ExampleUpgradeListener(INuGetProjectUpgradeService upgradeService, IMessageService messageService) 13 | : base(upgradeService) 14 | { 15 | ArgumentNullException.ThrowIfNull(messageService); 16 | 17 | _messageService = messageService; 18 | } 19 | 20 | protected override void OnUpgraded(object sender, EventArgs e) 21 | { 22 | _messageService.ShowAsync("NuGet data updated"); 23 | } 24 | 25 | protected override void OnUpgrading(object sender, EventArgs e) 26 | { 27 | _messageService.ShowAsync("Updating NuGet data"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/Extensions/UriExtensionsFacts.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Tests; 2 | 3 | using System; 4 | using NUnit.Framework; 5 | using Orc.NuGetExplorer; 6 | 7 | [TestFixture] 8 | public class UriExtensionsFacts 9 | { 10 | public class The_DecodeLocalUri_Method 11 | { 12 | [TestCase( 13 | "file:///C:/Users/test/AppData/Roaming/Orc.NuGetExplorer example/plugins/Test.1.0.0-alpha0/Test.1.0.0-alpha0.nupkg#packageIcon.png", 14 | "C:\\Users\\test\\AppData\\Roaming\\Orc.NuGetExplorer example\\plugins\\Test.1.0.0-alpha0\\packageIcon.png")] 15 | public void CanHandleAbsoluteUriWithWhitespaces(string absoluteUri, string expectedPath) 16 | { 17 | var uri = new Uri(absoluteUri); 18 | var parsedUri = uri.GetLocalUriForFragment(); 19 | 20 | var actualPath = parsedUri.LocalPath; 21 | 22 | Assert.That(actualPath, Is.EqualTo(expectedPath)); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Example/Views/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Example.Views; 2 | 3 | using Catel.Windows; 4 | using Orc.NuGetExplorer.Example.ViewModels; 5 | 6 | /// 7 | /// Interaction logic for MainWindow.xaml 8 | /// 9 | public partial class MainWindow : DataWindow 10 | { 11 | /// 12 | /// Initializes a new instance of the class. 13 | /// 14 | public MainWindow() 15 | : this(null) 16 | { 17 | } 18 | 19 | /// 20 | /// Initializes a new instance of the class. 21 | /// 22 | /// The view model to inject. 23 | /// 24 | /// This constructor can be used to use view-model injection. 25 | /// 26 | public MainWindow(MainViewModel viewModel) 27 | : base(viewModel, DataWindowMode.Custom) 28 | { 29 | InitializeComponent(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Controls/Helpers/WpfHelper.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Controls; 2 | 3 | using System; 4 | using System.Windows; 5 | using System.Windows.Media; 6 | 7 | public static class WpfHelper 8 | { 9 | public static TChild? FindVisualChild(DependencyObject obj) 10 | where TChild : DependencyObject 11 | { 12 | ArgumentNullException.ThrowIfNull(obj); 13 | 14 | for (var i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) 15 | { 16 | var child = VisualTreeHelper.GetChild(obj, i); 17 | if (child is TChild item) 18 | { 19 | return item; 20 | } 21 | else 22 | { 23 | var nestedChild = FindVisualChild(child); 24 | 25 | if (nestedChild is not null) 26 | { 27 | return nestedChild; 28 | } 29 | } 30 | } 31 | return null; 32 | } 33 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/TaskExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | public static class TaskExtensions 9 | { 10 | public static async Task[]> WhenAllOrExceptionAsync(this IEnumerable> tasks) 11 | { 12 | ArgumentNullException.ThrowIfNull(tasks); 13 | 14 | return await Task.WhenAll(tasks.Select(WrapResultOrExceptionAsync)); 15 | } 16 | 17 | public static async Task> WrapResultOrExceptionAsync(this Task task) 18 | { 19 | ArgumentNullException.ThrowIfNull(task); 20 | 21 | try 22 | { 23 | var result = await task; 24 | return new TaskResultOrException(result); 25 | } 26 | catch (Exception ex) 27 | { 28 | return new TaskResultOrException(ex); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Converters/RemoveTransparencyColorBrushConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Converters; 2 | 3 | using System; 4 | using System.Windows.Media; 5 | using Catel.MVVM.Converters; 6 | using Orc.Theming; 7 | 8 | [System.Windows.Data.ValueConversion(typeof(Color), typeof(SolidColorBrush))] 9 | public class RemoveTransparencyColorBrushConverter : ValueConverterBase 10 | { 11 | private SolidColorBrush? _cachedBrush; 12 | 13 | protected override object Convert(Color value, Type targetType, object? parameter) 14 | { 15 | if (_cachedBrush is not null) 16 | { 17 | return _cachedBrush; 18 | } 19 | 20 | var nonTransparentColor = AccentColorHelper.ConvertToNonAlphaColor(Colors.White, value); 21 | var nonTransparentBrush = nonTransparentColor.ToSolidColorBrush(); 22 | 23 | nonTransparentBrush.Freeze(); 24 | _cachedBrush = nonTransparentBrush; 25 | 26 | return nonTransparentBrush; 27 | } 28 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IPackageQueryService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | using NuGet.Protocol.Core.Types; 6 | 7 | public interface IPackageQueryService 8 | { 9 | Task PackageExistsAsync(IRepository packageRepository, string filter, bool allowPrereleaseVersions); 10 | Task PackageExistsAsync(IRepository packageRepository, string packageId); 11 | Task PackageExistsAsync(IRepository packageRepository, IPackageDetails packageDetails); 12 | 13 | Task GetPackageAsync(IRepository packageRepository, string packageId, string version); 14 | Task> GetPackagesAsync(IRepository packageRepository, bool allowPrereleaseVersions, string? filter = null, int skip = 0, int take = 10); 15 | Task> GetVersionsOfPackageAsync(IRepository packageRepository, IPackageDetails package, bool allowPrereleaseVersions, int skip); 16 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Watchers/Base/PackageSourcesWatcherBase.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Watchers.Base; 2 | 3 | using System; 4 | using System.Linq; 5 | using NuGet.Configuration; 6 | 7 | public abstract class PackageSourcesWatcherBase 8 | { 9 | protected PackageSourcesWatcherBase(IPackageSourceProvider packageSourceProvider) 10 | { 11 | ArgumentNullException.ThrowIfNull(packageSourceProvider); 12 | 13 | packageSourceProvider.PackageSourcesChanged += OnPackageSourcesChanged; 14 | } 15 | 16 | private void OnPackageSourcesChanged(object? sender, EventArgs e) 17 | { 18 | if (sender is IPackageSourceProvider provider) 19 | { 20 | var packageSource = provider.LoadPackageSources().FirstOrDefault(source => !string.IsNullOrWhiteSpace(source.Source)); 21 | 22 | OnPackageSourcesChanged(packageSource?.Source); 23 | } 24 | } 25 | 26 | protected virtual void OnPackageSourcesChanged(string? packageSource) 27 | { 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Services/Interfaces/IPackageCommandService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | public interface IPackageCommandService 8 | { 9 | string GetActionName(PackageOperationType operationType); 10 | Task ExecuteAsync(PackageOperationType operationType, IPackageDetails packageDetails); 11 | Task CanExecuteAsync(PackageOperationType operationType, IPackageDetails package); 12 | 13 | Task ExecuteInstallAsync(IPackageDetails packageDetails, CancellationToken token); 14 | Task ExecuteInstallAsync(IPackageDetails packageDetails, IDisposable packageOperationContext, CancellationToken token); 15 | Task ExecuteUninstallAsync(IPackageDetails packageDetails, CancellationToken token); 16 | Task ExecuteUpdateAsync(IPackageDetails packageDetails, CancellationToken token); 17 | Task ExecuteUpdateAsync(IPackageDetails packageDetails, IDisposable packageOperationContext, CancellationToken token); 18 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Logging/Listeners/Base/NuGetToCatelLogTranslator.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using Catel.Logging; 4 | 5 | public class NuGetToCatelLogTranslator : PackageManagerLogListenerBase 6 | { 7 | private static readonly ILog Log = LogManager.GetCurrentClassLogger(); 8 | 9 | public NuGetToCatelLogTranslator(INuGetLogListeningSevice nuGetLogListeningSevice) 10 | : base(nuGetLogListeningSevice) 11 | { 12 | } 13 | 14 | protected override void OnInfo(object? sender, NuGetLogRecordEventArgs e) 15 | { 16 | Log.Info(e.Message); 17 | } 18 | 19 | protected override void OnDebug(object? sender, NuGetLogRecordEventArgs e) 20 | { 21 | Log.Debug(e.Message); 22 | } 23 | 24 | protected override void OnWarning(object? sender, NuGetLogRecordEventArgs e) 25 | { 26 | Log.Warning(e.Message); 27 | } 28 | 29 | protected override void OnError(object? sender, NuGetLogRecordEventArgs e) 30 | { 31 | Log.Error(e.Message); 32 | } 33 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Models/Interfaces/IPackageDetails.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using Catel.Data; 6 | using NuGet.Packaging.Core; 7 | using NuGet.Versioning; 8 | 9 | public interface IPackageDetails 10 | { 11 | string Id { get; } 12 | 13 | string FullName { get; } 14 | 15 | string Description { get; } 16 | 17 | Uri? IconUrl { get; } 18 | 19 | Version Version { get; } 20 | 21 | NuGetVersion NuGetVersion { get; } 22 | 23 | bool IsLatestVersion { get; } 24 | 25 | bool IsPrerelease { get; } 26 | 27 | string Title { get; } 28 | 29 | IEnumerable Authors { get; } 30 | 31 | DateTimeOffset? Published { get; } 32 | 33 | long? DownloadCount { get; } 34 | 35 | bool? IsInstalled { get; set; } 36 | 37 | string SelectedVersion { get; set; } 38 | 39 | IValidationContext? ValidationContext { get; set; } 40 | 41 | void ResetValidationContext(); 42 | 43 | PackageIdentity GetIdentity(); 44 | } 45 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Logging/Listeners/PackageManagerLogListenerBase.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | public abstract class PackageManagerLogListenerBase 6 | { 7 | protected PackageManagerLogListenerBase(INuGetLogListeningSevice nuGetLogListeningSevice) 8 | { 9 | ArgumentNullException.ThrowIfNull(nuGetLogListeningSevice); 10 | 11 | nuGetLogListeningSevice.Error += OnError; 12 | nuGetLogListeningSevice.Info += OnInfo; 13 | nuGetLogListeningSevice.Debug += OnDebug; 14 | nuGetLogListeningSevice.Warning += OnWarning; 15 | } 16 | 17 | protected virtual void OnWarning(object? sender, NuGetLogRecordEventArgs e) 18 | { 19 | } 20 | 21 | protected virtual void OnDebug(object? sender, NuGetLogRecordEventArgs e) 22 | { 23 | } 24 | 25 | protected virtual void OnInfo(object? sender, NuGetLogRecordEventArgs e) 26 | { 27 | } 28 | 29 | protected virtual void OnError(object? sender, NuGetLogRecordEventArgs e) 30 | { 31 | } 32 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/NuGet/Helpers/V2SearchHelper.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Threading.Tasks; 5 | using Catel.Logging; 6 | using NuGet.Protocol.Core.Types; 7 | 8 | //Helper for v2 NuGet - eager loading for packages versions from v2, because they failed later with NRE, since 9 | //lazyFactory inside ClonePackageSearchMetadata constains reference on CancellationToken used in SearchAsync 10 | public static class V2SearchHelper 11 | { 12 | private static readonly ILog Log = LogManager.GetCurrentClassLogger(); 13 | 14 | public static async Task GetVersionsMetadataAsync(IPackageSearchMetadata package) 15 | { 16 | ArgumentNullException.ThrowIfNull(package); 17 | 18 | try 19 | { 20 | await package.GetVersionsAsync(); 21 | } 22 | catch (Exception ex) 23 | { 24 | Log.Warning(ex, $"Cannot preload metadata for package {package.Identity.Id} of version {package.Identity.Version} from v2 feed due to error"); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /.github/workflows/build-and-test.yml: -------------------------------------------------------------------------------- 1 | name: Build and test 2 | 3 | on: 4 | push: 5 | branches: 6 | - develop 7 | - master 8 | pull_request: 9 | 10 | #permissions: 11 | #pull-requests: write 12 | #contents: write 13 | 14 | jobs: 15 | build-and-test: 16 | runs-on: windows-latest # Required for some (WPF) projects 17 | 18 | steps: 19 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 20 | id: checkout 21 | with: 22 | fetch-depth: 0 23 | 24 | - name: Setup .NET Core 25 | id: setup-dotnet 26 | uses: actions/setup-dotnet@2016bd2012dba4e32de620c46fe006a3ac9f0602 # v5.0.1 27 | with: 28 | dotnet-version: '10.0.x' 29 | 30 | - name: Cake Action 31 | id: cake-action 32 | uses: cake-build/cake-action@d218f1133bb74a1df0b08c89cfd8fc100c09e1a0 #v3.0.1 33 | with: 34 | target: BuildAndTest 35 | arguments: | 36 | IsCiBuild: true -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Themes/CompiledResources.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/DownloadResourceResultExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.IO; 5 | using NuGet.Protocol.Core.Types; 6 | 7 | public static class DownloadResourceResultExtensions 8 | { 9 | public static string GetResourceRoot(this DownloadResourceResult downloadResourceResult) 10 | { 11 | ArgumentNullException.ThrowIfNull(downloadResourceResult); 12 | 13 | if (downloadResourceResult.PackageStream is FileStream fileStream) 14 | { 15 | return fileStream.Name; 16 | } 17 | else 18 | { 19 | return downloadResourceResult.PackageSource ?? string.Empty; 20 | } 21 | } 22 | 23 | public static bool IsAvailable(this DownloadResourceResult downloadResourceResult) 24 | { 25 | ArgumentNullException.ThrowIfNull(downloadResourceResult); 26 | 27 | return downloadResourceResult.Status is DownloadResourceResultStatus.Available or DownloadResourceResultStatus.AvailableWithoutStream; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Views/PackageDetailsView.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Views; 2 | 3 | using System.Windows; 4 | using Catel.MVVM.Views; 5 | 6 | internal partial class PackageDetailsView 7 | { 8 | static PackageDetailsView() 9 | { 10 | typeof(PackageDetailsView).AutoDetectViewPropertiesToSubscribe(); 11 | 12 | } 13 | 14 | public PackageDetailsView() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | [ViewToViewModel(MappingType = ViewToViewModelMappingType.ViewToViewModel)] 20 | public NuGetPackage? Package 21 | { 22 | get { return (NuGetPackage?)GetValue(PackageProperty); } 23 | set { SetValue(PackageProperty, value); } 24 | } 25 | 26 | /// 27 | /// Identifies the dependency property. 28 | /// 29 | public static readonly DependencyProperty PackageProperty = DependencyProperty.Register( 30 | nameof(Package), typeof(NuGetPackage), typeof(PackageDetailsView), new PropertyMetadata(default(NuGetPackage))); 31 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Behaviors/UpdateSelectedItemSourceBehavior.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Behaviors; 2 | 3 | using System.Windows.Controls; 4 | using System.Windows.Controls.Primitives; 5 | using Catel.Windows.Interactivity; 6 | 7 | internal class UpdateSelectedItemSourceBehavior : BehaviorBase 8 | { 9 | protected override void OnAssociatedObjectLoaded() 10 | { 11 | base.OnAssociatedObjectLoaded(); 12 | 13 | AssociatedObject.SelectionChanged += OnIsVisibleChanged; 14 | } 15 | 16 | protected override void OnAssociatedObjectUnloaded() 17 | { 18 | AssociatedObject.SelectionChanged -= OnIsVisibleChanged; 19 | 20 | base.OnAssociatedObjectUnloaded(); 21 | } 22 | 23 | private void OnIsVisibleChanged(object sender, SelectionChangedEventArgs selectionChangedEventArgs) 24 | { 25 | var binding = AssociatedObject.GetBindingExpression(Selector.SelectedItemProperty); 26 | if (binding is not null) 27 | { 28 | binding.UpdateSource(); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/NuGet/Packaging/PackageCollection.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Packaging; 2 | 3 | using System; 4 | using System.Collections; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | 8 | public sealed class PackageCollection : IEnumerable 9 | { 10 | private readonly PackageCollectionItem[] _packages; 11 | 12 | private readonly ISet _uniqueIds = new HashSet(StringComparer.OrdinalIgnoreCase); 13 | 14 | public PackageCollection(PackageCollectionItem[] packages) 15 | { 16 | _packages = packages; 17 | _uniqueIds.UnionWith(_packages.Select(p => p.Id)); 18 | } 19 | 20 | public IEnumerator GetEnumerator() 21 | { 22 | return ((IEnumerable)_packages).GetEnumerator(); 23 | } 24 | 25 | IEnumerator IEnumerable.GetEnumerator() 26 | { 27 | return ((IEnumerable)_packages).GetEnumerator(); 28 | } 29 | 30 | public bool ContainsId(string packageId) => _uniqueIds.Contains(packageId); 31 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/INuGetConfigurationService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Collections.Generic; 4 | 5 | public interface INuGetConfigurationService 6 | { 7 | string GetDestinationFolder(); 8 | void SetDestinationFolder(string value); 9 | IEnumerable LoadPackageSources(bool onlyEnabled = false); 10 | 11 | bool SavePackageSource(string name, string source, bool isEnabled = true, bool isOfficial = true, bool verifyFeed = true); 12 | 13 | void DisablePackageSource(string name, string source); 14 | void SavePackageSources(IEnumerable packageSources); 15 | 16 | void SaveProjects(IEnumerable extensibleProjects); 17 | 18 | void SetPackageQuerySize(int size); 19 | int GetPackageQuerySize(); 20 | 21 | void SetIsPrereleaseAllowed(IRepository repository, bool value); 22 | bool GetIsPrereleaseAllowed(IRepository repository); 23 | 24 | void RemovePackageSource(IPackageSource source); 25 | 26 | bool IsProjectConfigured(IExtensibleProject project); 27 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Controls/Templating/BadgeContentTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Orc.NuGetExplorer.Controls.Templating; 3 | 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using NuGetExplorer.Enums; 7 | 8 | public class BadgeContentTemplateSelector : DataTemplateSelector 9 | { 10 | public DataTemplate? NotAvailable { get; set; } 11 | 12 | public DataTemplate? Available { get; set; } 13 | 14 | public DataTemplate? Default { get; set; } 15 | 16 | public override DataTemplate? SelectTemplate(object item, DependencyObject container) 17 | { 18 | if (item is not null) 19 | { 20 | var state = (PackageStatus)item; 21 | 22 | if (state == PackageStatus.LastVersionInstalled) 23 | { 24 | return NotAvailable; 25 | } 26 | if (state == PackageStatus.UpdateAvailable) 27 | { 28 | return Available; 29 | } 30 | 31 | return Default; 32 | } 33 | return base.SelectTemplate(item, container); 34 | } 35 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/DefaultExtensibleProjectProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management; 2 | 3 | using System; 4 | using Catel.IoC; 5 | 6 | internal class DefaultExtensibleProjectProvider : IDefaultExtensibleProjectProvider 7 | { 8 | private readonly IExtensibleProject _defaultProject; 9 | 10 | public DefaultExtensibleProjectProvider(ITypeFactory typeFactory, INuGetConfigurationService configurationService, IExtensibleProjectLocator extensibleProjectLocator) 11 | { 12 | ArgumentNullException.ThrowIfNull(typeFactory); 13 | ArgumentNullException.ThrowIfNull(configurationService); 14 | ArgumentNullException.ThrowIfNull(extensibleProjectLocator); 15 | 16 | _defaultProject = typeFactory.CreateRequiredInstanceWithParametersAndAutoCompletion(configurationService.GetDestinationFolder()); 17 | 18 | extensibleProjectLocator.Register(_defaultProject); 19 | extensibleProjectLocator.Enable(_defaultProject); 20 | } 21 | 22 | public IExtensibleProject GetDefaultProject() 23 | { 24 | return _defaultProject; 25 | } 26 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Example/Providers/NuGetProjectProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Example; 2 | 3 | using System; 4 | using Catel.IoC; 5 | using Orc.NuGetExplorer.Management; 6 | 7 | public class NuGetProjectProvider : IDefaultExtensibleProjectProvider 8 | { 9 | private readonly IExtensibleProjectLocator _extensibleProjectLocator; 10 | 11 | private readonly IExtensibleProject _defaultProject; 12 | 13 | public NuGetProjectProvider(IExtensibleProjectLocator extensibleProjectLocator, ITypeFactory typeFactory) 14 | { 15 | ArgumentNullException.ThrowIfNull(extensibleProjectLocator); 16 | ArgumentNullException.ThrowIfNull(typeFactory); 17 | 18 | _extensibleProjectLocator = extensibleProjectLocator; 19 | 20 | _defaultProject = typeFactory.CreateInstanceWithParametersAndAutoCompletion(); 21 | 22 | _extensibleProjectLocator.Register(_defaultProject); 23 | _extensibleProjectLocator.Enable(_defaultProject); 24 | } 25 | 26 | public IExtensibleProject GetDefaultProject() 27 | { 28 | return _defaultProject; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/UriExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.IO; 5 | using Catel.Logging; 6 | 7 | public static class UriExtensions 8 | { 9 | private static readonly ILog Log = LogManager.GetCurrentClassLogger(); 10 | 11 | public static Uri GetRootUri(this Uri uri) 12 | { 13 | ArgumentNullException.ThrowIfNull(uri); 14 | 15 | return new Uri(uri.GetComponents(UriComponents.SchemeAndServer, UriFormat.SafeUnescaped)); 16 | } 17 | 18 | public static Uri? GetLocalUriForFragment(this Uri uri) 19 | { 20 | ArgumentNullException.ThrowIfNull(uri); 21 | 22 | if (string.IsNullOrEmpty(uri.Fragment)) 23 | { 24 | return null; 25 | } 26 | 27 | var fileName = uri.Fragment[1..]; 28 | var folderPath = Path.GetDirectoryName(uri.LocalPath); 29 | if (!string.IsNullOrEmpty(folderPath)) 30 | { 31 | return new Uri(Path.Combine(folderPath, fileName)); 32 | } 33 | 34 | Log.Debug("Cannot parse source uri for local icon"); 35 | return null; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Extensions/ObservableCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.ObjectModel; 5 | 6 | public static class ObservableCollectionExtensions 7 | { 8 | public static void MoveUp(this ObservableCollection collection, T item) 9 | where T : notnull 10 | { 11 | ArgumentNullException.ThrowIfNull(collection); 12 | ArgumentNullException.ThrowIfNull(item); 13 | 14 | var oldindex = collection.IndexOf(item); 15 | if (oldindex == 0) 16 | { 17 | return; 18 | } 19 | 20 | collection.Move(oldindex, oldindex - 1); 21 | } 22 | 23 | public static void MoveDown(this ObservableCollection collection, T item) 24 | where T : notnull 25 | { 26 | ArgumentNullException.ThrowIfNull(collection); 27 | ArgumentNullException.ThrowIfNull(item); 28 | 29 | var oldindex = collection.IndexOf(item); 30 | 31 | if (oldindex == collection.Count - 1) 32 | { 33 | return; 34 | } 35 | 36 | collection.Move(oldindex, oldindex + 1); 37 | } 38 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Views/DependenciesView.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Views; 2 | 3 | using System.Windows; 4 | using Catel.MVVM.Views; 5 | using Catel.Windows.Controls; 6 | 7 | /// 8 | /// Interaction logic for DependenciesView.xaml 9 | /// 10 | internal partial class DependenciesView : UserControl 11 | { 12 | static DependenciesView() 13 | { 14 | typeof(DependenciesView).AutoDetectViewPropertiesToSubscribe(); 15 | } 16 | 17 | public DependenciesView() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | [ViewToViewModel("Collection", MappingType = ViewToViewModelMappingType.TwoWayViewWins)] 23 | public object? Collection 24 | { 25 | get { return GetValue(CollectionProperty); } 26 | set { SetValue(CollectionProperty, value); } 27 | } 28 | 29 | /// 30 | /// Identifies the dependency property. 31 | /// 32 | public static readonly DependencyProperty CollectionProperty = 33 | DependencyProperty.Register(nameof(Collection), typeof(object), typeof(DependenciesView), new PropertyMetadata(null)); 34 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Web/IconDownloader.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Web; 2 | 3 | using System; 4 | using System.Net; 5 | using System.Threading.Tasks; 6 | using Catel.Logging; 7 | 8 | public class IconDownloader 9 | { 10 | private static readonly ILog Log = LogManager.GetCurrentClassLogger(); 11 | 12 | public IconDownloader() 13 | { 14 | SetProtocolSecurity(); 15 | } 16 | 17 | public static async Task GetByUrlAsync(Uri uri, WebClient client) 18 | { 19 | Log.Debug($"Webclient request on {uri}"); 20 | 21 | var array = await client.DownloadDataTaskAsync(uri); 22 | 23 | return array; 24 | } 25 | 26 | public static byte[] GetByUrl(Uri uri, WebClient client) 27 | { 28 | Log.Debug($"Webclient request on {uri}"); 29 | 30 | var array = client.DownloadData(uri); 31 | 32 | return array; 33 | } 34 | 35 | private static void SetProtocolSecurity() 36 | { 37 | #if NET8 38 | // Note: ignore if not .net 9 or higher 39 | ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13; 40 | #endif 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Views/NuGetSettingsWindow.xaml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Providers/ModelProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Providers; 2 | 3 | using System; 4 | using System.ComponentModel; 5 | using Catel.Data; 6 | using Catel.IoC; 7 | 8 | public class ModelProvider : IModelProvider where T : ModelBase 9 | { 10 | private readonly ITypeFactory _typeFactory; 11 | 12 | public ModelProvider(ITypeFactory typeFactory) 13 | { 14 | ArgumentNullException.ThrowIfNull(typeFactory); 15 | 16 | _typeFactory = typeFactory; 17 | } 18 | 19 | private T? _model; 20 | 21 | public virtual T? Model 22 | { 23 | get => _model; 24 | set 25 | { 26 | if (value != _model) 27 | { 28 | _model = value; 29 | RaisePropertyChanged(); 30 | } 31 | } 32 | } 33 | 34 | public event PropertyChangedEventHandler? PropertyChanged; 35 | 36 | public virtual T Create() 37 | { 38 | return _typeFactory.CreateRequiredInstance(); 39 | } 40 | 41 | private void RaisePropertyChanged() 42 | { 43 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Model))); 44 | } 45 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Watchers/Base/PackageManagerContextWatcherBase.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Linq; 5 | 6 | public abstract class PackageManagerContextWatcherBase : PackageManagerWatcherBase 7 | { 8 | private readonly IPackageOperationContextService _packageOperationContextService; 9 | 10 | protected PackageManagerContextWatcherBase(IPackageOperationNotificationService packageOperationNotificationService, IPackageOperationContextService packageOperationContextService) 11 | : base(packageOperationNotificationService) 12 | { 13 | ArgumentNullException.ThrowIfNull(packageOperationContextService); 14 | 15 | _packageOperationContextService = packageOperationContextService; 16 | 17 | _packageOperationContextService.OperationContextDisposing += OnOperationContextDisposing; 18 | } 19 | 20 | public bool HasContextErrors => CurrentContext?.Exceptions?.Any() ?? false; 21 | 22 | public IPackageOperationContext? CurrentContext => _packageOperationContextService.CurrentContext; 23 | 24 | protected virtual void OnOperationContextDisposing(object? sender, OperationContextEventArgs e) 25 | { 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | public static class StringExtensions 7 | { 8 | public static string GetSafeScopeName(this string? value) 9 | { 10 | if (value is null) 11 | { 12 | return "null"; 13 | } 14 | 15 | return value.ToLower(); 16 | } 17 | 18 | public static IList SplitOrEmpty(this string value, char separator = ',') 19 | { 20 | if (!string.IsNullOrWhiteSpace(value)) 21 | { 22 | return value.Split(separator); 23 | } 24 | 25 | return new List(); 26 | } 27 | 28 | public static bool ContainsAny(this string value, string[] str, StringComparison comparisonType) 29 | { 30 | ArgumentNullException.ThrowIfNull(value); 31 | ArgumentNullException.ThrowIfNull(str); 32 | 33 | for (var i = 0; i < str.Length; i++) 34 | { 35 | var s = str[i]; 36 | if (value.Contains(s, comparisonType)) 37 | { 38 | return true; 39 | } 40 | } 41 | return false; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Providers/NuGetPackageSourceProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System.Collections.Generic; 4 | using Catel.Logging; 5 | using NuGet.Configuration; 6 | using Orc.NuGetExplorer.Configuration; 7 | 8 | internal class NuGetPackageSourceProvider : PackageSourceProvider 9 | { 10 | private static readonly ILog Log = LogManager.GetCurrentClassLogger(); 11 | private readonly ISettings _settingsManager; 12 | 13 | public NuGetPackageSourceProvider(ISettings settingsManager, IDefaultPackageSourcesProvider defaultPackageSourcesProvider) 14 | : base(settingsManager, defaultPackageSourcesProvider.GetDefaultPackages().ToPackageSourceInstances()) 15 | { 16 | _settingsManager = settingsManager; 17 | } 18 | 19 | public void SortPackageSources(List packageSourceNames) 20 | { 21 | if (_settingsManager is NuGetSettings nugetSettings) 22 | { 23 | nugetSettings.UpdatePackageSourcesKeyListSorting(packageSourceNames); 24 | } 25 | else 26 | { 27 | Log.Debug($"Sorting operation for NuGet Settings source of type {_settingsManager.GetType()} is not implemented"); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/MethodTimeLogger.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Catel.Logging; 3 | using System; 4 | using System.Globalization; 5 | 6 | /// 7 | /// Note: do not rename this class or put it inside a namespace. 8 | /// 9 | internal static class MethodTimeLogger 10 | { 11 | public static void Log(MethodBase methodBase, long milliseconds, string message) 12 | { 13 | Log(methodBase.DeclaringType ?? typeof(object), methodBase.Name, milliseconds, message); 14 | } 15 | 16 | public static void Log(Type type, string methodName, long milliseconds, string message) 17 | { 18 | if (type is null) 19 | { 20 | return; 21 | } 22 | 23 | if (milliseconds == 0) 24 | { 25 | // Don't log superfast methods 26 | return; 27 | } 28 | 29 | var finalMessage = $"[METHODTIMER] {type.Name}.{methodName} took '{milliseconds.ToString(CultureInfo.InvariantCulture)}' ms"; 30 | 31 | if (!string.IsNullOrWhiteSpace(message)) 32 | { 33 | finalMessage += $" | {message}"; 34 | } 35 | 36 | var logger = LogManager.GetLogger(type); 37 | logger.Debug(finalMessage); 38 | } 39 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Views/ProjectsView.xaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/Directory.Build.shared.tests.props: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | false 10 | true 11 | true 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/EventArgs/UpdateNuGetProjectEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management; 2 | 3 | using System.Collections.Generic; 4 | using NuGet.Packaging.Core; 5 | using NuGet.Versioning; 6 | 7 | public class UpdateNuGetProjectEventArgs : NuGetProjectEventArgs 8 | { 9 | public UpdateNuGetProjectEventArgs(IExtensibleProject project, PackageIdentity package) 10 | : base(project, package) 11 | { 12 | RemovedVersions = new List(); 13 | } 14 | 15 | public UpdateNuGetProjectEventArgs(IExtensibleProject project, PackageIdentity beforeUpdate, IEnumerable updateEventArgs) 16 | : this(project, beforeUpdate) 17 | { 18 | foreach (var arg in updateEventArgs) 19 | { 20 | if (arg is UninstallNuGetProjectEventArgs) 21 | { 22 | RemovedVersions.Add(arg.Package.Version); 23 | } 24 | 25 | if (arg is InstallNuGetProjectEventArgs) 26 | { 27 | InstalledVersion = arg.Package.Version; 28 | } 29 | } 30 | } 31 | 32 | public List RemovedVersions { get; set; } 33 | 34 | public NuGetVersion? InstalledVersion { get; set; } 35 | } -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Description of Change ### 2 | 3 | 4 | 5 | ### Issues Resolved ### 6 | 7 | 8 | 9 | - fixes # 10 | 11 | ### API Changes ### 12 | 13 | 14 | 15 | None 16 | 17 | ### Behavioral Changes ### 18 | 19 | 20 | 21 | None 22 | 23 | ### Testing Procedure ### 24 | 25 | 26 | 27 | ### PR Checklist ### 28 | 29 | - [ ] I have included examples or tests 30 | - [ ] I have updated the change log or created a GitHub ticket with the change 31 | - [ ] I am listed in the CONTRIBUTORS file (if it exists) 32 | - [ ] Changes adhere to coding standard 33 | - [ ] I checked the licenses of Third Party software and discussed new dependencies with at least 1 other team member -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Views/NuGetSettingsWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Views; 2 | 3 | using System; 4 | using Catel.IoC; 5 | using Catel.Services; 6 | using Catel.Windows; 7 | using Orc.Controls; 8 | using Orc.NuGetExplorer.ViewModels; 9 | 10 | /// 11 | /// Interaction logic for SettingsWindow.xaml 12 | /// 13 | internal partial class NuGetSettingsWindow : DataWindow 14 | { 15 | public NuGetSettingsWindow() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | public NuGetSettingsWindow(NuGetSettingsViewModel viewModel) 21 | : base(viewModel, DataWindowMode.OkCancel) 22 | { 23 | Title = viewModel.Title; 24 | 25 | InitializeComponent(); 26 | } 27 | 28 | protected override void OnLoaded(EventArgs e) 29 | { 30 | base.OnLoaded(e); 31 | 32 | var appDataService = ServiceLocator.Default.ResolveRequiredType(); 33 | appDataService?.LoadWindowSize(this, true); 34 | } 35 | 36 | protected override void OnUnloaded(EventArgs e) 37 | { 38 | var appDataService = ServiceLocator.Default.ResolveRequiredType(); 39 | appDataService?.SaveWindowSize(this); 40 | 41 | base.OnUnloaded(e); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Pagination/DeferToken.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Pagination; 2 | 3 | using System; 4 | using NuGet.Protocol.Core.Types; 5 | using Orc.NuGetExplorer.Enums; 6 | 7 | public class DeferToken 8 | { 9 | public DeferToken(MetadataOrigin loadType, NuGetPackage nuGetPackage) 10 | { 11 | LoadType = DetermineLoadBehavior(loadType); 12 | Package = nuGetPackage; 13 | } 14 | 15 | public Func? PackageSelector { get; set; } 16 | 17 | /// 18 | /// Determines type of source which should be sought for state acquiring 19 | /// 20 | public MetadataOrigin LoadType { get; private set; } 21 | 22 | public NuGetPackage Package { get; set; } 23 | 24 | public IPackageSearchMetadata? Result { get; set; } 25 | 26 | public Action? UpdateAction { get; set; } 27 | 28 | private static MetadataOrigin DetermineLoadBehavior(MetadataOrigin page) 29 | { 30 | switch (page) 31 | { 32 | case MetadataOrigin.Browse: 33 | return MetadataOrigin.Installed; 34 | 35 | case MetadataOrigin.Installed: 36 | return MetadataOrigin.Browse; 37 | } 38 | 39 | return MetadataOrigin.Browse; 40 | } 41 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Watchers/Base/PackageManagerWatcherBase.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | public abstract class PackageManagerWatcherBase 6 | { 7 | protected PackageManagerWatcherBase(IPackageOperationNotificationService packageOperationNotificationService) 8 | { 9 | ArgumentNullException.ThrowIfNull(packageOperationNotificationService); 10 | 11 | packageOperationNotificationService.OperationStarting += OnOperationStarting; 12 | packageOperationNotificationService.OperationFinished += OnOperationFinished; 13 | packageOperationNotificationService.OperationsBatchStarting += OnOperationsBatchStarting; 14 | packageOperationNotificationService.OperationsBatchFinished += OnOperationsBatchFinished; 15 | } 16 | 17 | protected virtual void OnOperationsBatchFinished(object? sender, PackageOperationBatchEventArgs e) 18 | { 19 | } 20 | 21 | protected virtual void OnOperationsBatchStarting(object? sender, PackageOperationBatchEventArgs e) 22 | { 23 | } 24 | 25 | protected virtual void OnOperationFinished(object? sender, PackageOperationEventArgs e) 26 | { 27 | } 28 | 29 | protected virtual void OnOperationStarting(object? sender, PackageOperationEventArgs e) 30 | { 31 | } 32 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Logging/Services/NuGetLogListeningSevice.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using Catel; 5 | 6 | internal class NuGetLogListeningSevice : INuGetLogListeningSevice 7 | { 8 | public void SendInfo(string message) 9 | { 10 | Argument.IsNotNullOrEmpty(() => message); 11 | 12 | Info?.Invoke(this, new NuGetLogRecordEventArgs(message)); 13 | } 14 | 15 | public void SendWarning(string message) 16 | { 17 | Argument.IsNotNullOrEmpty(() => message); 18 | 19 | Warning?.Invoke(this, new NuGetLogRecordEventArgs(message)); 20 | } 21 | 22 | public void SendDebug(string message) 23 | { 24 | Argument.IsNotNullOrEmpty(() => message); 25 | 26 | Debug?.Invoke(this, new NuGetLogRecordEventArgs(message)); 27 | } 28 | 29 | public void SendError(string message) 30 | { 31 | Argument.IsNotNullOrEmpty(() => message); 32 | 33 | Error?.Invoke(this, new NuGetLogRecordEventArgs(message)); 34 | } 35 | 36 | public event EventHandler? Info; 37 | public event EventHandler? Warning; 38 | public event EventHandler? Debug; 39 | public event EventHandler? Error; 40 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/PublicApiFacts.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Tests; 2 | 3 | using System.Reflection; 4 | using System.Runtime.CompilerServices; 5 | using System.Threading.Tasks; 6 | using NUnit.Framework; 7 | using Orc.NuGetExplorer.Services; 8 | using PublicApiGenerator; 9 | using VerifyNUnit; 10 | 11 | [TestFixture] 12 | public class PublicApiFacts 13 | { 14 | [Test, MethodImpl(MethodImplOptions.NoInlining)] 15 | public async Task Orc_NuGetExplorer_HasNoBreakingChanges_Async() 16 | { 17 | var assembly = typeof(DefferedPackageLoaderService).Assembly; 18 | 19 | await PublicApiApprover.ApprovePublicApiAsync(assembly); 20 | } 21 | 22 | [Test, MethodImpl(MethodImplOptions.NoInlining)] 23 | public async Task Orc_NuGetExplorer_Xaml_HasNoBreakingChanges_Async() 24 | { 25 | var assembly = typeof(XamlPleaseWaitInterruptService).Assembly; 26 | 27 | await PublicApiApprover.ApprovePublicApiAsync(assembly); 28 | } 29 | internal static class PublicApiApprover 30 | { 31 | public static async Task ApprovePublicApiAsync(Assembly assembly) 32 | { 33 | var publicApi = ApiGenerator.GeneratePublicApi(assembly, new ApiGeneratorOptions()); 34 | await Verifier.Verify(publicApi); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Synchronization/SynchronizationContextScopeManager.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Threading; 5 | using Catel.Logging; 6 | 7 | public class SynchronizationContextScopeManager 8 | { 9 | private static readonly ILog Log = LogManager.GetCurrentClassLogger(); 10 | 11 | public static IDisposable OutOfContext() 12 | { 13 | if (SynchronizationContext.Current is null) 14 | { 15 | throw Log.ErrorAndCreateException("Invalid synchronization context"); 16 | } 17 | var token = new SynchronizationDisabilityToken(SynchronizationContext.Current); 18 | 19 | SynchronizationContext.SetSynchronizationContext(null); 20 | 21 | return token; 22 | } 23 | 24 | private struct SynchronizationDisabilityToken : IDisposable 25 | { 26 | private readonly SynchronizationContext _synchContext; 27 | 28 | public SynchronizationDisabilityToken(SynchronizationContext currentContext) 29 | { 30 | _synchContext = currentContext; 31 | } 32 | 33 | public void Dispose() 34 | { 35 | // Restore context; 36 | SynchronizationContext.SetSynchronizationContext(_synchContext); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /.github/lock.yml: -------------------------------------------------------------------------------- 1 | # Configuration for Lock Threads - https://github.com/dessant/lock-threads 2 | 3 | # Number of days of inactivity before a closed issue or pull request is locked 4 | daysUntilLock: 4 5 | 6 | # Skip issues and pull requests created before a given timestamp. Timestamp must 7 | # follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable 8 | skipCreatedBefore: false 9 | 10 | # Issues and pull requests with these labels will be ignored. Set to `[]` to disable 11 | exemptLabels: ["pinned", "planned"] 12 | 13 | # Label to add before locking, such as `outdated`. Set to `false` to disable 14 | lockLabel: false 15 | 16 | # Comment to post before locking. Set to `false` to disable 17 | lockComment: > 18 | This thread has been automatically locked since there has not been 19 | any recent activity after it was closed. Please open a new issue for 20 | related bugs. 21 | 22 | # Assign `resolved` as the reason for locking. Set to `false` to disable 23 | setLockReason: true 24 | 25 | # Limit to only `issues` or `pulls` 26 | # only: issues 27 | 28 | # Optionally, specify configuration settings just for `issues` or `pulls` 29 | # issues: 30 | # exemptLabels: 31 | # - help-wanted 32 | # lockLabel: outdated 33 | 34 | # pulls: 35 | # daysUntilLock: 30 36 | 37 | # Repository to extend settings from 38 | # _extends: repo -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Converters/PackageStatusEnumToBrushConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Converters; 2 | 3 | using System; 4 | using System.Windows.Media; 5 | using Catel.MVVM.Converters; 6 | using NuGetExplorer.Enums; 7 | 8 | [System.Windows.Data.ValueConversion(typeof(PackageStatus), typeof(Brush))] 9 | public class PackageStatusEnumToBrushConverter : ValueConverterBase 10 | { 11 | private static readonly int Offset = -1; 12 | private readonly Themes.Brushes _resourceDictionary; 13 | 14 | public PackageStatusEnumToBrushConverter() 15 | { 16 | _resourceDictionary = new Themes.Brushes(); 17 | 18 | _resourceDictionary.InitializeComponent(); 19 | } 20 | 21 | protected override object Convert(PackageStatus value, Type targetType, object? parameter) 22 | { 23 | if (parameter is not string[] resourceKeys) 24 | { 25 | return new SolidColorBrush(Colors.Transparent); 26 | } 27 | 28 | var keyIndex = (int)value - Offset; 29 | 30 | if (keyIndex >= 0 && keyIndex < resourceKeys.Length) 31 | { 32 | var brushResource = _resourceDictionary[resourceKeys[keyIndex]]; 33 | 34 | return brushResource; 35 | } 36 | 37 | return new SolidColorBrush(Colors.Transparent); 38 | } 39 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Configuration/NuGetSettingsSection.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Orc.NuGetExplorer.Configuration; 3 | 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using Catel.Reflection; 7 | using NuGet.Configuration; 8 | 9 | internal class NuGetSettingsSection : SettingSection 10 | { 11 | /// 12 | /// Empty settings section 13 | /// 14 | /// 15 | public NuGetSettingsSection(string name) 16 | : base(name, new Dictionary(), new List()) 17 | { 18 | 19 | } 20 | 21 | /// 22 | /// Settings section without attributes 23 | /// 24 | /// 25 | /// 26 | public NuGetSettingsSection(string name, IEnumerable children) 27 | : base(name, new Dictionary(), children) 28 | { 29 | 30 | } 31 | 32 | public NuGetSettingsSection(string name, IReadOnlyDictionary attributes, IEnumerable children) 33 | : base(name, attributes, children) 34 | { 35 | } 36 | 37 | public override SettingBase Clone() 38 | { 39 | return new NuGetSettingsSection(ElementName, Items.Select(child => child.Clone().CastTo())); 40 | } 41 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/HttpHandlerResourceV3Extensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using Catel.Logging; 5 | using NuGet.Configuration; 6 | using NuGet.Protocol; 7 | 8 | public static class HttpHandlerResourceV3Extensions 9 | { 10 | private static readonly ILog Log = LogManager.GetCurrentClassLogger(); 11 | 12 | public static T GetCredentialServiceImplementation(this HttpHandlerResourceV3 httpResourceHandler) 13 | where T : class, ICredentialService 14 | { 15 | ArgumentNullException.ThrowIfNull(httpResourceHandler); 16 | 17 | if (HttpHandlerResourceV3.CredentialService is not null) 18 | { 19 | return (T)HttpHandlerResourceV3.CredentialService.Value; 20 | } 21 | 22 | throw Log.ErrorAndCreateException("CredentialService is null"); 23 | } 24 | 25 | public static void ResetCredentials(this HttpHandlerResourceV3 httpResourceHandler) 26 | { 27 | ArgumentNullException.ThrowIfNull(httpResourceHandler); 28 | 29 | var credentialsService = httpResourceHandler.GetCredentialServiceImplementation(); 30 | 31 | if (credentialsService is not null) 32 | { 33 | credentialsService.ClearRetryCache(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /deployment/cake/templates-variables.cake: -------------------------------------------------------------------------------- 1 | #l "buildserver.cake" 2 | 3 | //------------------------------------------------------------- 4 | 5 | public class TemplatesContext : BuildContextWithItemsBase 6 | { 7 | public TemplatesContext(IBuildContext parentBuildContext) 8 | : base(parentBuildContext) 9 | { 10 | } 11 | 12 | protected override void ValidateContext() 13 | { 14 | 15 | } 16 | 17 | protected override void LogStateInfoForContext() 18 | { 19 | CakeContext.Information($"Found '{Items.Count}' template items"); 20 | } 21 | } 22 | 23 | //------------------------------------------------------------- 24 | 25 | private TemplatesContext InitializeTemplatesContext(BuildContext buildContext, IBuildContext parentBuildContext) 26 | { 27 | var data = new TemplatesContext(parentBuildContext) 28 | { 29 | Items = Templates ?? new List(), 30 | }; 31 | 32 | return data; 33 | } 34 | 35 | //------------------------------------------------------------- 36 | 37 | List _templates; 38 | 39 | public List Templates 40 | { 41 | get 42 | { 43 | if (_templates is null) 44 | { 45 | _templates = new List(); 46 | } 47 | 48 | return _templates; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/Services/UpdatePackagesLoaderServiceFacts.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Tests.Services 2 | { 3 | using System; 4 | using Moq; 5 | using NuGet.Frameworks; 6 | 7 | public partial class UpdatePackagesLoaderServiceFacts 8 | { 9 | public static Mock CreateDefaultNuGetFrameworkMock() 10 | { 11 | var defaultNuGetFrameworkMock = new Mock(); 12 | defaultNuGetFrameworkMock.Setup(x => x.GetHighest()) 13 | .Returns(() => 14 | { 15 | return new[] 16 | { 17 | new NuGetFramework(".NETFramework", new Version(4, 7, 2)), 18 | new NuGetFramework(".NETCoreApp", new Version(8, 0)) 19 | }; 20 | }); 21 | 22 | return defaultNuGetFrameworkMock; 23 | } 24 | 25 | public static Mock CreateLocalRepositoryMock() 26 | { 27 | var localRepositoryMock = new Mock(); 28 | localRepositoryMock.Setup(x => x.Source) 29 | .Returns(() => string.Empty); 30 | localRepositoryMock.Setup(x => x.IsLocal) 31 | .Returns(() => true); 32 | 33 | return localRepositoryMock; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /deployment/cake/issuetrackers.cake: -------------------------------------------------------------------------------- 1 | // Customize this file when using a different issue tracker 2 | #l "issuetrackers-github.cake" 3 | #l "issuetrackers-jira.cake" 4 | 5 | //------------------------------------------------------------- 6 | 7 | public interface IIssueTracker 8 | { 9 | Task CreateAndReleaseVersionAsync(); 10 | } 11 | 12 | //------------------------------------------------------------- 13 | 14 | public class IssueTrackerIntegration : IntegrationBase 15 | { 16 | private readonly List _issueTrackers = new List(); 17 | 18 | public IssueTrackerIntegration(BuildContext buildContext) 19 | : base(buildContext) 20 | { 21 | _issueTrackers.Add(new GitHubIssueTracker(buildContext)); 22 | _issueTrackers.Add(new JiraIssueTracker(buildContext)); 23 | } 24 | 25 | public async Task CreateAndReleaseVersionAsync() 26 | { 27 | BuildContext.CakeContext.LogSeparator("Creating and releasing version"); 28 | 29 | foreach (var issueTracker in _issueTrackers) 30 | { 31 | try 32 | { 33 | await issueTracker.CreateAndReleaseVersionAsync(); 34 | } 35 | catch (Exception ex) 36 | { 37 | BuildContext.CakeContext.Error(ex.Message); 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Web/HttpWebExceptionHandler.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Web; 2 | 3 | using System; 4 | using System.Net; 5 | using Catel.Logging; 6 | 7 | public class HttpWebExceptionHandler : IHttpExceptionHandler 8 | { 9 | private static readonly ILog Log = LogManager.GetCurrentClassLogger(); 10 | 11 | public FeedVerificationResult HandleException(WebException exception, string source) 12 | { 13 | ArgumentNullException.ThrowIfNull(exception); 14 | 15 | try 16 | { 17 | var httpWebResponse = (HttpWebResponse?)exception.Response; 18 | if (httpWebResponse is null) 19 | { 20 | return FeedVerificationResult.Invalid; 21 | } 22 | 23 | // 403 error 24 | if (httpWebResponse.StatusCode == HttpStatusCode.Forbidden) 25 | { 26 | return FeedVerificationResult.AuthorizationRequired; 27 | } 28 | 29 | // 401 error 30 | if (httpWebResponse.StatusCode == HttpStatusCode.Unauthorized) 31 | { 32 | return FeedVerificationResult.AuthenticationRequired; 33 | } 34 | } 35 | catch (Exception ex) 36 | { 37 | Log.Debug(ex, "Failed to verify feed '{0}'", source); 38 | } 39 | 40 | return FeedVerificationResult.Invalid; 41 | } 42 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Models/NuGetActionTarget.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ComponentModel; 6 | using Catel.Data; 7 | 8 | public class NuGetActionTarget : ModelBase 9 | { 10 | private readonly List _extensibleProjects = new(); 11 | 12 | public IReadOnlyList TargetProjects => _extensibleProjects; 13 | 14 | /// 15 | /// Disable ability to see and change target project for commands 16 | /// 17 | public bool IsTargetProjectCanBeChanged => false; 18 | 19 | public bool IsValid { get; private set; } 20 | 21 | public void Add(IExtensibleProject project) 22 | { 23 | ArgumentNullException.ThrowIfNull(project); 24 | 25 | _extensibleProjects.Add(project); 26 | 27 | RaisePropertyChanged(nameof(TargetProjects)); 28 | } 29 | 30 | public void Remove(IExtensibleProject project) 31 | { 32 | ArgumentNullException.ThrowIfNull(project); 33 | 34 | _extensibleProjects.Remove(project); 35 | 36 | RaisePropertyChanged(nameof(TargetProjects)); 37 | } 38 | 39 | protected override void OnPropertyChanged(PropertyChangedEventArgs e) 40 | { 41 | if (string.Equals(e.PropertyName, nameof(TargetProjects))) 42 | { 43 | IsValid = _extensibleProjects.Count > 0; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/MultilingualResources/Orc.NuGetExplorer.de.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 |
7 | 8 | 9 | 10 | Failed to install package '{0}'. 11 | {1} 12 | 13 | 14 | 15 | No package sources provided for installing package '{0}' 16 | 17 | 18 | 19 | 20 |
21 |
-------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/MultilingualResources/Orc.NuGetExplorer.es.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 |
7 | 8 | 9 | 10 | Failed to install package '{0}'. 11 | {1} 12 | 13 | 14 | 15 | No package sources provided for installing package '{0}' 16 | 17 | 18 | 19 | 20 |
21 |
-------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/MultilingualResources/Orc.NuGetExplorer.fr.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 |
7 | 8 | 9 | 10 | Failed to install package '{0}'. 11 | {1} 12 | 13 | 14 | 15 | No package sources provided for installing package '{0}' 16 | 17 | 18 | 19 | 20 |
21 |
-------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/MultilingualResources/Orc.NuGetExplorer.nl.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 |
7 | 8 | 9 | 10 | Failed to install package '{0}'. 11 | {1} 12 | 13 | 14 | 15 | No package sources provided for installing package '{0}' 16 | 17 | 18 | 19 | 20 |
21 |
-------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/MultilingualResources/Orc.NuGetExplorer.ru.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 |
7 | 8 | 9 | 10 | Failed to install package '{0}'. 11 | {1} 12 | 13 | 14 | 15 | No package sources provided for installing package '{0}' 16 | 17 | 18 | 19 | 20 |
21 |
-------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/ViewModels/FeedDetailViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.ViewModels; 2 | 3 | using System; 4 | using Catel.MVVM; 5 | using Microsoft.WindowsAPICodePack.Dialogs; 6 | 7 | public class FeedDetailViewModel : ViewModelBase 8 | { 9 | public FeedDetailViewModel(NuGetFeed feed) 10 | { 11 | ArgumentNullException.ThrowIfNull(feed); 12 | 13 | Feed = feed; 14 | OpenChooseLocalPathToSourceDialog = new Command(OnOpenChooseLocalPathToSourceDialogExecute, OnOpenChooseLocalPathToSourceDialogCanExecute); 15 | } 16 | 17 | [Model] 18 | public NuGetFeed Feed { get; set; } 19 | 20 | [ViewModelToModel] 21 | public string? Name { get; set; } 22 | 23 | [ViewModelToModel] 24 | public string? Source { get; set; } 25 | 26 | public Command OpenChooseLocalPathToSourceDialog { get; set; } 27 | 28 | private void OnOpenChooseLocalPathToSourceDialogExecute() 29 | { 30 | using (var folderDialog = new CommonOpenFileDialog()) 31 | { 32 | folderDialog.InitialDirectory = @"C:\Users"; 33 | folderDialog.IsFolderPicker = true; 34 | 35 | if (folderDialog.ShowDialog() == CommonFileDialogResult.Ok) 36 | { 37 | Source = folderDialog.FileName; 38 | } 39 | } 40 | } 41 | 42 | private bool OnOpenChooseLocalPathToSourceDialogCanExecute() 43 | { 44 | return Feed is not null; 45 | } 46 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Behaviors/LoadItemsOnDropDownBehavior.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Behaviors; 2 | 3 | using System; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using Catel.MVVM; 7 | 8 | internal class LoadItemsOnDropDownBehavior : Catel.Windows.Interactivity.BehaviorBase 9 | { 10 | protected override void OnAssociatedObjectLoaded() 11 | { 12 | AssociatedObject.DropDownOpened += OnAssociatedObjectDropDownOpened; 13 | } 14 | 15 | private void OnAssociatedObjectDropDownOpened(object? sender, EventArgs e) 16 | { 17 | ExecuteItemSourceInitializationCommand(); 18 | } 19 | 20 | public Command? Command 21 | { 22 | get { return (Command?)GetValue(CommandProperty); } 23 | set { SetValue(CommandProperty, value); } 24 | } 25 | 26 | /// 27 | /// Identifies the 28 | /// dependency property. 29 | public static readonly DependencyProperty CommandProperty = 30 | DependencyProperty.Register(nameof(Command), typeof(Command), typeof(LoadItemsOnDropDownBehavior), new PropertyMetadata(null)); 31 | 32 | private void ExecuteItemSourceInitializationCommand() 33 | { 34 | using (SynchronizationContextScopeManager.OutOfContext()) 35 | { 36 | ExecuteCommand(); 37 | } 38 | } 39 | 40 | private void ExecuteCommand() 41 | { 42 | Command?.Execute(); 43 | } 44 | } -------------------------------------------------------------------------------- /deployment/cake/codesigning-variables.cake: -------------------------------------------------------------------------------- 1 | #l "buildserver.cake" 2 | 3 | //------------------------------------------------------------- 4 | 5 | public class CodeSigningContext : BuildContextBase 6 | { 7 | public CodeSigningContext(IBuildContext parentBuildContext) 8 | : base(parentBuildContext) 9 | { 10 | } 11 | 12 | public List ProjectsToSignImmediately { get; set; } 13 | 14 | protected override void ValidateContext() 15 | { 16 | 17 | } 18 | 19 | protected override void LogStateInfoForContext() 20 | { 21 | //CakeContext.Information($"Found '{Items.Count}' component projects"); 22 | } 23 | } 24 | 25 | //------------------------------------------------------------- 26 | 27 | private CodeSigningContext InitializeCodeSigningContext(BuildContext buildContext, IBuildContext parentBuildContext) 28 | { 29 | var data = new CodeSigningContext(parentBuildContext) 30 | { 31 | ProjectsToSignImmediately = CodeSignImmediately, 32 | }; 33 | 34 | return data; 35 | } 36 | 37 | //------------------------------------------------------------- 38 | 39 | List _codeSignImmediately; 40 | 41 | public List CodeSignImmediately 42 | { 43 | get 44 | { 45 | if (_codeSignImmediately is null) 46 | { 47 | _codeSignImmediately = new List(); 48 | } 49 | 50 | return _codeSignImmediately; 51 | } 52 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/BatchUpdateToken.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using NuGet.Packaging.Core; 7 | 8 | internal partial class NuGetProjectPackageManager 9 | { 10 | private sealed class BatchUpdateToken : IDisposable 11 | { 12 | private readonly List _supressedInvokationEventArgs = new(); 13 | 14 | private readonly PackageIdentity _identity; 15 | 16 | public BatchUpdateToken(PackageIdentity identity) 17 | { 18 | ArgumentNullException.ThrowIfNull(identity); 19 | 20 | _identity = identity; 21 | } 22 | 23 | public bool IsDisposed { get; private set; } 24 | 25 | public void Add(NuGetProjectEventArgs eventArgs) 26 | { 27 | _supressedInvokationEventArgs.Add(eventArgs); 28 | } 29 | 30 | public IEnumerable GetUpdateEventArgs() 31 | { 32 | return _supressedInvokationEventArgs 33 | .GroupBy(e => new 34 | { 35 | e.Package.Id, 36 | e.Project 37 | }) 38 | .Select(group => new UpdateNuGetProjectEventArgs(group.Key.Project, _identity, group)) 39 | .ToList(); 40 | } 41 | 42 | public void Dispose() 43 | { 44 | IsDisposed = true; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Models/Repository.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | public sealed class Repository : IRepository 6 | { 7 | public Repository(string source) 8 | { 9 | Name = string.Empty; 10 | Source = source; 11 | } 12 | 13 | public int Id { get; set; } 14 | public string Name { get; set; } 15 | public string Source { get; set; } 16 | public PackageOperationType OperationType { get; set; } 17 | 18 | public bool IsLocal => new Uri(Source)?.IsLoopback ?? false; 19 | 20 | private bool Equals(Repository other) 21 | { 22 | return Id == other.Id && string.Equals(Name, other.Name) 23 | && string.Equals(Source, other.Source) 24 | && OperationType == other.OperationType; 25 | } 26 | 27 | public override int GetHashCode() 28 | { 29 | unchecked 30 | { 31 | var hashCode = Id; 32 | hashCode = (hashCode * 397) ^ (Name is not null ? Name.GetHashCode() : 0); 33 | hashCode = (hashCode * 397) ^ (Source is not null ? Source.GetHashCode() : 0); 34 | hashCode = (hashCode * 397) ^ (int)OperationType; 35 | return hashCode; 36 | } 37 | } 38 | 39 | public override bool Equals(object? obj) 40 | { 41 | if (obj is not Repository repository) 42 | { 43 | return false; 44 | } 45 | 46 | return Equals(repository); 47 | } 48 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Extensions/InlineExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Windows.Documents; 6 | 7 | public static class InlineExtensions 8 | { 9 | public static Bold Bold(this Inline inline) 10 | { 11 | return new Bold(inline); 12 | } 13 | 14 | public static Inline Insert(this Inline inline, Inline inlineToAdd) 15 | { 16 | ArgumentNullException.ThrowIfNull(inline); 17 | 18 | var span = inline as Span ?? new Span(inline); 19 | 20 | span.Inlines.Add(inlineToAdd); 21 | 22 | return span; 23 | } 24 | 25 | public static Inline Append(this Inline inline, Inline inlineToAdd) 26 | { 27 | ArgumentNullException.ThrowIfNull(inline); 28 | 29 | var span = new Span(inline); 30 | 31 | span.Inlines.Add(inlineToAdd); 32 | 33 | return span; 34 | } 35 | 36 | public static Inline InsertRange(this Inline inline, IEnumerable inlines) 37 | { 38 | ArgumentNullException.ThrowIfNull(inline); 39 | 40 | var span = inline as Span ?? new Span(inline); 41 | 42 | span.Inlines.AddRange(inlines); 43 | 44 | return span; 45 | } 46 | 47 | public static Inline AppendRange(this Inline inline, IEnumerable inlines) 48 | { 49 | ArgumentNullException.ThrowIfNull(inline); 50 | 51 | var span = new Span(inline); 52 | 53 | span.Inlines.AddRange(inlines); 54 | 55 | return span; 56 | } 57 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Management/SourceContext.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Management; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using NuGet.Configuration; 7 | using NuGet.Protocol.Core.Types; 8 | 9 | public sealed class SourceContext : IDisposable 10 | { 11 | private static readonly Stack ActiveContext = new(); 12 | 13 | private SourceContext() 14 | { 15 | // empty context 16 | } 17 | 18 | public SourceContext(IReadOnlyList packageSources) 19 | { 20 | PackageSources = packageSources; 21 | ActiveContext.Push(this); 22 | } 23 | 24 | public SourceContext(IReadOnlyList sourceRepositories) 25 | { 26 | Repositories = sourceRepositories; 27 | ActiveContext.Push(this); 28 | } 29 | 30 | public static SourceContext EmptyContext { get; set; } = new SourceContext(); 31 | 32 | public static SourceContext? CurrentContext 33 | { 34 | get 35 | { 36 | if (!ActiveContext.Any()) 37 | { 38 | return null; 39 | } 40 | 41 | return ActiveContext.Peek(); 42 | } 43 | } 44 | 45 | 46 | public IReadOnlyList? PackageSources { get; private set; } 47 | public IReadOnlyList? Repositories { get; private set; } 48 | 49 | public void Dispose() 50 | { 51 | if (this != EmptyContext) 52 | { 53 | ActiveContext.Pop(); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Views/ExtensiblesWindow.xaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Windows/Service/AnimationService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Windows; 2 | 3 | using System; 4 | using System.Linq; 5 | using System.Windows; 6 | using System.Windows.Media.Animation; 7 | 8 | internal class AnimationService : IAnimationService 9 | { 10 | private readonly Themes.Animations _resourceDictionary; 11 | 12 | public AnimationService() 13 | { 14 | _resourceDictionary = new Themes.Animations(); 15 | _resourceDictionary.InitializeComponent(); 16 | } 17 | 18 | public Storyboard GetFadeInAnimation(DependencyObject dependencyObject) 19 | { 20 | var sb = ((Storyboard)_resourceDictionary["FastFadeIn"]).Clone(); 21 | 22 | ValidateFadeAnimation(sb, dependencyObject, "FastFadeIn"); 23 | 24 | return sb; 25 | } 26 | 27 | public Storyboard GetFadeOutAnimation(DependencyObject dependencyObject) 28 | { 29 | var sb = ((Storyboard)_resourceDictionary["FastFadeOut"]).Clone(); 30 | 31 | ValidateFadeAnimation(sb, dependencyObject, "FastFadeOut"); 32 | 33 | return sb; 34 | } 35 | 36 | private void ValidateFadeAnimation(Storyboard sb, DependencyObject dependencyObject, string key) 37 | { 38 | if (sb is not null && sb.Children.Count > 0) 39 | { 40 | Storyboard.SetTarget(sb.Children.First(), dependencyObject); 41 | } 42 | else 43 | { 44 | throw new InvalidOperationException($"Resource under key '{key}' is not exist or can't be used as animation"); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Context/PackageOperationContext.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using Catel; 6 | 7 | internal class PackageOperationContext : IPackageOperationContext, IUniqueIdentifyable 8 | { 9 | public PackageOperationContext(IPackageDetails[] packages, ITemporaryFileSystemContext fileSystemContext) 10 | { 11 | ArgumentNullException.ThrowIfNull(packages); 12 | ArgumentNullException.ThrowIfNull(fileSystemContext); 13 | 14 | UniqueIdentifier = UniqueIdentifierHelper.GetUniqueIdentifier(); 15 | Exceptions = new List(); 16 | FileSystemContext = fileSystemContext; 17 | Packages = packages; 18 | } 19 | 20 | public int UniqueIdentifier { get; } 21 | public IRepository? Repository { get; set; } 22 | public IPackageDetails[] Packages { get; set; } 23 | public PackageOperationType OperationType { get; set; } 24 | public IPackageOperationContext? Parent { get; set; } 25 | public IList? Exceptions { get; private set; } 26 | public ITemporaryFileSystemContext FileSystemContext { get; set; } 27 | 28 | public override bool Equals(object? obj) 29 | { 30 | if (obj is not PackageOperationContext context) 31 | { 32 | return false; 33 | } 34 | 35 | return UniqueIdentifier.Equals(context.UniqueIdentifier); 36 | } 37 | 38 | public override int GetHashCode() 39 | { 40 | return UniqueIdentifier.GetHashCode(); 41 | } 42 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Tests/Services/CredentialsKeyHelperFacts.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Tests.Services; 2 | 3 | using System; 4 | using System.Net; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using NuGet.Configuration; 8 | using NuGet.Credentials; 9 | using NUnit.Framework; 10 | 11 | [TestFixture] 12 | public class CredentialsKeyHelperFacts 13 | { 14 | [TestCase("https://api.nuget.org/v3/index.json", "https://api.nuget.org/v3/")] 15 | [TestCase("https://extensions.wildgums.com/sub-url/nuget/index.json", "https://extensions.wildgums.com/sub-url/nuget/")] 16 | [TestCase("https://extensions.wildgums.com/another-sub-url/nuget/index.json", "https://extensions.wildgums.com/another-sub-url/nuget/")] 17 | public void ReturnsCorrectCacheKey(string url, string expectedUrlPart) 18 | { 19 | var uri = new Uri(url, UriKind.RelativeOrAbsolute); 20 | 21 | var actual = ExplorerCredentialService.CredentialsKeyHelper.GetCacheKey(uri, NuGet.Configuration.CredentialRequestType.Forbidden, new DummyCredentialsProvider()); 22 | var expected = $"dummy_{false}_{expectedUrlPart}"; 23 | 24 | Assert.That(actual, Is.EqualTo(expected)); 25 | } 26 | } 27 | 28 | public class DummyCredentialsProvider : ICredentialProvider 29 | { 30 | public string Id => "dummy"; 31 | 32 | public Task GetAsync(Uri uri, IWebProxy proxy, CredentialRequestType type, string message, bool isRetry, bool nonInteractive, CancellationToken cancellationToken) 33 | { 34 | throw new NotImplementedException(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer.Xaml/Converters/UriToBitmapConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Converters; 2 | 3 | using System; 4 | using System.Windows; 5 | using System.Windows.Media.Imaging; 6 | using Catel.IoC; 7 | using Catel.Logging; 8 | using Catel.MVVM.Converters; 9 | using NuGetExplorer.Cache; 10 | using NuGetExplorer.Providers; 11 | 12 | [System.Windows.Data.ValueConversion(typeof(Uri), typeof(BitmapImage))] 13 | public class UriToBitmapConverter : ValueConverterBase 14 | { 15 | private static readonly IconCache IconCache = InitCache(); 16 | private static readonly ILog Log = LogManager.GetCurrentClassLogger(); 17 | 18 | private static IconCache InitCache() 19 | { 20 | var appCacheProvider = ServiceLocator.Default.ResolveRequiredType(); 21 | 22 | return appCacheProvider.EnsureIconCache(); 23 | } 24 | 25 | protected override object Convert(Uri? value, Type targetType, object? parameter) 26 | { 27 | try 28 | { 29 | if (value is null) 30 | { 31 | return DependencyProperty.UnsetValue; 32 | } 33 | 34 | //get bitmap from stream cache 35 | return IconCache.GetFromCache(value) ?? DependencyProperty.UnsetValue; 36 | } 37 | catch (Exception ex) 38 | { 39 | // Don't list this as error, it's possible to have pacakges with missed icon.png 40 | Log.Warning($"Error occured during value conversion, {ex}"); 41 | return DependencyProperty.UnsetValue; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IPackageOperationNotificationService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | 5 | public interface IPackageOperationNotificationService 6 | { 7 | bool MuteAutomaticEvents { get; set; } 8 | 9 | void NotifyOperationBatchStarting(PackageOperationType operationType, params IPackageDetails[] packages); 10 | void NotifyOperationBatchFinished(PackageOperationType operationType, params IPackageDetails[] packages); 11 | void NotifyOperationStarting(string installPath, PackageOperationType operationType, IPackageDetails packageDetails); 12 | void NotifyOperationFinished(string installPath, PackageOperationType operationType, IPackageDetails packageDetails); 13 | void NotifyAutomaticOperationBatchStarting(PackageOperationType operationType, params IPackageDetails[] packages); 14 | void NotifyAutomaticOperationBatchFinished(PackageOperationType operationType, params IPackageDetails[] packages); 15 | void NotifyAutomaticOperationStarting(string installPath, PackageOperationType operationType, IPackageDetails packageDetails); 16 | void NotifyAutomaticOperationFinished(string installPath, PackageOperationType operationType, IPackageDetails packageDetails); 17 | IDisposable DisableNotifications(); 18 | 19 | event EventHandler? OperationsBatchStarting; 20 | event EventHandler? OperationsBatchFinished; 21 | event EventHandler? OperationStarting; 22 | event EventHandler? OperationFinished; 23 | } -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Extensions/IFileServiceExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using FileSystem; 7 | 8 | public static class IFileServiceExtensions 9 | { 10 | public static void ForceDeleteFiles(this IFileService fileService, string filePath, List failedEntries) 11 | { 12 | ArgumentNullException.ThrowIfNull(fileService); 13 | 14 | try 15 | { 16 | // When files or folders are readonly, the File.Delete method may not be able to delete it. 17 | SetAttributes(fileService, filePath, FileAttributes.ReadOnly); 18 | fileService.Delete(filePath); 19 | } 20 | catch (PathTooLongException) 21 | { 22 | failedEntries.Add(filePath); 23 | } 24 | catch (UnauthorizedAccessException) 25 | { 26 | failedEntries.Add(filePath); 27 | } 28 | catch (IOException) 29 | { 30 | // The file is being used by another process. 31 | failedEntries.Add(filePath); 32 | } 33 | } 34 | 35 | public static void SetAttributes(this IFileService fileService, string filePath, FileAttributes attribute) 36 | { 37 | ArgumentNullException.ThrowIfNull(fileService); 38 | 39 | var attributes = File.GetAttributes(filePath); 40 | if (attributes.HasFlag(attribute)) 41 | { 42 | // Remove flag when set. 43 | attributes &= ~attribute; 44 | File.SetAttributes(filePath, attributes); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Orc.NuGetExplorer/Services/Interfaces/IPackageInstallationService.cs: -------------------------------------------------------------------------------- 1 | namespace Orc.NuGetExplorer.Services; 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using NuGet.Packaging; 8 | using NuGet.Packaging.Core; 9 | using NuGet.Protocol.Core.Types; 10 | 11 | public interface IPackageInstallationService 12 | { 13 | /// 14 | /// V3 package path resolver 15 | /// 16 | VersionFolderPathResolver InstallerPathResolver { get; } 17 | 18 | Task InstallAsync(InstallationContext context, CancellationToken cancellationToken = default); 19 | 20 | [ObsoleteEx(ReplacementTypeOrMember = "InstallAsync(InstallationContext context, CancellationToken cancellationToken = default)", TreatAsErrorFromVersion = "6", RemoveInVersion = "7")] 21 | public Task InstallAsync( 22 | PackageIdentity package, 23 | IExtensibleProject project, 24 | IReadOnlyList repositories, 25 | bool ignoreMissingPackages = false, 26 | Func? packagePredicate = null, 27 | CancellationToken cancellationToken = default); 28 | 29 | Task UninstallAsync(PackageIdentity package, 30 | IExtensibleProject project, 31 | IEnumerable installedPackageReferences, 32 | Func? packagePredicate = null, 33 | CancellationToken cancellationToken = default); 34 | 35 | Task MeasurePackageSizeFromRepositoryAsync(PackageIdentity packageIdentity, SourceRepository sourceRepository); 36 | } 37 | --------------------------------------------------------------------------------