Exemplo n.º 1
0
 internal P_LoadedPackageState(DefaultDescriptionPackageService service, DescriptionPackageLocator locator)
 {
     service.EnsureNotNull(nameof(service));
     locator.EnsureNotNull(nameof(locator));
     //
     _service    = service;
     _locator    = locator;
     _disposeCts = new CancellationTokenSource();
     _loader     = new AsyncOperator <IDescriptionPackage>(asyncFactory: P_LoadNewPackageInstanceAsync, ownsResult: true);
 }
Exemplo n.º 2
0
 internal P_LoadedPackageState(DefaultDescriptionPackageService service, IDescriptionPackage package, DescriptionPackageLocator locator, bool ownsPackage = false)
 {
     service.EnsureNotNull(nameof(service));
     package.EnsureNotNull(nameof(package));
     locator.EnsureNotNull(nameof(locator));
     //
     _service    = service;
     _locator    = locator;
     _disposeCts = null;
     _loader     = new AsyncOperator <IDescriptionPackage>(result: package, ownsResult: ownsPackage);
 }
Exemplo n.º 3
0
        // TODO: Put strings into the resources.
        //
        public virtual IDescriptionPackageLoadContext CreateLoadContext(DescriptionPackageLocator locator, IContext outerCtx = default)
        {
            locator.EnsureNotNull(nameof(locator));
            //
            var locationBaseUri = locator.PackageLocationBaseUri;

            if (locationBaseUri is null || !locationBaseUri.IsAbsoluteUri || locationBaseUri.IsFileUri().Value)
            {
                // По умолчанию полагается, что базовое расположение пакета — файл.
                //
                return(new DescriptionPackageFileLoadContext(locator: locator, fileUri: GetFileLoadSourceUri(locator: locator), skipLinkedMetadata: true, outerCtx: outerCtx));
            }
Exemplo n.º 4
0
 protected override void Dispose(bool explicitDispose)
 {
     if (explicitDispose)
     {
         _loader?.Dispose();
         _disposeCts?.Dispose();
     }
     _service    = null;
     _locator    = null;
     _disposeCts = null;
     _loader     = null;
     //
     base.Dispose(explicitDispose);
 }
Exemplo n.º 5
0
 internal P_GeneratedPackageLoadContext(DescriptionPackageLocator locator)
     : base(locator: locator, siteOrigin: DescriptionPackageUtilities.UndefinedSiteOrigin, loadUri: DescriptionPackageUtilities.InMemoryGeneratedPackageBaseUri, skipLinkedMetadata: true)
 {
 }
Exemplo n.º 6
0
 public DescriptionPackageLoadException(string message, DescriptionPackageLocator packageLocator)
     : this(message, packageLocator, null)
 {
 }
Exemplo n.º 7
0
 public DescriptionPackageLoadException(string message, DescriptionPackageLocator packageLocator, Exception innerException)
     : base(
         message: string.IsNullOrEmpty(message) ? (packageLocator is null ? FormatXResource(typeof(DescriptionPackageLoadException), "DefaultMessage/WithoutNameReference") : FormatXResource(typeof(DescriptionPackageLoadException), "DefaultMessage", packageLocator)) : (packageLocator is null ? FormatXResource(typeof(DescriptionPackageLoadException), "UserMessage/WithoutNameReference", message) : FormatXResource(typeof(DescriptionPackageLoadException), "UserMessage", packageLocator, message)),
Exemplo n.º 8
0
 public DescriptionPackageLoadException(DescriptionPackageLocator packageLocator, Exception innerException)
     : this(null, packageLocator, innerException)
 {
 }