Ejemplo n.º 1
0
        private void RetrieveDeviceConfiguration()
        {
            HardwareProfile hardware = arduino.DeviceHardwareProfile;

            if (hardware == null)
            {
                Network.Sender.WriteLog("Arduino Error: No Hardware Profile found.");
                return;
            }

            analogOffset = hardware.AnalogOffset;
            disabledPins = hardware.DisabledPins;
            analogPins   = hardware.AnalogPins;
            digitalPins  = hardware.DigitalPins;
            pwmPins      = hardware.PwmPins;
            i2cPins      = hardware.I2cPins;

            Network.Sender.WriteLog("Arduino Configuration: ");
            Network.Sender.WriteLog("  Digital  Pins: " + digitalPins.Count);
            Network.Sender.WriteLog("  Analog   Pins: " + analogPins.Count);
            Network.Sender.WriteLog("  Disabled Pins: " + disabledPins.Count);
            Network.Sender.WriteLog("  PWM      Pins: " + pwmPins.Count);
            Network.Sender.WriteLog("  i2c      Pins: " + i2cPins.Count);
            Network.Sender.WriteLog("  Analog Pin Offset: " + analogOffset);

            //ListPinConfiguration();
        }
Ejemplo n.º 2
0
        public void UpdateHardwareProfile(HardwareProfile hardwareProfile)
        {
            if (hardwareProfile != null)
            {
                if (_configuration != null && _configuration.Profile != null && _configuration.Profile.HardwareProfile != null)
                {
                    if (!String.IsNullOrEmpty(_configuration.Profile.HardwareProfile.OtherServers))
                    {
                        string[]      configServers       = _configuration.Profile.HardwareProfile.OtherServers.Split(',');
                        List <string> serverMachineIdList = hardwareProfile.OtherServers.Split(',').ToList <string>();

                        foreach (string server in configServers)
                        {
                            if (!serverMachineIdList.Contains(server))
                            {
                                serverMachineIdList.Add(server);
                            }
                        }

                        hardwareProfile.OtherServers = String.Join(",", serverMachineIdList);
                    }
                }

                _finalConfiguration.Profile.HardwareProfile = hardwareProfile;
            }

            else
            {
                if (_configuration != null && _configuration.Profile != null && _configuration.Profile.HardwareProfile != null)
                {
                    _finalConfiguration.Profile.HardwareProfile = hardwareProfile;
                }
            }
        }
Ejemplo n.º 3
0
 internal VirtualMachineScaleSetVmData(ResourceIdentifier id, string name, ResourceType type, IDictionary <string, string> tags, AzureLocation location, string instanceId, Models.Sku sku, Models.Plan plan, IReadOnlyList <VirtualMachineExtensionData> resources, IReadOnlyList <string> zones, bool?latestModelApplied, string vmId, VirtualMachineScaleSetVMInstanceView instanceView, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, SecurityProfile securityProfile, NetworkProfile networkProfile, VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration, DiagnosticsProfile diagnosticsProfile, WritableSubResource availabilitySet, string provisioningState, string licenseType, string modelDefinitionApplied, VirtualMachineScaleSetVMProtectionPolicy protectionPolicy, string userData) : base(id, name, type, tags, location)
 {
     InstanceId                  = instanceId;
     Sku                         = sku;
     Plan                        = plan;
     Resources                   = resources;
     Zones                       = zones;
     LatestModelApplied          = latestModelApplied;
     VmId                        = vmId;
     InstanceView                = instanceView;
     HardwareProfile             = hardwareProfile;
     StorageProfile              = storageProfile;
     AdditionalCapabilities      = additionalCapabilities;
     OsProfile                   = osProfile;
     SecurityProfile             = securityProfile;
     NetworkProfile              = networkProfile;
     NetworkProfileConfiguration = networkProfileConfiguration;
     DiagnosticsProfile          = diagnosticsProfile;
     AvailabilitySet             = availabilitySet;
     ProvisioningState           = provisioningState;
     LicenseType                 = licenseType;
     ModelDefinitionApplied      = modelDefinitionApplied;
     ProtectionPolicy            = protectionPolicy;
     UserData                    = userData;
 }
