Ng.CommandHelpers.CreateStorageFactoryImpl C# (CSharp) Метод

CreateStorageFactoryImpl() приватный статический Метод

private static CreateStorageFactoryImpl ( string>.IDictionary arguments, string>.IDictionary argumentNameMap, bool verbose ) : NuGet.Services.Metadata.Catalog.Persistence.StorageFactory
arguments string>.IDictionary
argumentNameMap string>.IDictionary
verbose bool
Результат NuGet.Services.Metadata.Catalog.Persistence.StorageFactory
        private static StorageFactory CreateStorageFactoryImpl(IDictionary<string, string> arguments, IDictionary<string, string> argumentNameMap, bool verbose)
        {
            Uri storageBaseAddress = null;
            var storageBaseAddressStr = arguments.GetOrDefault<string>(argumentNameMap[Arguments.StorageBaseAddress]);
            if (!string.IsNullOrEmpty(storageBaseAddressStr))
            {
                storageBaseAddressStr = storageBaseAddressStr.TrimEnd('/') + "/";

                storageBaseAddress = new Uri(storageBaseAddressStr);
            }

            var storageType = arguments.GetOrThrow<string>(Arguments.StorageType);

            if (storageType.Equals(Arguments.FileStorageType, StringComparison.InvariantCultureIgnoreCase))
            {
                var storagePath = arguments.GetOrThrow<string>(argumentNameMap[Arguments.StoragePath]);

                if (storageBaseAddress != null)
                {
                    return new FileStorageFactory(storageBaseAddress, storagePath) {Verbose = verbose};
                }

                TraceRequiredArgument(argumentNameMap[Arguments.StorageBaseAddress]);
                return null;
            }

            if (Arguments.AzureStorageType.Equals(storageType, StringComparison.InvariantCultureIgnoreCase))
            {
                var storageAccountName = arguments.GetOrThrow<string>(argumentNameMap[Arguments.StorageAccountName]);
                var storageKeyValue = arguments.GetOrThrow<string>(argumentNameMap[Arguments.StorageKeyValue]);
                var storageContainer = arguments.GetOrThrow<string>(argumentNameMap[Arguments.StorageContainer]);
                var storagePath = arguments.GetOrDefault<string>(argumentNameMap[Arguments.StoragePath]);

                var credentials = new StorageCredentials(storageAccountName, storageKeyValue);
                var account = new CloudStorageAccount(credentials, true);
                return new AzureStorageFactory(account, storageContainer, storagePath, storageBaseAddress) { Verbose = verbose };
            }
            
            throw new ArgumentException($"Unrecognized storageType \"{storageType}\"");
        }