Esempio n. 1
0
        public override async Task<Resource> Create(PackageSource source)
        {
            try
            {
                object repo = null;
                string host = "TestHost";

                // Check if the source is already present in the cache.
                if (!packageSourceCache.TryGetValue(source.Url, out repo))
                {
                    // if it's not in cache, then check if it is V2.
                    if (await V2Utilities.IsV2(source))
                    {
                        // Get a IPackageRepo object and add it to the cache.
                        repo = V2Utilities.GetV2SourceRepository(source, host);
                        packageSourceCache.Add(source.Url, repo);
                    }
                    else
                    {
                        // if it's not V2, returns null
                        return null;
                    }
                }

                // Create a resource and return it.
                var resource = new V2Resource((IPackageRepository)repo, host);
                return resource;
            }
            catch (Exception)
            {
                // *TODOs:Do tracing and throw apppropriate exception here.
                return null; 
            }
        }
        public override async Task <Resource> Create(PackageSource source)
        {
            try
            {
                object repo = null;
                string host = "TestHost";

                // Check if the source is already present in the cache.
                if (!packageSourceCache.TryGetValue(source.Url, out repo))
                {
                    // if it's not in cache, then check if it is V2.
                    if (await V2Utilities.IsV2(source))
                    {
                        // Get a IPackageRepo object and add it to the cache.
                        repo = V2Utilities.GetV2SourceRepository(source, host);
                        packageSourceCache.Add(source.Url, repo);
                    }
                    else
                    {
                        // if it's not V2, returns null
                        return(null);
                    }
                }

                // Create a resource and return it.
                var resource = new V2Resource((IPackageRepository)repo, host);
                return(resource);
            }
            catch (Exception)
            {
                // *TODOs:Do tracing and throw apppropriate exception here.
                return(null);
            }
        }
 public V2PowerShellAutoCompleteResource(V2Resource resource)
     : base(resource)
 {
 }
 public V2VisualStudioUIMetadataResource(V2Resource resource)
     : base(resource)
 {
 }
Esempio n. 5
0
 public V2DownloadResource(V2Resource resource)
 {
     V2Client = resource.V2Client;
 }
 public V2MetadataResource(V2Resource resource)
 {
     V2Client = resource.V2Client;
 }
 public V2DownloadResource(V2Resource resource)
     : base(resource)
 {
 }
Esempio n. 8
0
 public V2DownloadResource(V2Resource resource)
     : base(resource) {}
 public V2DependencyInfoResource(V2Resource resource)
 {
     V2Client = resource.V2Client;
 }
Esempio n. 10
0
 public V2SimpleSearchResource(V2Resource resource)
 {
     V2Client = resource.V2Client;
 }
Esempio n. 11
0
 public V2Resource(V2Resource resource)
 {
     _v2Client = resource.V2Client;
     _host     = resource.Host;
 }
Esempio n. 12
0
 public V2Resource(V2Resource resource)            
 {
     _v2Client = resource.V2Client;
     _host = resource.Host;
 }
Esempio n. 13
0
 public V2MetadataResource(V2Resource resource)
     : base(resource)
 {
 }
Esempio n. 14
0
 public V2MetadataResource(V2Resource resource)
     : base(resource) {}