Ejemplo n.º 4
0
 internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, Models.Plan plan, IReadOnlyList <VirtualMachineExtensionData> resources, ManagedServiceIdentity identity, IList <string> zones, Models.ExtendedLocation extendedLocation, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, WritableSubResource availabilitySet, WritableSubResource virtualMachineScaleSet, WritableSubResource proximityPlacementGroup, VirtualMachinePriorityTypes?priority, VirtualMachineEvictionPolicyTypes?evictionPolicy, BillingProfile billingProfile, WritableSubResource host, WritableSubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int?platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, ApplicationProfile applicationProfile) : base(id, name, type, systemData, tags, location)
 {
     Plan                    = plan;
     Resources               = resources;
     Identity                = identity;
     Zones                   = zones;
     ExtendedLocation        = extendedLocation;
     HardwareProfile         = hardwareProfile;
     StorageProfile          = storageProfile;
     AdditionalCapabilities  = additionalCapabilities;
     OSProfile               = osProfile;
     NetworkProfile          = networkProfile;
     SecurityProfile         = securityProfile;
     DiagnosticsProfile      = diagnosticsProfile;
     AvailabilitySet         = availabilitySet;
     VirtualMachineScaleSet  = virtualMachineScaleSet;
     ProximityPlacementGroup = proximityPlacementGroup;
     Priority                = priority;
     EvictionPolicy          = evictionPolicy;
     BillingProfile          = billingProfile;
     Host                    = host;
     HostGroup               = hostGroup;
     ProvisioningState       = provisioningState;
     InstanceView            = instanceView;
     LicenseType             = licenseType;
     VmId                    = vmId;
     ExtensionsTimeBudget    = extensionsTimeBudget;
     PlatformFaultDomain     = platformFaultDomain;
     ScheduledEventsProfile  = scheduledEventsProfile;
     UserData                = userData;
     CapacityReservation     = capacityReservation;
     ApplicationProfile      = applicationProfile;
 }
 internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, SystemAssignedServiceIdentity identity, string resourcePoolId, string templateId, string vCenterId, PlacementProfile placementProfile, OSProfile osProfile, HardwareProfile hardwareProfile, NetworkProfile networkProfile, StorageProfile storageProfile, GuestAgentProfile guestAgentProfile, string moRefId, string inventoryItemId, string moName, string folderPath, string instanceUuid, string smbiosUuid, FirmwareType?firmwareType, string powerState, string customResourceName, string uuid, IReadOnlyList <ResourceStatus> statuses, string provisioningState, string vmId) : base(id, name, type, systemData, tags, location)
 {
     ExtendedLocation   = extendedLocation;
     Kind               = kind;
     Identity           = identity;
     ResourcePoolId     = resourcePoolId;
     TemplateId         = templateId;
     VCenterId          = vCenterId;
     PlacementProfile   = placementProfile;
     OSProfile          = osProfile;
     HardwareProfile    = hardwareProfile;
     NetworkProfile     = networkProfile;
     StorageProfile     = storageProfile;
     GuestAgentProfile  = guestAgentProfile;
     MoRefId            = moRefId;
     InventoryItemId    = inventoryItemId;
     MoName             = moName;
     FolderPath         = folderPath;
     InstanceUuid       = instanceUuid;
     SmbiosUuid         = smbiosUuid;
     FirmwareType       = firmwareType;
     PowerState         = powerState;
     CustomResourceName = customResourceName;
     Uuid               = uuid;
     Statuses           = statuses;
     ProvisioningState  = provisioningState;
     VmId               = vmId;
 }
Ejemplo n.º 6
0
        public void Prepare(PlanetVO planet, AssetsCompleteDelegate onLoadComplete, object cookie)
        {
            if (planet == this.currentPlanet)
            {
                onLoadComplete(cookie);
                return;
            }
            AssetManager assetManager = Service.Get <AssetManager>();

            if (this.planetAssetHandle != AssetHandle.Invalid)
            {
                assetManager.Unload(this.planetAssetHandle);
                this.planetAssetHandle = AssetHandle.Invalid;
            }
            this.currentPlanet = planet;
            this.Reset();
            List <string> list = new List <string>();
            string        text = HardwareProfile.IsLowEndDevice() ? (planet.AssetName + "-lod1") : planet.AssetName;

            list.Add(text);
            assetManager.RegisterPreloadableAsset(text);
            List <object> list2 = new List <object>();

            list2.Add(this.currentPlanet);
            List <AssetHandle> list3 = new List <AssetHandle>();

            list3.Add(AssetHandle.Invalid);
            assetManager.MultiLoad(list3, list, new AssetSuccessDelegate(this.AssetSuccess), null, list2, onLoadComplete, cookie);
            this.planetAssetHandle = list3[0];
        }
        public override void ExecuteCmdlet()
        {
            IEnumerable <HardwareProfile> results = null;
            var hardwareProfileOperations         = new HardwareProfileOperations(this.WebClientFactory);

            if (this.ParameterSetName == WAPackCmdletParameterSets.Empty)
            {
                results = hardwareProfileOperations.Read();
            }
            else if (this.ParameterSetName == WAPackCmdletParameterSets.FromId)
            {
                HardwareProfile hardwareProfile = null;
                hardwareProfile = hardwareProfileOperations.Read(ID);
                results         = new List <HardwareProfile>()
                {
                    hardwareProfile
                };
            }
            else if (this.ParameterSetName == WAPackCmdletParameterSets.FromName)
            {
                results = hardwareProfileOperations.Read(new Dictionary <string, string>()
                {
                    { "Name", Name }
                });
            }

            this.GenerateCmdletOutput(results);
        }
