/// <summary> /// Determines the local path of an implementation. /// </summary> /// <param name="implementationStore">The store to get the implementation from.</param> /// <param name="implementation">The implementation to be located.</param> /// <returns>A fully qualified path to the directory containing the implementation.</returns> /// <exception cref="ImplementationNotFoundException">The <paramref name="implementation"/> is not cached yet.</exception> /// <exception cref="UnauthorizedAccessException">Read access to the store is not permitted.</exception> public static string GetPath(this IImplementationStore implementationStore, ImplementationBase implementation) { #region Sanity checks if (implementationStore == null) { throw new ArgumentNullException(nameof(implementationStore)); } if (implementation == null) { throw new ArgumentNullException(nameof(implementation)); } #endregion if (string.IsNullOrEmpty(implementation.LocalPath)) { string?path = implementationStore.GetPath(implementation.ManifestDigest); if (path == null) { throw new ImplementationNotFoundException(implementation.ManifestDigest); } return(path); } else { return(implementation.LocalPath); } }
protected override bool IsEqual(ImplementationBase implementation) { if (implementation is SafFile otherFile) { var path = _directoryDocument.Uri?.ToString() ?? string.Empty; var otherPath = otherFile._directoryDocument.Uri?.ToString() ?? string.Empty; return(path.Equals(otherPath, StringComparison.InvariantCulture)); } return(false); }
/// <summary> /// Determines the local path of an implementation. /// </summary> /// <param name="implementation">The implementation to be located.</param> /// <returns>A fully qualified path to the directory containing the implementation; <c>null</c> if the requested implementation could not be found in the store or is a package implementation.</returns> protected string?GetPathSafe(ImplementationBase implementation) { #region Sanity checks if (implementation == null) { throw new ArgumentNullException(nameof(implementation)); } #endregion if (implementation.ID.StartsWith(ExternalImplementation.PackagePrefix)) { return(null); } _implementationStore.Flush(); return(_implementationStore.GetPath(implementation.ManifestDigest)); }
protected override bool IsEqual(ImplementationBase impl) => impl is Local other && Path.Equals(other.Path);
protected override bool IsEqual(ImplementationBase implementation) => implementation is SecurityScopedFile file && file._nsUrl.FilePathUrl.Path == _nsUrl.FilePathUrl.Path;
private StorageFile(ImplementationBase implementation) { Implementation = implementation; Implementation.InitOwner(this); }
protected abstract bool IsEqual(ImplementationBase impl);
private StorageFolder(ImplementationBase implementation) { _implementation = implementation; _implementation.InitOwner(this); }
protected override bool IsEqual(ImplementationBase implementation) => throw NotSupported();
private FileRandomAccessStream(ImplementationBase implementation) { _implementation = implementation; }
private void Yield([NotNull] Requirements requirements, [CanBeNull] Feed feed = null, [CanBeNull] ImplementationBase implementation = null) { if (implementation == null) { var selections = Solver.TrySolve(requirements); if (selections != null) { implementation = selections.Implementations[0]; } } if (feed == null) { feed = FeedManager.GetFeed(requirements.InterfaceUri); } var sourceUri = feed.CatalogUri ?? feed.Uri; _request.YieldSoftwareIdentity( fastPath: requirements.ToJsonString(), name: feed.Name, version: (implementation == null || implementation.Version == null) ? null : implementation.Version.ToString(), versionScheme: null, summary: feed.Summaries.GetBestLanguage(CultureInfo.CurrentUICulture), source: (sourceUri == null) ? null : sourceUri.ToStringRfc(), searchKey: feed.Name, fullPath: null, packageFileName: feed.Name); }
protected override bool IsEqual(ImplementationBase implementation) => implementation is SecurityScopedFolder otherFolder && otherFolder._nsUrl.FilePathUrl.Path == _nsUrl.FilePathUrl.Path;
private StorageFile(ImplementationBase impl) { _impl = impl; _impl.InitOwner(this); }