Exemplo n.º 1
0
 public bool AddResource(string ResourceName, string ResourcePath, ResourceType Type)
 {
     //check existing
     if (Resources.Exists(delegate(KeyValuePair<string, string> match)
     {
         return match.Value == ResourceName;
     }))
         return false;
     CurrentResource = new AMTResource();
     using (var md5 = MD5.Create())
     {
         using (var stream = File.OpenRead(ResourcePath))
         {
             CurrentResource.UID = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLower() + "-" + ResourceName;
         }
     }
     if (CurrentResource.LoadResource(Type, ResourcePath))
     {
         Resources.Add(new KeyValuePair<string, string> (CurrentResource.UID, ResourceName));
         if (!SaveCurrentResource())
             return false;
         return true;
     }
     else
         return false;
 }
Exemplo n.º 2
0
		protected NativeObjectSecurity (bool isContainer,
						ResourceType resourceType,
						string name,
						AccessControlSections includeSections)
			: this (isContainer, resourceType, name, includeSections, null, null)
		{
		}
Exemplo n.º 3
0
 // Constructor used for creating a specific type of Tile object
 public Tile(Vector3 location, ResourceType type, GameObject resource)
 {
     // Initialise the variables to the given values
     position = location;
     resourceType = type;
     resourceObj = resource;
 }
Exemplo n.º 4
0
 public static String ResourceTypeToString(ResourceType type)
 {
     switch (type)
     {
         case ResourceType.MESH:
             {
                 return "Meshes";
             }
         case ResourceType.FOLDER:
             {
                 return "Folder";
             }
         case ResourceType.MACRO:
             {
                 return "Macros";
             }
         case ResourceType.MATERIAL:
             {
                 return "Materials";
             }
         case ResourceType.SCRIPT:
             {
                 return "Scripts";
             }
         case ResourceType.TEXTURE:
             {
                 return "Textures";
             }
         default:
             return "NONE";
     }
 }
Exemplo n.º 5
0
		protected NativeObjectSecurity (bool isContainer,
						ResourceType resourceType,
						SafeHandle handle,
						AccessControlSections includeSections)
			: this (isContainer, resourceType, handle, includeSections, null, null)
		{
		}
Exemplo n.º 6
0
        public void ServiceActionParameterInvalidCasesTest()
        {
            ResourceType complexType = new ResourceType(typeof(object), ResourceTypeKind.ComplexType, null, "foo", "Address", false);
            ResourceType entityType = new ResourceType(typeof(object), ResourceTypeKind.EntityType, null, "foo", "Order", false);
            ResourceSet entitySet = new ResourceSet("Set", entityType);
            ResourceType collectionOfPrimitive = ResourceType.GetCollectionResourceType(ResourceType.GetPrimitiveResourceType(typeof(int)));
            ResourceType collectionOfComplex = ResourceType.GetCollectionResourceType(complexType);
            ResourceType collectionType = ResourceType.GetEntityCollectionResourceType(entityType);

            var parameterTypes = ResourceTypeUtils.GetPrimitiveResourceTypes()
                .Concat(new ResourceType[] {
                        complexType,
                        entityType,
                        collectionOfPrimitive,
                        collectionOfComplex,
                        collectionType });
            AstoriaTestNS.TestUtil.RunCombinations(parameterTypes, (parameterType) =>
            {
                Exception e = AstoriaTestNS.TestUtil.RunCatching(() => new ServiceActionParameter("p", parameterType));
                if (parameterType != ResourceType.GetPrimitiveResourceType(typeof(System.IO.Stream)))
                {
                    Assert.IsNull(e, "Service op parameter should have succeeded.");
                }
                else
                {
                    ExceptionUtils.IsExpectedException<ArgumentException>(e, "The service operation parameter 'p' of type 'Edm.Stream' is not supported.\r\nParameter name: parameterType");
                }
            });
        }
Exemplo n.º 7
0
        ResourceType resourceType; // The ResourceType the resource on the map is.

        #endregion Fields

        #region Constructors

        // Default Constructor used for creating an empty Tile object
        public Tile()
        {
            // Initialise the variables to a default state
            position = Vector3.zero;
            resourceType = ResourceType.None;
            resourceObj = null;
        }
Exemplo n.º 8
0
		// Get the health bar texture for resources (ore,...)
		public static Texture2D GetResourceHealthBar(ResourceType resourceType) {
    		if(resourceHealthBarTextures != null && resourceHealthBarTextures.ContainsKey(resourceType)) {
    			return resourceHealthBarTextures[resourceType];
    		} else {
    			return null;
    		}
		}
        private IInMemoryConfigurer AddResourceGroup(string name, Action<IResourceElementGroupConfigurer> registration, ResourceType resourceType)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (registration == null)
            {
                throw new ArgumentNullException("registration");
            }

            ResourceElementGroup resourceElementGroup = new ResourceElementGroup {ResourceType = resourceType};
            ResourceElementGroupConfigurer resourceElementGroupConfigurer = new ResourceElementGroupConfigurer(resourceElementGroup);
            registration(resourceElementGroupConfigurer);

            if (resourceType == ResourceType.Js)
            {
                m_WebResources.JavascriptResources.ResourceGroups.Add(resourceElementGroup);                
            }
            else if (resourceType == ResourceType.Css)
            {
                m_WebResources.CssResources.ResourceGroups.Add(resourceElementGroup);                
            }
            return this;
        }
Exemplo n.º 10
0
 public void SetData(CampaignStation exportStation, CampaignStation importStation, ResourceType resourceType, int quantity)
 {
     this.exportStation = exportStation;
     this.importStation = importStation;
     this.resource = resourceType;
     this.amount = quantity;
 }
Exemplo n.º 11
0
        private async Task<JobResource> UploadResourceAndGetInfoAsync(string filePath, ResourceType resourceType, string driverUploadPath, string localizedName = null)
        {
            if (!_file.Exists(filePath))
            {
                Exceptions.Throw(
                    new FileNotFoundException("Could not find resource file " + filePath),
                    Log);
            }

            var destinationPath = driverUploadPath + Path.GetFileName(filePath);
            var remoteFileUri = _fileSystem.CreateUriForPath(destinationPath);

            Log.Log(Level.Verbose, @"Copy {0} to {1}", filePath, remoteFileUri);

            // IFileSystem does not support async APIs; Hence we start the copying in a task
            await Task.Run(() => _fileSystem.CopyFromLocal(filePath, remoteFileUri));
            var fileStatus = _fileSystem.GetFileStatus(remoteFileUri);

            return new JobResource
            {
                Name = localizedName ?? Path.GetFileName(filePath),
                LastModificationUnixTimestamp = DateTimeToUnixTimestamp(fileStatus.ModificationTime),
                RemoteUploadPath = _urlConverter.ConvertToLocalUrl(remoteFileUri),
                ResourceSize = fileStatus.LengthBytes,
                ResourceType = resourceType
            };
        }
 public ResourceStat(Resource resource, string info = "")
 {
     Type = resource.ResourceType;
     Version = resource.Version;
     Count = 1;
     Info = info;
 }
        /// <summary>
        /// Performs any transforms on the web <paramref name="resources" /> passed in and returns the new list.
        /// </summary>
        /// <param name="resources">List of web resources to process.</param>
        /// <param name="resourceType">Web resource types being processed.</param>
        /// <returns>
        /// Transformed list of web resources.
        /// </returns>
        public override IEnumerable<string> ProcessResources(IEnumerable<string> resources, ResourceType resourceType)
        {
            var result = base.ProcessResources(resources, resourceType);

            return ResourceType.HasFlag(resourceType)
                ? result.Distinct() : result;
        }