Ejemplo n.º 8
0
 public void AttachEffects(GameObject gameObject, object cookie)
 {
     if (!HardwareProfile.IsLowEndDevice())
     {
         PlanetVO planetVO = cookie as PlanetVO;
         this.LoadPlanetFX(planetVO.Uid, this.GetEffectNames(planetVO.PlanetaryFX), gameObject);
     }
 }
 internal RestorePointSourceMetadata(HardwareProfile hardwareProfile, RestorePointSourceVmStorageProfile storageProfile, OSProfile oSProfile, DiagnosticsProfile diagnosticsProfile, string licenseType, string vmId, SecurityProfile securityProfile, string location)
 {
     HardwareProfile    = hardwareProfile;
     StorageProfile     = storageProfile;
     OSProfile          = oSProfile;
     DiagnosticsProfile = diagnosticsProfile;
     LicenseType        = licenseType;
     VmId            = vmId;
     SecurityProfile = securityProfile;
     Location        = location;
 }
Ejemplo n.º 10
0
 public override void AddToGame(Game game)
 {
     this.entityController           = Service.EntityController;
     this.battleController           = Service.BattleController;
     this.troopAbilityController     = Service.TroopAbilityController;
     this.audioManager               = Service.AudioManager;
     this.specialAttackController    = Service.SpecialAttackController;
     this.squadTroopAttackController = Service.SquadTroopAttackController;
     this.buildingNodeList           = this.entityController.GetNodeList <BuildingNode>();
     this.troopNodeList              = this.entityController.GetNodeList <TroopNode>();
     this.audioResetDeltaMax         = ((!HardwareProfile.IsLowEndDevice()) ? 33u : 330u);
     this.audioResetDeltaAccumulator = this.audioResetDeltaMax;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Virtual Machine property
 /// </summary>
 /// <param name="_multiVM"></param>
 /// <param name="_hasDataDisk"></param>
 /// <param name="_useAvSet"></param>
 /// <param name="_useDiagAcc"></param>
 public Property_VirtualMachine(bool _multiVM, bool _hasDataDisk, bool _useAvSet, bool _useDiagAcc)
 {
     osProfile       = new OsProfile(_multiVM);
     hardwareProfile = new HardwareProfile();
     storageProfile  = new StorageProfile(_hasDataDisk);
     networkProfile  = new NetworkProfile(_multiVM);
     // Diagnostic Account
     if (_useDiagAcc)
     {
         diagnosticsProfile = new DiagnosticsProfile();
     }
     // Availability Set
     if (_useAvSet)
     {
         availabilitySet = new AvailabilitySet();
     }
 }
Ejemplo n.º 12
0
        public void ResetWorld()
        {
            EntityFactory entityFactory = Service.Get <EntityFactory>();
            EntityList    allEntities   = this.entityController.GetAllEntities();

            for (Entity entity = allEntities.Head; entity != null; entity = entity.Next)
            {
                entityFactory.DestroyEntity(entity, true, true);
            }
            this.DroidHut = null;
            Service.Get <SpatialIndexController>().Reset();
            Service.Get <BoardController>().ResetBoard();
            Service.Get <FXManager>().Reset();
            if (!HardwareProfile.IsLowEndDevice())
            {
                Service.Get <TerrainBlendController>().ResetTerrain();
            }
            Service.Get <EventManager>().SendEvent(EventId.WorldReset, null);
        }
Ejemplo n.º 13
0
        private void AssetSuccess(object asset, object cookie)
        {
            GameObject gameObject = asset as GameObject;
            PlanetVO   planetVO   = cookie as PlanetVO;
            bool       flag       = HardwareProfile.IsLowEndDevice();

            if (planetVO != null && !flag)
            {
                Service.Get <PlanetEffectController>().AttachEffects(gameObject, planetVO);
            }
            Transform transform = gameObject.transform;

            transform.position = Vector3.zero;
            transform.rotation = Quaternion.AngleAxis(-90f, Vector3.up);
            if (!flag && transform.FindChild("terrainInnerMesh"))
            {
                Service.Get <TerrainBlendController>().IndexTerrainMesh(gameObject);
            }
            this.groundAsset = gameObject;
            Vector3 vector;
            Vector3 vector2;
            Vector3 vector3;
            Vector3 vector4;

            Vector3[] array;
            if (!this.TryGetLocator(gameObject, "locator_lowerLeft", out vector) || !this.TryGetLocator(gameObject, "locator_lowerRight", out vector2) || !this.TryGetLocator(gameObject, "locator_upperLeft", out vector3) || !this.TryGetLocator(gameObject, "locator_upperRight", out vector4))
            {
                Service.Get <StaRTSLogger>().Warn("Unable to find corner locators");
                array = PlanetView.DEFAULT_CORNER_LOCATORS;
            }
            else
            {
                array = new Vector3[]
                {
                    vector,
                    vector2,
                    vector3,
                    vector4
                };
            }
            this.SetCornerLocators(array);
        }
Ejemplo n.º 14
0
 internal ScVmmVirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ExtendedLocation extendedLocation, string inventoryItemId, string vmmServerId, string cloudId, string templateId, string checkpointType, IList <Checkpoint> checkpoints, IList <AvailabilitySetListItem> availabilitySets, OSProfile osProfile, HardwareProfile hardwareProfile, NetworkProfile networkProfile, StorageProfile storageProfile, string vmName, string uuid, int?generation, string powerState, string provisioningState) : base(id, name, resourceType, systemData, tags, location)
 {
     ExtendedLocation  = extendedLocation;
     InventoryItemId   = inventoryItemId;
     VmmServerId       = vmmServerId;
     CloudId           = cloudId;
     TemplateId        = templateId;
     CheckpointType    = checkpointType;
     Checkpoints       = checkpoints;
     AvailabilitySets  = availabilitySets;
     OSProfile         = osProfile;
     HardwareProfile   = hardwareProfile;
     NetworkProfile    = networkProfile;
     StorageProfile    = storageProfile;
     VmName            = vmName;
     Uuid              = uuid;
     Generation        = generation;
     PowerState        = powerState;
     ProvisioningState = provisioningState;
 }
Ejemplo n.º 15
0
        public string GetMachineId()
        {
            string machineID = string.Empty;

            if (_configuration == null)
            {
                LoadConfiguration();
            }

            if (_configuration != null && _configuration.Profile != null)
            {
                HardwareProfile hardwareProfile = _configuration.Profile.HardwareProfile;
                if (hardwareProfile != null)
                {
                    machineID = hardwareProfile.MachineID;
                }
            }

            return(machineID);
        }
Ejemplo n.º 16
0
        private void RetrieveDeviceConfiguration()
        {
            HardwareProfile hardware = App.Arduino.DeviceHardwareProfile;

            if (hardware == null)
            {
                //This app will never use unsafe mode, so the hardware profile should never be null
                throw new NullReferenceException("RemoteDevice HardwareProfile is invalid");
            }

            analogOffset = hardware.AnalogOffset;
            disabledPins = hardware.DisabledPins;
            analogPins   = hardware.AnalogPins;
            digitalPins  = hardware.DigitalPins;
            pwmPins      = hardware.PwmPins;
            i2cPins      = hardware.I2cPins;

            //for the purposes of this app, we want to display disabled pins on the digital page and try to explain why they can't be used
            byte i = 0;

            foreach (byte b in disabledPins)
            {
                for ( ; i < digitalPins.Count; ++i)
                {
                    if (b < digitalPins[i])
                    {
                        digitalPins.Insert(i, b);
                        ++i;
                        break;
                    }
                }
            }

            //we want all analog pins to default to OUTPUT mode for the purposes of the digital page being the first page to load
            foreach (byte b in analogPins)
            {
                App.Arduino.pinMode(b, PinMode.OUTPUT);
            }
        }