Exemplo n.º 14
0
 public static void ClearRegistrations(ResourceType resourceType)
 {
     if (_transformerRegistrations.ContainsKey(resourceType))
     {
         _transformerRegistrations[resourceType].Clear();
     }
 }
Exemplo n.º 15
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="rt">Tipo de recurso</param>
 /// <param name="qtd">Quantidade do recurso</param>
 public Resource(ResourceType rt, int qtd, Texture2D img)
 {
     Type = rt;
     Quantity = qtd;
     Image = img;
     Name = Enum.GetName(typeof(ResourceType), Type);
 }
        private async Task<JobResource> UploadResourceAndGetInfoAsync(string filePath, ResourceType resourceType, string driverUploadPath, string localizedName = null)
        {
            if (!_file.Exists(filePath))
            {
                Exceptions.Throw(
                    new FileNotFoundException("Could not find resource file " + filePath),
                    Log);
            }

            var detailsOutputPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));

            try
            {
                await _javaLauncher.LaunchAsync(JavaClassNameForResourceUploader,
                    filePath,
                    resourceType.ToString(),
                    driverUploadPath,
                    detailsOutputPath);

                var localizedResourceName = localizedName ?? Path.GetFileName(filePath);
                return ParseGeneratedOutputFile(detailsOutputPath, localizedResourceName, resourceType);
            }
            finally
            {
                if (_file.Exists(detailsOutputPath))
                {
                    _file.Delete(detailsOutputPath);
                }
            }
        }
 public AutoDiscoveryResult (Uri ressourceUrl, bool wasCancelled, ResourceType resourceType)
     : this()
 {
   _wasCancelled = wasCancelled;
   _ressourceUrl = ressourceUrl;
   _resourceType = resourceType;
 }
Exemplo n.º 18
0
 /*** Game Engine methods, all can be overridden by subclass ***/
 protected override void Start()
 {
     base.Start ();
     resourceType = ResourceType.Unknown;
     if (loadedSavedValues) return;
     amountLeft = capacity;
 }
Exemplo n.º 19
0
 public CarryRequest(ResourceType type, uint amount, Building destination)
     : this()
 {
     this.ResourceType = type;
     this.Amount = amount;
     this.Destination = destination;
 }
 public DynamicallyCompiledIndividualResourceHandler(string physicalPathToResource,
     ResourceType resourceType,
     ContentFilterPipeline contentFilterPipeline,
     ContentFilterContext contentFilterContext)
     : this(physicalPathToResource, resourceType, contentFilterPipeline, contentFilterContext, new FileAccessWrapper())
 {
 }
Exemplo n.º 21
0
		public static TileBrush GetResourceBrush(Guid? uid, ResourceType type, bool showError = true)
		{
			TileBrush brush = null;
			if (uid.HasValue && uid != Guid.Empty)
				try
				{
					switch (type)
					{
						case ResourceType.Image:
							brush = new ImageBrush(ServiceFactoryBase.ContentService.GetBitmapContent(uid.Value));
							break;
						case ResourceType.Visual:
							var visual = ServiceFactoryBase.ContentService.GetVisual(uid.Value);
							UpdateReferences(visual);
							brush = new VisualBrush(visual);
							break;
						case ResourceType.Drawing:
							brush = new DrawingBrush(ServiceFactoryBase.ContentService.GetDrawing(uid.Value));
							break;
					}
				}
				catch (Exception e)
				{
					Logger.Error(e, "Исключение при вызове ImageHelper.GetResourceImage({0},{1})", uid, type);
					if (showError)
						MessageBoxService.ShowWarningExtended("Возникла ошибка при загрузке изображения");
				}
			return brush;
		}
Exemplo n.º 22
0
        /// <summary>
        /// Converts the given resource type to a studio resource type string (WorkflowService, Service, Source, ReservedService, or *).
        /// </summary>
        /// <param name="resourceType">The type of the resource to be converted.</param>
        /// <returns>A studio resource type string.</returns>
        public static string ToTypeString(ResourceType resourceType)
        {
            switch(resourceType)
            {
                case ResourceType.Server:
                case ResourceType.DbSource:
                case ResourceType.PluginSource:
                case ResourceType.EmailSource:
                case ResourceType.WebSource:
                case ResourceType.ServerSource:
                case ResourceType.SharepointServerSource:
                case ResourceType.OauthSource:
                    return TypeSource;

                case ResourceType.PluginService:
                case ResourceType.DbService:
                case ResourceType.WebService:
                    return TypeService;

                case ResourceType.WorkflowService:
                    return TypeWorkflowService;

                case ResourceType.ReservedService:
                    return TypeReservedService;
                default:
                    return TypeWildcard;
            }
        }
Exemplo n.º 23
0
 public static void GetResourceData(Stream stream, out uint flags, out ResourceType type)
 {
     var rh = new ResourceHeader();
     rh.Read(new BinaryReader(stream));
     flags = rh.Flags;
     type = rh.Type;
 }
        private static MvcHtmlString RegisterResources(this HtmlHelper helper, SimpleCompressionConfiguration configuration, string[] files, ResourceType resourceType)
        {
            configuration = configuration ?? SimpleCompressionConfiguration.DefaulConfiguration;

            Func<string, string> printFunc = resourceType == ResourceType.Css
                                                 ? (Func<string,string>)TagHelper.PrintCssTag
                                                 : TagHelper.PrintJavascriptTag;

            string tagString = string.Empty;
            if (configuration.Disable)
            {
                foreach (var file in files)
                {
                    tagString += helper.PrintTag(file, printFunc);
                }
            }
            else
            {

                var fileResources = CreateResources(files, configuration);

                var hashCode = fileResources.GetHashCode();
                string extension = resourceType == ResourceType.Css ? ".css" : ".js";
                string fileName = configuration.ClientVersionPrefix + "_" + hashCode + extension;
                string filePath = "~/" + configuration.FolderForCachedResources + fileName;
                ResourceCacheManager.Instance.AddResourcesToCache(fileName, new Tuple<List<FileResource>, SimpleCompressionConfiguration>(fileResources, configuration));
                tagString = helper.PrintTag(filePath, printFunc);
            }
            return new MvcHtmlString(tagString);
        }
Exemplo n.º 25
0
 protected override void Start()
 {
     base.Start();
     amountLeft = capacity;
     resourceType = ResourceType.Unknown;
     worldObjectType = WorldObjectType.Resource;
 }
Exemplo n.º 26
0
 public CacheSetting(Guid id, ResourceType resourceType, DateTime? lastRefreshedDateUtc, int cacheValidDurationInSeconds)
 {
     this.Id = id;
     this.ResourceType = resourceType;
     this.LastRefreshedDateUtc = lastRefreshedDateUtc;
     this.CacheValidDurationInSeconds = cacheValidDurationInSeconds;
 }
Exemplo n.º 27
0
 private void IncResource(ResourceType resource, int amount)
 {
     // make sure we have under the limit
     if (this.resourceLimits [resource] > (this.resources [resource] + amount)) {
         this.resources [resource] += amount;
     }
 }
Exemplo n.º 28
0
		protected NativeObjectSecurity (bool isContainer,
						ResourceType resourceType,
						ExceptionFromErrorCode exceptionFromErrorCode,
						object exceptionContext)
			: this (isContainer, resourceType)
		{
		}
        public void HandleResource(HttpContextBase httpContext, ResourceType resourceType, string resourceGroupName)
        {
            CompressionType compressionType;
            ProcessedResourceGroupInfo resourceInfo = ProcessResource(httpContext, resourceType, resourceGroupName, out compressionType);

            HandleResource(httpContext, resourceType, compressionType, resourceInfo);
        }
Exemplo n.º 30
0
		internal NativeObjectSecurity (CommonSecurityDescriptor securityDescriptor, ResourceType resourceType)
			: base (securityDescriptor)
		{
#if !MOBILE			
			resource_type = resourceType;
#endif
		}