Ejemplo n.º 17
0
        internal static VirtualMachineScaleSetVmData DeserializeVirtualMachineScaleSetVmData(JsonElement element)
        {
            Optional <string>      instanceId = default;
            Optional <Models.Sku>  sku        = default;
            Optional <Models.Plan> plan       = default;
            Optional <IReadOnlyList <VirtualMachineExtensionData> > resources = default;
            Optional <IReadOnlyList <string> > zones = default;
            IDictionary <string, string>       tags  = default;
            AzureLocation      location           = default;
            ResourceIdentifier id                 = default;
            string             name               = default;
            ResourceType       type               = default;
            SystemData         systemData         = default;
            Optional <bool>    latestModelApplied = default;
            Optional <string>  vmId               = default;
            Optional <VirtualMachineScaleSetVmInstanceView> instanceView = default;
            Optional <HardwareProfile>        hardwareProfile            = default;
            Optional <StorageProfile>         storageProfile             = default;
            Optional <AdditionalCapabilities> additionalCapabilities     = default;
            Optional <OSProfile>       osProfile       = default;
            Optional <SecurityProfile> securityProfile = default;
            Optional <NetworkProfile>  networkProfile  = default;
            Optional <VirtualMachineScaleSetVmNetworkProfileConfiguration> networkProfileConfiguration = default;
            Optional <DiagnosticsProfile>  diagnosticsProfile = default;
            Optional <WritableSubResource> availabilitySet    = default;
            Optional <string> provisioningState      = default;
            Optional <string> licenseType            = default;
            Optional <string> modelDefinitionApplied = default;
            Optional <VirtualMachineScaleSetVmProtectionPolicy> protectionPolicy = default;
            Optional <string> userData = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("instanceId"))
                {
                    instanceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = Models.Sku.DeserializeSku(property.Value);
                    continue;
                }
                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("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("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("latestModelApplied"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            latestModelApplied = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("vmId"))
                        {
                            vmId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("instanceView"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            instanceView = VirtualMachineScaleSetVmInstanceView.DeserializeVirtualMachineScaleSetVmInstanceView(property0.Value);
                            continue;
                        }
                        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("securityProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            securityProfile = SecurityProfile.DeserializeSecurityProfile(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("networkProfileConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            networkProfileConfiguration = VirtualMachineScaleSetVmNetworkProfileConfiguration.DeserializeVirtualMachineScaleSetVmNetworkProfileConfiguration(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("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("licenseType"))
                        {
                            licenseType = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("modelDefinitionApplied"))
                        {
                            modelDefinitionApplied = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("protectionPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            protectionPolicy = VirtualMachineScaleSetVmProtectionPolicy.DeserializeVirtualMachineScaleSetVmProtectionPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("userData"))
                        {
                            userData = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VirtualMachineScaleSetVmData(id, name, type, systemData, tags, location, instanceId.Value, sku.Value, plan.Value, Optional.ToList(resources), Optional.ToList(zones), Optional.ToNullable(latestModelApplied), vmId.Value, instanceView.Value, hardwareProfile.Value, storageProfile.Value, additionalCapabilities.Value, osProfile.Value, securityProfile.Value, networkProfile.Value, networkProfileConfiguration.Value, diagnosticsProfile.Value, availabilitySet, provisioningState.Value, licenseType.Value, modelDefinitionApplied.Value, protectionPolicy.Value, userData.Value));
        }
Ejemplo n.º 18
0
        public void Render(ProjectorConfig config)
        {
            if (!config.AssetReady)
            {
                return;
            }
            if (string.IsNullOrEmpty(config.buildingEquipmentShaderName) || config.AnimPreference == AnimationPreference.NoAnimation || (config.AnimPreference == AnimationPreference.AnimationPreferred && HardwareProfile.IsLowEndDevice()))
            {
                this.baseRenderer.Render(config);
                return;
            }
            this.materialCopies = new List <Material>();
            Dictionary <Material, Material> dictionary = new Dictionary <Material, Material>();
            Shader shader = Service.AssetManager.Shaders.GetShader(config.buildingEquipmentShaderName);
            AssetMeshDataMonoBehaviour component = config.MainAsset.GetComponent <AssetMeshDataMonoBehaviour>();

            if (component != null)
            {
                int count = component.SelectableGameObjects.Count;
                for (int i = 0; i < count; i++)
                {
                    Renderer component2 = component.SelectableGameObjects[i].GetComponent <Renderer>();
                    if (component2.sharedMaterial == null)
                    {
                        Service.Logger.ErrorFormat("sharedMaterial missing on {0}", new object[]
                        {
                            component.SelectableGameObjects[i].name
                        });
                    }
                    else if (dictionary.ContainsKey(component2.sharedMaterial))
                    {
                        component2.sharedMaterial = dictionary[component2.sharedMaterial];
                    }
                    else
                    {
                        Material material = UnityUtils.EnsureMaterialCopy(component2);
                        this.materialCopies.Add(material);
                        dictionary.Add(component2.sharedMaterial, material);
                        material.shader = shader;
                    }
                }
            }
            dictionary.Clear();
            this.baseRenderer.Render(config);
        }
        internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement element)
        {
            Optional <Plan> plan = default;
            Optional <IReadOnlyList <VirtualMachineExtensionData> > resources = default;
            Optional <ResourceIdentity>  identity                                = default;
            Optional <IList <string> >   zones                                   = default;
            Optional <ExtendedLocation>  extendedLocation                        = default;
            IDictionary <string, string> tags                                    = default;
            Location                                     location                = default;
            ResourceIdentifier                           id                      = default;
            string                                       name                    = default;
            ResourceType                                 type                    = 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 <Models.SubResource>                availabilitySet         = default;
            Optional <Models.SubResource>                virtualMachineScaleSet  = default;
            Optional <Models.SubResource>                proximityPlacementGroup = default;
            Optional <VirtualMachinePriorityTypes>       priority                = default;
            Optional <VirtualMachineEvictionPolicyTypes> evictionPolicy          = default;
            Optional <BillingProfile>                    billingProfile          = default;
            Optional <Models.SubResource>                host                    = default;
            Optional <Models.SubResource>                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;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("plan"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    plan = 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 <ResourceIdentity>(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 = 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 = 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("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 = Models.SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("virtualMachineScaleSet"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            virtualMachineScaleSet = Models.SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("proximityPlacementGroup"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            proximityPlacementGroup = Models.SubResource.DeserializeSubResource(property0.Value);
                            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 = Models.SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("hostGroup"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hostGroup = Models.SubResource.DeserializeSubResource(property0.Value);
                            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;
                        }
                    }
                    continue;
                }
            }
            return(new VirtualMachineData(id, name, type, 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.Value, virtualMachineScaleSet.Value, proximityPlacementGroup.Value, Optional.ToNullable(priority), Optional.ToNullable(evictionPolicy), billingProfile.Value, host.Value, hostGroup.Value, provisioningState.Value, instanceView.Value, licenseType.Value, vmId.Value, extensionsTimeBudget.Value, Optional.ToNullable(platformFaultDomain), scheduledEventsProfile.Value, userData.Value));
        }
Ejemplo n.º 20
0
        internal static ScVmmVirtualMachineData DeserializeScVmmVirtualMachineData(JsonElement element)
        {
            ExtendedLocation             extendedLocation  = default;
            IDictionary <string, string> tags              = default;
            AzureLocation                  location        = default;
            ResourceIdentifier             id              = default;
            string                         name            = default;
            ResourceType                   type            = default;
            SystemData                     systemData      = default;
            Optional <string>              inventoryItemId = default;
            Optional <string>              vmmServerId     = default;
            Optional <string>              cloudId         = default;
            Optional <string>              templateId      = default;
            Optional <string>              checkpointType  = default;
            Optional <IList <Checkpoint> > checkpoints     = default;
            Optional <IList <AvailabilitySetListItem> > availabilitySets = default;
            Optional <OSProfile>       osProfile         = default;
            Optional <HardwareProfile> hardwareProfile   = default;
            Optional <NetworkProfile>  networkProfile    = default;
            Optional <StorageProfile>  storageProfile    = default;
            Optional <string>          vmName            = default;
            Optional <string>          uuid              = default;
            Optional <int>             generation        = default;
            Optional <string>          powerState        = default;
            Optional <string>          provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("extendedLocation"))
                {
                    extendedLocation = 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 = 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("inventoryItemId"))
                        {
                            inventoryItemId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("vmmServerId"))
                        {
                            vmmServerId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("cloudId"))
                        {
                            cloudId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("templateId"))
                        {
                            templateId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("checkpointType"))
                        {
                            checkpointType = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("checkpoints"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <Checkpoint> array = new List <Checkpoint>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Checkpoint.DeserializeCheckpoint(item));
                            }
                            checkpoints = array;
                            continue;
                        }
                        if (property0.NameEquals("availabilitySets"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AvailabilitySetListItem> array = new List <AvailabilitySetListItem>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AvailabilitySetListItem.DeserializeAvailabilitySetListItem(item));
                            }
                            availabilitySets = array;
                            continue;
                        }
                        if (property0.NameEquals("osProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            osProfile = OSProfile.DeserializeOSProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("hardwareProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hardwareProfile = HardwareProfile.DeserializeHardwareProfile(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("storageProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            storageProfile = StorageProfile.DeserializeStorageProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("vmName"))
                        {
                            vmName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("uuid"))
                        {
                            uuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("generation"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            generation = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("powerState"))
                        {
                            powerState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ScVmmVirtualMachineData(id, name, type, systemData, tags, location, extendedLocation, inventoryItemId.Value, vmmServerId.Value, cloudId.Value, templateId.Value, checkpointType.Value, Optional.ToList(checkpoints), Optional.ToList(availabilitySets), osProfile.Value, hardwareProfile.Value, networkProfile.Value, storageProfile.Value, vmName.Value, uuid.Value, Optional.ToNullable(generation), powerState.Value, provisioningState.Value));
        }
Ejemplo n.º 21
0
 public static HardwareProfile CreateHardwareProfile(global::System.Guid stampId, global::System.Guid ID, global::System.Collections.ObjectModel.ObservableCollection<UserAndRole> grantedToList)
 {
     HardwareProfile hardwareProfile = new HardwareProfile();
     hardwareProfile.StampId = stampId;
     hardwareProfile.ID = ID;
     if ((grantedToList == null))
     {
         throw new global::System.ArgumentNullException("grantedToList");
     }
     hardwareProfile.GrantedToList = grantedToList;
     return hardwareProfile;
 }
Ejemplo n.º 22
0
        internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement element)
        {
            Optional <ExtendedLocation> extendedLocation      = default;
            Optional <string>           kind                  = default;
            Optional <SystemAssignedServiceIdentity> identity = default;
            IDictionary <string, string>             tags     = default;
            AzureLocation                location             = default;
            ResourceIdentifier           id                     = default;
            string                       name                   = default;
            ResourceType                 type                   = default;
            SystemData                   systemData             = default;
            Optional <string>            resourcePoolId         = default;
            Optional <string>            templateId             = default;
            Optional <string>            vCenterId              = default;
            Optional <PlacementProfile>  placementProfile       = default;
            Optional <OSProfile>         osProfile              = default;
            Optional <HardwareProfile>   hardwareProfile        = default;
            Optional <NetworkProfile>    networkProfile         = default;
            Optional <StorageProfile>    storageProfile         = default;
            Optional <GuestAgentProfile> guestAgentProfile      = default;
            Optional <string>            moRefId                = default;
            Optional <string>            inventoryItemId        = default;
            Optional <string>            moName                 = default;
            Optional <string>            folderPath             = default;
            Optional <string>            instanceUuid           = default;
            Optional <string>            smbiosUuid             = default;
            Optional <FirmwareType>      firmwareType           = default;
            Optional <string>            powerState             = default;
            Optional <string>            customResourceName     = default;
            Optional <string>            uuid                   = default;
            Optional <IReadOnlyList <ResourceStatus> > statuses = default;
            Optional <string> provisioningState                 = default;
            Optional <string> vmId = 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("kind"))
                {
                    kind = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    identity = JsonSerializer.Deserialize <SystemAssignedServiceIdentity>(property.Value.ToString());
                    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("resourcePoolId"))
                        {
                            resourcePoolId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("templateId"))
                        {
                            templateId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("vCenterId"))
                        {
                            vCenterId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("placementProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            placementProfile = PlacementProfile.DeserializePlacementProfile(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("hardwareProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hardwareProfile = HardwareProfile.DeserializeHardwareProfile(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("storageProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            storageProfile = StorageProfile.DeserializeStorageProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("guestAgentProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            guestAgentProfile = GuestAgentProfile.DeserializeGuestAgentProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("moRefId"))
                        {
                            moRefId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("inventoryItemId"))
                        {
                            inventoryItemId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("moName"))
                        {
                            moName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("folderPath"))
                        {
                            folderPath = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("instanceUuid"))
                        {
                            instanceUuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("smbiosUuid"))
                        {
                            smbiosUuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("firmwareType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            firmwareType = new FirmwareType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("powerState"))
                        {
                            powerState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("customResourceName"))
                        {
                            customResourceName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("uuid"))
                        {
                            uuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("statuses"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ResourceStatus> array = new List <ResourceStatus>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ResourceStatus.DeserializeResourceStatus(item));
                            }
                            statuses = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("vmId"))
                        {
                            vmId = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VirtualMachineData(id, name, type, systemData, tags, location, extendedLocation.Value, kind.Value, identity, resourcePoolId.Value, templateId.Value, vCenterId.Value, placementProfile.Value, osProfile.Value, hardwareProfile.Value, networkProfile.Value, storageProfile.Value, guestAgentProfile.Value, moRefId.Value, inventoryItemId.Value, moName.Value, folderPath.Value, instanceUuid.Value, smbiosUuid.Value, Optional.ToNullable(firmwareType), powerState.Value, customResourceName.Value, uuid.Value, Optional.ToList(statuses), provisioningState.Value, vmId.Value));
        }
Ejemplo n.º 23
0
 private static bool CanBeAnimated(ProjectorConfig config)
 {
     return(config.AnimPreference == AnimationPreference.AnimationAlways || (config.AnimPreference == AnimationPreference.AnimationPreferred && !HardwareProfile.IsLowEndDevice()));
 }
Ejemplo n.º 24
0
        public static GeometryProjector GenerateProjector(ProjectorConfig config)
        {
            GeometryProjector geometryProjector = new GeometryProjector(config);

            if (config.FrameSprite != null)
            {
                geometryProjector.Renderer = new SpriteProjectorRenderer(config.FrameSprite, geometryProjector.ProjectorIndex);
            }
            else
            {
                geometryProjector.Renderer = new SurfaceProjectorRenderer(geometryProjector.ProjectorIndex);
            }
            if (config.Metered)
            {
                geometryProjector.Renderer = new ProjectorMeterDecorator(geometryProjector.Renderer);
            }
            geometryProjector.Renderer = new ProjectorOutlineDecorator(geometryProjector.Renderer);
            if (!string.IsNullOrEmpty(config.TrackerName))
            {
                geometryProjector.Renderer = new ProjectorTurretDecorator(geometryProjector.Renderer);
            }
            if (!string.IsNullOrEmpty(config.buildingEquipmentShaderName) && ProjectorUtils.CanBeAnimated(config))
            {
                geometryProjector.Renderer = new ProjectorEquipmentBuildingDecorator(geometryProjector.Renderer);
            }
            else
            {
                geometryProjector.Renderer = new ProjectorShaderSwapDecorator(geometryProjector.Renderer);
            }
            geometryProjector.Renderer = new ProjectorAnimationDecorator(geometryProjector.Renderer);
            bool flag  = config.AnimPreference == AnimationPreference.NoAnimation;
            bool flag2 = config.AnimPreference == AnimationPreference.AnimationPreferred && HardwareProfile.IsLowEndDevice();

            if (!flag && !flag2 && config.IconRotationSpeed > 0f)
            {
                geometryProjector.Renderer = new ProjectorRotationDecorator(geometryProjector.Renderer);
            }
            ProjectorAssetProcessor arg_16C_0 = geometryProjector.AssetProcessor;

            if (ProjectorUtils.< > f__mg$cache0 == null)
            {
                ProjectorUtils.< > f__mg$cache0 = new Action <GeometryProjector>(ProjectorUtils.OnDefaultAssetSuccess);
            }
            Action <GeometryProjector> arg_16C_1 = ProjectorUtils.< > f__mg$cache0;

            if (ProjectorUtils.< > f__mg$cache1 == null)
            {
                ProjectorUtils.< > f__mg$cache1 = new Action <GeometryProjector>(ProjectorUtils.OnDefaultAssetFailure);
            }
            arg_16C_0.LoadAllAssets(arg_16C_1, ProjectorUtils.< > f__mg$cache1);
            return(geometryProjector);
        }
        public virtual void Render(ProjectorConfig config)
        {
            this.config = config;
            bool flag  = config.AnimPreference == AnimationPreference.NoAnimation;
            bool flag2 = config.AnimPreference == AnimationPreference.AnimationPreferred && HardwareProfile.IsLowEndDevice();

            this.snapshot = (flag | flag2);
            if (this.snapshot)
            {
                this.renderCallback     = config.RenderCallback;
                this.snapshotFrameCount = config.SnapshotFrameDelay;
                Service.Get <ViewTimeEngine>().RegisterFrameTimeObserver(this);
                return;
            }
            if (config.RenderCallback != null)
            {
                config.RenderCallback.Invoke(this.renderTexture, config);
            }
        }
 public AzureHDInsightHardwareProfile(HardwareProfile hardwareProfile)
 {
     VmSize = hardwareProfile.VmSize;
 }
Ejemplo n.º 27
0
        public override void Start()
        {
            Service.Get <EventManager>().SendEvent(EventId.InitializeGeneralSystemsStart, null);
            new WorldTransitioner();
            new VictoryConditionController();
            new DefensiveBattleController();
            new RaidDefenseController();
            new CombatTriggerManager();
            new TrapViewController();
            new TrapController();
            new BattleController();
            new BattleRecordController();
            new BattlePlaybackController();
            new PostBattleRepairController();
            new ShooterController();
            new TargetingController();
            new TurretAttackController();
            new TroopAttackController();
            new BuffController();
            new TroopAbilityController();
            new ArmoryController();
            new DeployableShardUnlockController();
            new FXManager();
            new AnimationEventManager();
            new StarportDecalManager();
            if (!HardwareProfile.IsLowEndDevice())
            {
                new TerrainBlendController();
            }
            new BuildingTooltipController();
            new CurrencyEffects();
            new CurrencyController();
            new StorageEffects();
            new AnimController();
            new UnlockController();
            new RewardManager();
            new CampaignController();
            new TournamentController();
            new PvpManager();
            new NeighborVisitManager();
            new TransportController();
            new ShuttleController();
            new ShieldEffects();
            new ShieldController();
            new MobilizationEffectsManager();
            new SocialPushNotificationController();
            new FactionIconUpgradeController();
            new TroopDonationTrackController();
            new LimitedEditionItemController();
            VideoPlayerKeepAlive.Init();
            new VideoDataManager();
            if (GameConstants.IsMakerVideoEnabled())
            {
                new ThumbnailManager();
            }
            Service.Get <NotificationController>().Init();
            Service.Get <EventManager>().SendEvent(EventId.InitializeGeneralSystemsEnd, null);
            new TargetedBundleController();
            HolonetController holonetController = new HolonetController();

            holonetController.PrepareContent(new HolonetController.HolonetPreparedDelegate(this.OnHolonetPrepared));
            new InventoryCrateRewardController();
            new ObjectiveManager();
            new ObjectiveController();
        }