Exemplo n.º 31
0
        internal static PrivateLinkServiceData DeserializePrivateLinkServiceData(JsonElement element)
        {
            Optional <ExtendedLocation>                                      extendedLocation = default;
            Optional <ETag>                                                  etag             = default;
            Optional <ResourceIdentifier>                                    id       = default;
            Optional <string>                                                name     = default;
            Optional <ResourceType>                                          type     = default;
            Optional <AzureLocation>                                         location = default;
            Optional <IDictionary <string, string> >                         tags     = default;
            Optional <IList <FrontendIPConfigurationData> >                  loadBalancerFrontendIpConfigurations = default;
            Optional <IList <PrivateLinkServiceIPConfiguration> >            ipConfigurations           = default;
            Optional <IReadOnlyList <NetworkInterfaceData> >                 networkInterfaces          = default;
            Optional <NetworkProvisioningState>                              provisioningState          = default;
            Optional <IReadOnlyList <NetworkPrivateEndpointConnectionData> > privateEndpointConnections = default;
            Optional <PrivateLinkServicePropertiesVisibility>                visibility          = default;
            Optional <PrivateLinkServicePropertiesAutoApproval>              autoApproval        = default;
            Optional <IList <string> >                                       fqdns               = default;
            Optional <string>                                                @alias              = default;
            Optional <bool>                                                  enableProxyProtocol = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("extendedLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value);
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    etag = new ETag(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    location = new AzureLocation(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("loadBalancerFrontendIpConfigurations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <FrontendIPConfigurationData> array = new List <FrontendIPConfigurationData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(FrontendIPConfigurationData.DeserializeFrontendIPConfigurationData(item));
                            }
                            loadBalancerFrontendIpConfigurations = array;
                            continue;
                        }
                        if (property0.NameEquals("ipConfigurations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <PrivateLinkServiceIPConfiguration> array = new List <PrivateLinkServiceIPConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PrivateLinkServiceIPConfiguration.DeserializePrivateLinkServiceIPConfiguration(item));
                            }
                            ipConfigurations = array;
                            continue;
                        }
                        if (property0.NameEquals("networkInterfaces"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <NetworkInterfaceData> array = new List <NetworkInterfaceData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(NetworkInterfaceData.DeserializeNetworkInterfaceData(item));
                            }
                            networkInterfaces = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new NetworkProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("privateEndpointConnections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <NetworkPrivateEndpointConnectionData> array = new List <NetworkPrivateEndpointConnectionData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(NetworkPrivateEndpointConnectionData.DeserializeNetworkPrivateEndpointConnectionData(item));
                            }
                            privateEndpointConnections = array;
                            continue;
                        }
                        if (property0.NameEquals("visibility"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            visibility = PrivateLinkServicePropertiesVisibility.DeserializePrivateLinkServicePropertiesVisibility(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("autoApproval"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            autoApproval = PrivateLinkServicePropertiesAutoApproval.DeserializePrivateLinkServicePropertiesAutoApproval(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("fqdns"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            fqdns = array;
                            continue;
                        }
                        if (property0.NameEquals("alias"))
                        {
                            @alias = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("enableProxyProtocol"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableProxyProtocol = property0.Value.GetBoolean();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new PrivateLinkServiceData(id.Value, name.Value, Optional.ToNullable(type), Optional.ToNullable(location), Optional.ToDictionary(tags), extendedLocation.Value, Optional.ToNullable(etag), Optional.ToList(loadBalancerFrontendIpConfigurations), Optional.ToList(ipConfigurations), Optional.ToList(networkInterfaces), Optional.ToNullable(provisioningState), Optional.ToList(privateEndpointConnections), visibility.Value, autoApproval.Value, Optional.ToList(fqdns), @alias.Value, Optional.ToNullable(enableProxyProtocol)));
        }
 /// <inheritdoc />
 public IImmutableSet <ResourceFieldAttribute> GetSparseFieldSetForQuery(ResourceType resourceType)
 {
     return(_innerCache.GetSparseFieldSetForQuery(resourceType));
 }
    static void SetAssetBundleNames(bool b)
    {
        UnityEngine.Debug.Log("----------Start Set AssetBundleName " + DateTime.Now);
        //UpdateProgressBar("正在遍历资源");
        sResourceFiles.Clear();
        sExportFiles.Clear();
        sFileDepends.Clear();
        sOptionalFiles.Clear();
        sLeastInstallFils.Clear();
        sFileReferences.Clear();
        //CopyLua(true);
        //UnityEngine.Debug.LogError("Step 1: get export resource files");
        if (b)
        {
            ClearAssetBundleName();
        }

        FindEnabledEditorScenes();
        FileSystemInfo info = new DirectoryInfo(resourceDir);

        TraverseDirectory(info, FindResourceFile);
        //UpdateProgressBar("正在分析资源依赖项");
        //UnityEngine.Debug.LogError("Step 2: analyze depend files");
        foreach (KeyValuePair <string, string> pair in sResourceFiles)
        {
            if (sExportFiles.ContainsKey(pair.Key))
            {
                continue;
            }

            if (!pair.Value.Contains("UnPackage"))
            {
                List <string> dependencies = new List <string>();
                ResourceType  type         = ResourceType.Normal;
                if (sLeastInstallFils.Contains(pair.Key))
                {
                    type = ResourceType.Install;
                }
                else if (sOptionalFiles.Contains(pair.Key))
                {
                    type = ResourceType.Optional;
                }
                AnalyzeDependencies(pair.Value, ref dependencies, type);
                if (dependencies.Count > 0)
                {
                    sFileDepends.Add(pair.Key, dependencies);
                }
            }

            sExportFiles.Add(pair.Key, pair.Value);
            //UpdateProgressBar();
        }

        foreach (KeyValuePair <string, List <string> > pair in sFileDepends)
        {
            foreach (string id in pair.Value)
            {
                if (!sFileReferences.ContainsKey(id))
                {
                    List <string> list = new List <string>();
                    sFileReferences.Add(id, list);
                }
                if (!sFileReferences[id].Contains(pair.Key))
                {
                    sFileReferences[id].Add(pair.Key);
                }
            }
            //UpdateProgressBar();
        }

        //UnityEngine.Debug.LogError("Step 3: analyze only one reference files");
        foreach (KeyValuePair <string, string> pair in sResourceFiles)
        {
            AnalyzeChildDepended(pair.Key);
        }

        //UnityEngine.Debug.LogError("Step 4: set assetbundle names");
        //UpdateProgressBar("正在设置AssetBundle");
        ClearAssetBundleName(b);
        foreach (KeyValuePair <string, string> pair in sExportFiles)
        {
            string fullPath = Application.dataPath.Substring(0, Application.dataPath.Length - 6) + pair.Value;
            SetAssetBundleName(fullPath, pair.Key, "ab");
            //UpdateProgressBar();
        }
        AssetDatabase.Refresh();
        UnityEngine.Debug.Log("----------Finish Set AssetBundleName " + DateTime.Now);
    }
Exemplo n.º 34
0
 internal OSVersionData(ResourceIdentifier id, string name, ResourceType type, string location, OSVersionProperties properties) : base(id, name, type)
 {
     Location   = location;
     Properties = properties;
 }
Exemplo n.º 35
0
 public static extern uint WNetOpenEnum
     (ResourceScope dwScope,
     ResourceType dwType,
     ResourceUsage dwUsage,
     IntPtr lpNetResource,
     ref IntPtr lphEnum);
Exemplo n.º 36
0
        internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement element)
        {
            Optional <Models.Plan> plan = default;
            Optional <IReadOnlyList <VirtualMachineExtensionData> > resources = default;
            Optional <ManagedServiceIdentity>  identity                          = default;
            Optional <IList <string> >         zones                             = default;
            Optional <Models.ExtendedLocation> extendedLocation                  = default;
            IDictionary <string, string>       tags                              = default;
            AzureLocation                                location                = default;
            ResourceIdentifier                           id                      = default;
            string                                       name                    = default;
            ResourceType                                 type                    = default;
            SystemData                                   systemData              = default;
            Optional <HardwareProfile>                   hardwareProfile         = default;
            Optional <StorageProfile>                    storageProfile          = default;
            Optional <AdditionalCapabilities>            additionalCapabilities  = default;
            Optional <OSProfile>                         osProfile               = default;
            Optional <NetworkProfile>                    networkProfile          = default;
            Optional <SecurityProfile>                   securityProfile         = default;
            Optional <DiagnosticsProfile>                diagnosticsProfile      = default;
            Optional <WritableSubResource>               availabilitySet         = default;
            Optional <WritableSubResource>               virtualMachineScaleSet  = default;
            Optional <WritableSubResource>               proximityPlacementGroup = default;
            Optional <VirtualMachinePriorityTypes>       priority                = default;
            Optional <VirtualMachineEvictionPolicyTypes> evictionPolicy          = default;
            Optional <BillingProfile>                    billingProfile          = default;
            Optional <WritableSubResource>               host                    = default;
            Optional <WritableSubResource>               hostGroup               = default;
            Optional <string>                            provisioningState       = default;
            Optional <VirtualMachineInstanceView>        instanceView            = default;
            Optional <string>                            licenseType             = default;
            Optional <string>                            vmId                    = default;
            Optional <string>                            extensionsTimeBudget    = default;
            Optional <int>                               platformFaultDomain     = default;
            Optional <ScheduledEventsProfile>            scheduledEventsProfile  = default;
            Optional <string>                            userData                = default;
            Optional <CapacityReservationProfile>        capacityReservation     = default;
            Optional <ApplicationProfile>                applicationProfile      = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("plan"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    plan = Models.Plan.DeserializePlan(property.Value);
                    continue;
                }
                if (property.NameEquals("resources"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <VirtualMachineExtensionData> array = new List <VirtualMachineExtensionData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(VirtualMachineExtensionData.DeserializeVirtualMachineExtensionData(item));
                    }
                    resources = array;
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    identity = JsonSerializer.Deserialize <ManagedServiceIdentity>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("zones"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    zones = array;
                    continue;
                }
                if (property.NameEquals("extendedLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedLocation = Models.ExtendedLocation.DeserializeExtendedLocation(property.Value);
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("hardwareProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hardwareProfile = HardwareProfile.DeserializeHardwareProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("storageProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            storageProfile = StorageProfile.DeserializeStorageProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("additionalCapabilities"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            additionalCapabilities = AdditionalCapabilities.DeserializeAdditionalCapabilities(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("osProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            osProfile = OSProfile.DeserializeOSProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("networkProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            networkProfile = NetworkProfile.DeserializeNetworkProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("securityProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            securityProfile = SecurityProfile.DeserializeSecurityProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("diagnosticsProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            diagnosticsProfile = DiagnosticsProfile.DeserializeDiagnosticsProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("availabilitySet"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            availabilitySet = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("virtualMachineScaleSet"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            virtualMachineScaleSet = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("proximityPlacementGroup"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            proximityPlacementGroup = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("priority"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            priority = new VirtualMachinePriorityTypes(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("evictionPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            evictionPolicy = new VirtualMachineEvictionPolicyTypes(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("billingProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            billingProfile = BillingProfile.DeserializeBillingProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("host"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            host = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("hostGroup"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hostGroup = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("instanceView"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            instanceView = VirtualMachineInstanceView.DeserializeVirtualMachineInstanceView(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("licenseType"))
                        {
                            licenseType = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("vmId"))
                        {
                            vmId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("extensionsTimeBudget"))
                        {
                            extensionsTimeBudget = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("platformFaultDomain"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            platformFaultDomain = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("scheduledEventsProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            scheduledEventsProfile = ScheduledEventsProfile.DeserializeScheduledEventsProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("userData"))
                        {
                            userData = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("capacityReservation"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            capacityReservation = CapacityReservationProfile.DeserializeCapacityReservationProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("applicationProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            applicationProfile = ApplicationProfile.DeserializeApplicationProfile(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VirtualMachineData(id, name, type, systemData, tags, location, plan.Value, Optional.ToList(resources), identity, Optional.ToList(zones), extendedLocation.Value, hardwareProfile.Value, storageProfile.Value, additionalCapabilities.Value, osProfile.Value, networkProfile.Value, securityProfile.Value, diagnosticsProfile.Value, availabilitySet, virtualMachineScaleSet, proximityPlacementGroup, Optional.ToNullable(priority), Optional.ToNullable(evictionPolicy), billingProfile.Value, host, hostGroup, provisioningState.Value, instanceView.Value, licenseType.Value, vmId.Value, extensionsTimeBudget.Value, Optional.ToNullable(platformFaultDomain), scheduledEventsProfile.Value, userData.Value, capacityReservation.Value, applicationProfile.Value));
        }
 internal TrackedResourceExtended(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ExtendedLocation extendedLocation) : base(id, name, type, systemData, tags, location)
 {
     ExtendedLocation = extendedLocation;
 }
Exemplo n.º 38
0
 //[base]/Resource/$meta
 public static Meta Meta(this FhirClient client, ResourceType type)
 {
     return(extractMeta(expect <Parameters>(client.TypeOperation(Operation.META, type.ToString(), useGet: true))));
 }
Exemplo n.º 39
0
        private void HandleRequestStart(string requestId, string interceptionId, string url, ResourceType resourceType, Payload requestPayload, string frameId)
        {
            Frame frame = null;

            if (!string.IsNullOrEmpty(frameId))
            {
                _frameManager.Frames.TryGetValue(frameId, out frame);
            }

            var request = new Request(_client, requestId, interceptionId, _userRequestInterceptionEnabled, url,
                                      resourceType, requestPayload, frame);

            if (!string.IsNullOrEmpty(requestId))
            {
                _requestIdToRequest.Add(requestId, request);
            }
            if (!string.IsNullOrEmpty(interceptionId))
            {
                _interceptionIdToRequest.Add(interceptionId, request);
            }

            Request(this, new RequestEventArgs
            {
                Request = request
            });
        }
Exemplo n.º 40
0
 public void Harvested(Actor self, ResourceType resource)
 {
     movingToRefinery  = false;
     movingToResources = false;
 }
        internal static CdnCustomDomainData DeserializeCdnCustomDomainData(JsonElement element)
        {
            ResourceIdentifier id         = default;
            string             name       = default;
            ResourceType       type       = default;
            SystemData         systemData = default;
            Optional <string>  hostName   = default;
            Optional <CustomDomainResourceState>       resourceState = default;
            Optional <CustomHttpsProvisioningState>    customHttpsProvisioningState    = default;
            Optional <CustomHttpsProvisioningSubstate> customHttpsProvisioningSubstate = default;
            Optional <string> validationData    = default;
            Optional <string> provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("hostName"))
                        {
                            hostName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("resourceState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            resourceState = new CustomDomainResourceState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("customHttpsProvisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            customHttpsProvisioningState = new CustomHttpsProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("customHttpsProvisioningSubstate"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            customHttpsProvisioningSubstate = new CustomHttpsProvisioningSubstate(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("validationData"))
                        {
                            validationData = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new CdnCustomDomainData(id, name, type, systemData, hostName.Value, Optional.ToNullable(resourceState), Optional.ToNullable(customHttpsProvisioningState), Optional.ToNullable(customHttpsProvisioningSubstate), validationData.Value, provisioningState.Value));
        }
Exemplo n.º 42
0
 internal GremlinDatabaseCreateUpdateOptions(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, GremlinDatabaseResource resource, CreateUpdateOptions options) : base(id, name, type, systemData, tags, location)
 {
     Resource = resource;
     Options  = options;
 }
Exemplo n.º 43
0
        /// <summary>
        /// Converts a list of CosmosElements into a memory stream.
        /// </summary>
        /// <param name="containerRid">Container Rid</param>
        /// <param name="cosmosElements">The cosmos elements</param>
        /// <param name="resourceType">The resource type</param>
        /// <param name="cosmosSerializationOptions">The custom serialization options. This allows custom serialization types like BSON, JSON, or other formats</param>
        /// <returns>Returns a memory stream of cosmos elements. By default the memory stream will contain JSON.</returns>
        internal static MemoryStream ToStream(
            string containerRid,
            IEnumerable <CosmosElement> cosmosElements,
            ResourceType resourceType,
            CosmosSerializationFormatOptions cosmosSerializationOptions = null)
        {
            IJsonWriter jsonWriter;

            if (cosmosSerializationOptions != null)
            {
                jsonWriter = cosmosSerializationOptions.CreateCustomWriterCallback();
            }
            else
            {
                jsonWriter = JsonWriter.Create(JsonSerializationFormat.Text);
            }

            // The stream contract should return the same contract as read feed.
            // {
            //    "_rid": "qHVdAImeKAQ=",
            //    "Documents": [{
            //        "id": "03230",
            //        "_rid": "qHVdAImeKAQBAAAAAAAAAA==",
            //        "_self": "dbs\/qHVdAA==\/colls\/qHVdAImeKAQ=\/docs\/qHVdAImeKAQBAAAAAAAAAA==\/",
            //        "_etag": "\"410000b0-0000-0000-0000-597916b00000\"",
            //        "_attachments": "attachments\/",
            //        "_ts": 1501107886
            //    }],
            //    "_count": 1
            // }

            jsonWriter.WriteObjectStart();

            // Write the rid field and value
            jsonWriter.WriteFieldName("_rid");
            jsonWriter.WriteStringValue(containerRid);

            // Write the array of elements
            string rootName = CosmosElementSerializer.GetRootNodeName(resourceType);

            jsonWriter.WriteFieldName(rootName);

            int count = 0;

            jsonWriter.WriteArrayStart();
            foreach (CosmosElement element in cosmosElements)
            {
                count++;
                element.WriteTo(jsonWriter);
            }

            jsonWriter.WriteArrayEnd();

            // Write the count field and value
            jsonWriter.WriteFieldName("_count");
            jsonWriter.WriteNumberValue(count);

            jsonWriter.WriteObjectEnd();

            ReadOnlyMemory <byte> result = jsonWriter.GetResult();

            if (!MemoryMarshal.TryGetArray(result, out ArraySegment <byte> resultAsArray))
            {
                resultAsArray = new ArraySegment <byte>(result.ToArray());
            }

            return(new MemoryStream(resultAsArray.Array, resultAsArray.Offset, resultAsArray.Count));
        }
Exemplo n.º 44
0
        internal static WorkloadGroupData DeserializeWorkloadGroupData(JsonElement element)
        {
            ResourceIdentifier id   = default;
            string             name = default;
            ResourceType       type = default;
            Optional <int>     minResourcePercent           = default;
            Optional <int>     maxResourcePercent           = default;
            Optional <double>  minResourcePercentPerRequest = default;
            Optional <double>  maxResourcePercentPerRequest = default;
            Optional <string>  importance            = default;
            Optional <int>     queryExecutionTimeout = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("minResourcePercent"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            minResourcePercent = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("maxResourcePercent"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            maxResourcePercent = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("minResourcePercentPerRequest"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            minResourcePercentPerRequest = property0.Value.GetDouble();
                            continue;
                        }
                        if (property0.NameEquals("maxResourcePercentPerRequest"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            maxResourcePercentPerRequest = property0.Value.GetDouble();
                            continue;
                        }
                        if (property0.NameEquals("importance"))
                        {
                            importance = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("queryExecutionTimeout"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            queryExecutionTimeout = property0.Value.GetInt32();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new WorkloadGroupData(id, name, type, Optional.ToNullable(minResourcePercent), Optional.ToNullable(maxResourcePercent), Optional.ToNullable(minResourcePercentPerRequest), Optional.ToNullable(maxResourcePercentPerRequest), importance.Value, Optional.ToNullable(queryExecutionTimeout)));
        }
        internal static RelayServiceConnectionEntityData DeserializeRelayServiceConnectionEntityData(JsonElement element)
        {
            Optional <string>  kind                     = default;
            ResourceIdentifier id                       = default;
            string             name                     = default;
            ResourceType       type                     = default;
            SystemData         systemData               = default;
            Optional <string>  entityName               = default;
            Optional <string>  entityConnectionString   = default;
            Optional <string>  resourceType             = default;
            Optional <string>  resourceConnectionString = default;
            Optional <string>  hostname                 = default;
            Optional <int>     port                     = default;
            Optional <string>  biztalkUri               = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("entityName"))
                        {
                            entityName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("entityConnectionString"))
                        {
                            entityConnectionString = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("resourceType"))
                        {
                            resourceType = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("resourceConnectionString"))
                        {
                            resourceConnectionString = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("hostname"))
                        {
                            hostname = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("port"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            port = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("biztalkUri"))
                        {
                            biztalkUri = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new RelayServiceConnectionEntityData(id, name, type, systemData, kind.Value, entityName.Value, entityConnectionString.Value, resourceType.Value, resourceConnectionString.Value, hostname.Value, Optional.ToNullable(port), biztalkUri.Value));
        }
Exemplo n.º 46
0
        /// <summary>
        /// Converts a list of CosmosElements into a memory stream.
        /// </summary>
        /// <param name="memoryStream">The memory stream response from Azure Cosmos</param>
        /// <param name="resourceType">The resource type</param>
        /// <param name="cosmosSerializationOptions">The custom serialization options. This allows custom serialization types like BSON, JSON, or other formats</param>
        /// <returns>Returns a memory stream of cosmos elements. By default the memory stream will contain JSON.</returns>
        internal static CosmosArray ToCosmosElements(
            MemoryStream memoryStream,
            ResourceType resourceType,
            CosmosSerializationFormatOptions cosmosSerializationOptions = null)
        {
            if (!memoryStream.CanRead)
            {
                throw new InvalidDataException("Stream can not be read");
            }

            // Execute the callback an each element of the page
            // For example just could get a response like this
            // {
            //    "_rid": "qHVdAImeKAQ=",
            //    "Documents": [{
            //        "id": "03230",
            //        "_rid": "qHVdAImeKAQBAAAAAAAAAA==",
            //        "_self": "dbs\/qHVdAA==\/colls\/qHVdAImeKAQ=\/docs\/qHVdAImeKAQBAAAAAAAAAA==\/",
            //        "_etag": "\"410000b0-0000-0000-0000-597916b00000\"",
            //        "_attachments": "attachments\/",
            //        "_ts": 1501107886
            //    }],
            //    "_count": 1
            // }
            // And you should execute the callback on each document in "Documents".

            long responseLengthBytes = memoryStream.Length;

            byte[]         content       = memoryStream.ToArray();
            IJsonNavigator jsonNavigator = null;

            // Use the users custom navigator
            if (cosmosSerializationOptions != null)
            {
                jsonNavigator = cosmosSerializationOptions.CreateCustomNavigatorCallback(content);
                if (jsonNavigator == null)
                {
                    throw new InvalidOperationException("The CosmosSerializationOptions did not return a JSON navigator.");
                }
            }
            else
            {
                jsonNavigator = JsonNavigator.Create(new ArraySegment <byte>(content));
            }

            string resourceName = CosmosElementSerializer.GetRootNodeName(resourceType);

            if (!jsonNavigator.TryGetObjectProperty(
                    jsonNavigator.GetRootNode(),
                    resourceName,
                    out ObjectProperty objectProperty))
            {
                throw new InvalidOperationException($"Response Body Contract was violated. QueryResponse did not have property: {resourceName}");
            }

            IJsonNavigatorNode cosmosElements = objectProperty.ValueNode;

            if (!(CosmosElement.Dispatch(
                      jsonNavigator,
                      cosmosElements) is CosmosArray cosmosArray))
            {
                throw new InvalidOperationException($"QueryResponse did not have an array of : {resourceName}");
            }

            return(cosmosArray);
        }
Exemplo n.º 47
0
 public PathSetting(string path, ResourceType type, string resourceName)
     : base(HandleAppDriveIfAbsolutePath(EnsureResourceInfo(path, type, resourceName)))
 {
 }
Exemplo n.º 48
0
        internal static ApplicationGatewayPathRule DeserializeApplicationGatewayPathRule(JsonElement element)
        {
            Optional <ETag> etag = default;
            Optional <ResourceIdentifier>       id    = default;
            Optional <string>                   name  = default;
            Optional <ResourceType>             type  = default;
            Optional <IList <string> >          paths = default;
            Optional <WritableSubResource>      backendAddressPool    = default;
            Optional <WritableSubResource>      backendHttpSettings   = default;
            Optional <WritableSubResource>      redirectConfiguration = default;
            Optional <WritableSubResource>      rewriteRuleSet        = default;
            Optional <NetworkProvisioningState> provisioningState     = default;
            Optional <WritableSubResource>      firewallPolicy        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    etag = new ETag(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("paths"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            paths = array;
                            continue;
                        }
                        if (property0.NameEquals("backendAddressPool"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            backendAddressPool = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("backendHttpSettings"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            backendHttpSettings = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("redirectConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            redirectConfiguration = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("rewriteRuleSet"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            rewriteRuleSet = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new NetworkProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("firewallPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            firewallPolicy = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ApplicationGatewayPathRule(id.Value, name.Value, Optional.ToNullable(type), Optional.ToNullable(etag), Optional.ToList(paths), backendAddressPool, backendHttpSettings, redirectConfiguration, rewriteRuleSet, Optional.ToNullable(provisioningState), firewallPolicy));
        }
 internal PrivateLinkConnectionApprovalRequestResource(ResourceIdentifier id, string name, ResourceType type, string kind, PrivateLinkConnectionState privateLinkServiceConnectionState) : base(id, name, type, kind)
 {
     PrivateLinkServiceConnectionState = privateLinkServiceConnectionState;
 }
 public TestResult(ResourceType resourceType, CalendarProperties calendarProperties, AddressBookProperties addressBookProperties)
 {
     _resourceType          = resourceType;
     _calendarProperties    = calendarProperties;
     _addressBookProperties = addressBookProperties;
 }
Exemplo n.º 51
0
    /*** Game Engine methods, all can be overridden by subclass ***/

    protected override void Start()
    {
        base.Start();
        amountLeft   = capacity;
        resourceType = ResourceType.Unknown;
    }
Exemplo n.º 52
0
 public Resource(ResourceType newType, int newAmount)
 {
     type        = newType;
     this.amount = newAmount;
 }
        public static ListedCapabilityStatement BuildRestResourceComponent(this ListedCapabilityStatement statement, ResourceType resourceType, Action <ListedResourceComponent> componentBuilder)
        {
            EnsureArg.IsNotNull(statement, nameof(statement));
            EnsureArg.IsNotNull(componentBuilder, nameof(componentBuilder));

            var restComponent = statement.GetListedRestComponent();

            var restNode = restComponent
                           .Resource
                           .FirstOrDefault(x => x.Type == resourceType);

            if (restNode == null)
            {
                restNode = new ListedResourceComponent
                {
                    Type    = resourceType,
                    Profile = new ResourceReference(ResourceIdentity.Core(resourceType.ToString()).AbsoluteUri),
                };
                restComponent.Resource.Add(restNode);
            }

            componentBuilder(restNode);

            return(statement);
        }
Exemplo n.º 54
0
    // all the function is in this method
    public void playProgressCard(ProgressCard card)
    {
        pgCardType    name        = card.myType;
        Player        localPlayer = GameObject.Find("Local Player Panel").GetComponent <Player> ();
        List <Player> l           = GameObject.Find("panelPlayers").GetComponent <PlayerList> ()._players;
        GameBoard     board       = GameObject.Find("GameBoard").GetComponent <GameBoard> ();

        if (name == pgCardType.Crane)
        {
            localPlayer.isCrane = true;
        }
        else if (name == pgCardType.Engineer)
        {
            localPlayer.isEnginner = true;
        }
        else if (name == pgCardType.Irrigation)
        {
            foreach (GameObject h in board.tiles)
            {
                if (h.GetComponent <Hex> ().Product() == ResourceType.Grain)
                {
                    foreach (Vertex v in h.GetComponent <Hex>().adjacentVertices)
                    {
                        if (v != null && v.transform.childCount > 1 && v.transform.GetChild(1).GetComponent <Village> () != null && v.transform.GetChild(1).GetComponent <Village> ().owner == localPlayer)
                        {
                            localPlayer.OnResourcesChanged(ResourceType.Grain, 2);
                            break;
                        }
                    }
                }
            }
        }
        else if (name == pgCardType.Medicine)
        {
            localPlayer.isMedicine = true;
        }
        else if (name == pgCardType.Mining)
        {
            foreach (GameObject h in board.tiles)
            {
                if (h.GetComponent <Hex> ().Product() == ResourceType.Ore)
                {
                    foreach (Vertex v in h.GetComponent <Hex>().adjacentVertices)
                    {
                        if (v != null && v.transform.childCount > 1 && v.transform.GetChild(1).GetComponent <Village> () != null && v.transform.GetChild(1).GetComponent <Village> ().owner == localPlayer)
                        {
                            localPlayer.OnResourcesChanged(ResourceType.Ore, 2);
                            break;
                        }
                    }
                }
            }
        }
        else if (name == pgCardType.Printer)
        {
            localPlayer.CmdVpChange(1);
        }
        else if (name == pgCardType.Road_Building)
        {
            localPlayer.roadBuilding = 2;
            board.RequestPlayRoadBuildingCard();
        }
        else if (name == pgCardType.Smith)
        {
            localPlayer.isSmith += 2;
        }
        else if (name == pgCardType.Bishop)
        {
            board.RequestBishop();
        }
        else if (name == pgCardType.Constitution)
        {
            localPlayer.CmdVpChange(1);
        }
        else if (name == pgCardType.Deserter)
        {
            // too complicated so as Diplomat & Intrigue
        }
        else if (name == pgCardType.Saboteur)
        {
            for (int i = 0; i < l.Count; i++)
            {
                if (l [i] != localPlayer & l [i].vP >= localPlayer.vP)
                {
                    localPlayer.CmdRequestDiscardResources(i, Mathf.FloorToInt(l [i].resourceSum / 2));
                }
            }
        }
        else if (name == pgCardType.Warlord)
        {
            localPlayer.isWarLord = localPlayer.knights.Count;
            foreach (Knight k in localPlayer.knights)
            {
                if (!k.isActive)
                {
                    localPlayer.CmdSetKnightActive(k.vertexIndex, true);                      // TODO resources
                }
            }
        }
        else if (name == pgCardType.Wedding)
        {
            localPlayer.CmdPlayedWeddingCard();
        }
        else if (name == pgCardType.Master_Merchant)
        {
            foreach (Player p in l)
            {
                if (p != localPlayer)
                {
                    if (p.vP > localPlayer.vP)
                    {
                        //to do: ui to make them choose player and which resources to take
                        int          num    = 0;             // THIS SHOULD BE REPLACED
                        ResourceType chosen = 0;
                        p.OnResourcesChanged(chosen, -num);
                        localPlayer.OnResourcesChanged(chosen, num);
                        localPlayer.masterMerchant = true;
                    }
                }
            }
        }
        else if (name == pgCardType.Resource_Monopoly)
        {
            board.panelSelection.GetComponent <SelectionPanel> ().RequestResourceMonopoly();
        }
        else if (name == pgCardType.Trade_Monopoly)
        {
            board.panelSelection.GetComponent <SelectionPanel> ().RequestTradeMonopoly();
        }
        else if (name == pgCardType.Merchant_Fleet)
        {
            //to do: set the trade ratio to 2 for one turn
            localPlayer.merchantFleet = true;
        }
        else if (name == pgCardType.Commercial_Harbor)
        {
            //to do: force other players to trade 1:1
            localPlayer.commercialHarbor = true;
        }
        else if (name == pgCardType.Spy)
        {
            bool hasCardsToTake = false;
            foreach (Player p in l)
            {
                if (p.progressCardSum > 0 && !p.isLocalPlayer)
                {
                    hasCardsToTake = true;
                }
            }
            if (hasCardsToTake)
            {
                board.PlaySpyCard();
            }
            else
            {
                board.panelInfo.GetComponent <InfoPanel> ().pushMessage("Other players don't have any progress cards to let you take.", null, null);
                return;
            }
        }
        else if (name == pgCardType.Merchant)
        {
            board.RequestMoveMerchant();
        }
        else if (name == pgCardType.Inventor)
        {
            board.RequestInventorChoice();
        }
        else if (name == pgCardType.Alchemist)
        {
            board.panelSelection.GetComponent <SelectionPanel> ().RequestDiceSelection();
            localPlayer.CmdNotifyHasAlchemist(false);
        }
        localPlayer.CmdAnnounce(localPlayer.playerName + " has played a " + card.myType.ToString() + " card!");
        cards.Remove(card);
        localPlayer.CmdDiscardProgressCard((int)card.category, (int)card.myType);
    }
        public static ListedCapabilityStatement TryAddRestInteraction(this ListedCapabilityStatement statement, ResourceType resourceType, CapabilityStatement.TypeRestfulInteraction interaction)
        {
            EnsureArg.IsNotNull(statement, nameof(statement));

            statement.BuildRestResourceComponent(resourceType, builder =>
            {
                var hasInteraction = builder
                                     .Interaction
                                     .FirstOrDefault(x => x.Code == interaction);

                if (hasInteraction == null)
                {
                    builder
                    .Interaction
                    .Add(new CapabilityStatement.ResourceInteractionComponent
                    {
                        Code = interaction,
                    });
                }
            });

            return(statement);
        }
Exemplo n.º 56
0
        internal static AppServiceCertificateOrderData DeserializeAppServiceCertificateOrderData(JsonElement element)
        {
            Optional <string>            kind = default;
            IDictionary <string, string> tags = default;
            AzureLocation      location       = default;
            ResourceIdentifier id             = default;
            string             name           = default;
            ResourceType       type           = default;
            SystemData         systemData     = default;
            Optional <IDictionary <string, AppServiceCertificate> > certificates = default;
            Optional <string> distinguishedName       = default;
            Optional <string> domainVerificationToken = default;
            Optional <int>    validityInYears         = default;
            Optional <int>    keySize = default;
            Optional <CertificateProductType> productType = default;
            Optional <bool> autoRenew = default;
            Optional <ProvisioningState>      provisioningState = default;
            Optional <CertificateOrderStatus> status            = default;
            Optional <CertificateDetails>     signedCertificate = default;
            Optional <string>             csr          = default;
            Optional <CertificateDetails> intermediate = default;
            Optional <CertificateDetails> root         = default;
            Optional <string>             serialNumber = default;
            Optional <DateTimeOffset>     lastCertificateIssuanceTime = default;
            Optional <DateTimeOffset>     expirationTime = default;
            Optional <bool> isPrivateKeyExternal         = default;
            Optional <IReadOnlyList <AppServiceCertificateNotRenewableReason> > appServiceCertificateNotRenewableReasons = default;
            Optional <DateTimeOffset>          nextAutoRenewalTimeStamp = default;
            Optional <CertificateOrderContact> contact = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = new AzureLocation(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("certificates"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            Dictionary <string, AppServiceCertificate> dictionary = new Dictionary <string, AppServiceCertificate>();
                            foreach (var property1 in property0.Value.EnumerateObject())
                            {
                                dictionary.Add(property1.Name, AppServiceCertificate.DeserializeAppServiceCertificate(property1.Value));
                            }
                            certificates = dictionary;
                            continue;
                        }
                        if (property0.NameEquals("distinguishedName"))
                        {
                            distinguishedName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("domainVerificationToken"))
                        {
                            domainVerificationToken = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("validityInYears"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            validityInYears = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("keySize"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            keySize = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("productType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            productType = property0.Value.GetString().ToCertificateProductType();
                            continue;
                        }
                        if (property0.NameEquals("autoRenew"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            autoRenew = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = property0.Value.GetString().ToProvisioningState();
                            continue;
                        }
                        if (property0.NameEquals("status"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            status = property0.Value.GetString().ToCertificateOrderStatus();
                            continue;
                        }
                        if (property0.NameEquals("signedCertificate"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            signedCertificate = CertificateDetails.DeserializeCertificateDetails(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("csr"))
                        {
                            csr = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("intermediate"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            intermediate = CertificateDetails.DeserializeCertificateDetails(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("root"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            root = CertificateDetails.DeserializeCertificateDetails(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("serialNumber"))
                        {
                            serialNumber = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("lastCertificateIssuanceTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            lastCertificateIssuanceTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("expirationTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            expirationTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("isPrivateKeyExternal"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isPrivateKeyExternal = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("appServiceCertificateNotRenewableReasons"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AppServiceCertificateNotRenewableReason> array = new List <AppServiceCertificateNotRenewableReason>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(new AppServiceCertificateNotRenewableReason(item.GetString()));
                            }
                            appServiceCertificateNotRenewableReasons = array;
                            continue;
                        }
                        if (property0.NameEquals("nextAutoRenewalTimeStamp"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            nextAutoRenewalTimeStamp = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("contact"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            contact = CertificateOrderContact.DeserializeCertificateOrderContact(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new AppServiceCertificateOrderData(id, name, type, systemData, tags, location, kind.Value, Optional.ToDictionary(certificates), distinguishedName.Value, domainVerificationToken.Value, Optional.ToNullable(validityInYears), Optional.ToNullable(keySize), Optional.ToNullable(productType), Optional.ToNullable(autoRenew), Optional.ToNullable(provisioningState), Optional.ToNullable(status), signedCertificate.Value, csr.Value, intermediate.Value, root.Value, serialNumber.Value, Optional.ToNullable(lastCertificateIssuanceTime), Optional.ToNullable(expirationTime), Optional.ToNullable(isPrivateKeyExternal), Optional.ToList(appServiceCertificateNotRenewableReasons), Optional.ToNullable(nextAutoRenewalTimeStamp), contact.Value));
        }
Exemplo n.º 57
0
 /// <summary>
 /// minio NFSに書き込まれた学習結果を一覧で取得する
 /// </summary>
 /// <param name="type">リソース種別</param>
 /// <param name="searchDirPath">検索対象ディレクトリ</param>
 public async Task <Result <StorageListResultInfo, string> > GetUnderDirAsync(ResourceType type, string searchDirPath)
 {
     searchDirPath = CreateKey(type, searchDirPath);
     return(await objectStorageService.GetUnderDirAsync("/" + searchDirPath));
 }
        public static ListedCapabilityStatement TryAddSearchParams(this ListedCapabilityStatement statement, ResourceType resourceType, IEnumerable <CapabilityStatement.SearchParamComponent> searchParams)
        {
            EnsureArg.IsNotNull(statement, nameof(statement));
            EnsureArg.IsNotNull(searchParams, nameof(searchParams));

            statement.BuildRestResourceComponent(resourceType, builder =>
            {
                builder.SearchParam = searchParams.ToList();
            });

            return(statement);
        }
Exemplo n.º 59
0
 /// <summary>
 /// ファイル種別とファイル名からオブジェクトストレージのキーを作成する。
 /// </summary>
 private string CreateKey(ResourceType type, string fileName)
 {
     return(type.ToString() + "/" + fileName);
 }
Exemplo n.º 60
0
        /// <summary>
        /// 指定したリソース種別と履歴データIDに対応するフォルダ階層以下の結果データを削除する。
        /// </summary>
        /// <remarks> type/historyId で指定するフォルダ階層以下のオブジェクトを全て削除する</remarks>
        /// <param name="type">リソース種別</param>
        /// <param name="historyId">履歴データID</param>
        public async Task DeleteResultsAsync(ResourceType type, long historyId)
        {
            var prefix = type.ToString() + "/" + historyId.ToString();

            await objectStorageService.DeleteObjectsAsync(config, prefix);
        }