コード例 #1
0
        private void ModelOnPropertyChanged(object sender, PropertyChangedEventArgs args)
        {
            switch (args.PropertyName)
            {
            case "Status":
                ResourceStatus newStatus = Model.Status;
                _dispatcherQueue.Push(() => { Status = newStatus; });
                break;

            case "HttpStatus":
                HttpStatusCode newHttpStatus = Model.HttpStatus;
                _dispatcherQueue.Push(() => { HttpStatus = newHttpStatus; });
                break;

            case "TimeProcessing":
                TimeSpan newTimeProcessing = Model.TimeProcessing;
                _dispatcherQueue.Push(() => { Duration = newTimeProcessing; });
                break;

            case "CurrentBucket":
                string newCurrentbucket = Model.CurrentBucket;
                _dispatcherQueue.Push(() => { CurrentBucket = newCurrentbucket; });
                break;
            }
        }
コード例 #2
0
ファイル: Resource.cs プロジェクト: mdavis60/PolyRents
 public Resource(int idResource, ResourceType type, ResourceStatus status, string statusDescription)
 {
     this.idResource        = idResource;
     this.type              = type;
     this.status            = status;
     this.statusDescription = statusDescription;
 }
コード例 #3
0
 public void Write
 (
     System.Xml.XmlWriter xmlWriter,
     ResourceStatus resourceStatus
 )
 {
     if (resourceStatus == ResourceStatus.Unknown)
     {
         return;
     }
     if (String.IsNullOrEmpty(xmlWriter.LookupPrefix(Configuration.Namespaces.XCRICAP11NamespaceUri)))
     {
         xmlWriter.WriteAttributeString
         (
             "recstatus",
             ((int)resourceStatus).ToString()
         );
     }
     else
     {
         xmlWriter.WriteAttributeString
         (
             "recstatus",
             Configuration.Namespaces.XCRICAP11NamespaceUri,
             ((int)resourceStatus).ToString()
         );
     }
 }
コード例 #4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (summary_ != null)
            {
                hash ^= Summary.GetHashCode();
            }
            if (processStatus_ != null)
            {
                hash ^= ProcessStatus.GetHashCode();
            }
            if (channelStatus_ != null)
            {
                hash ^= ChannelStatus.GetHashCode();
            }
            if (resourceStatus_ != null)
            {
                hash ^= ResourceStatus.GetHashCode();
            }
            if (otherStatus_ != null)
            {
                hash ^= OtherStatus.GetHashCode();
            }
            return(hash);
        }
コード例 #5
0
ファイル: Resource.cs プロジェクト: mdavis60/PolyRents
 public Resource(Resource other)
 {
     this.idResource        = other.idResource;
     this.type              = other.type;
     this.status            = other.status;
     this.statusDescription = other.statusDescription;
 }
コード例 #6
0
ファイル: Merchant.cs プロジェクト: mntabania/DwarfFortress
    void StartTrade()
    {
        for (int i = 0; i < tradeGoods.Count; i++)
        {
            Resource       currentTradeGood          = tradeGoods[i];
            ResourceStatus resourceStatusOfOtherCity = this.targetCity.GetResourceStatusByType(currentTradeGood.resourceType);
            if (resourceStatusOfOtherCity.status == RESOURCE_STATUS.SCARCE)
            {
                int costPerResourceUnit      = this.GetCostPerResourceUnit(currentTradeGood.resourceType);
                int totalCostOfWholeResource = resourceStatusOfOtherCity.amount * costPerResourceUnit;
                int numOfResourcesAfforded   = (int)Math.Floor((double)(targetCity.goldCount / costPerResourceUnit));

                if (numOfResourcesAfforded > currentTradeGood.resourceQuantity)
                {
                    numOfResourcesAfforded = currentTradeGood.resourceQuantity;
                }

                if (numOfResourcesAfforded <= 0)
                {
                    //target city cannot afford to buy the offered resource
                    this.targetCity.cityLogs += GameManager.Instance.currentDay.ToString() + ": Merchant from " + this.citizen.city.cityName + " arrived, offering "
                                                + currentTradeGood.resourceType.ToString() + ", but rejected because the city cannot afford to buy.\n\n";
                    continue;
                }

                DECISION tradeCityDecision = DECISION.NONE;
                if (targetCity.kingdomTile.kingdom.id != this.citizen.city.id)
                {
                    tradeCityDecision = this.targetCity.kingdomTile.kingdom.lord.ComputeDecisionBasedOnPersonality(LORD_EVENTS.TRADE, this.citizen.city.kingdomTile.kingdom.lord);
                }

                if (tradeCityDecision == DECISION.NICE || tradeCityDecision == DECISION.NONE)
                {
                    this.ProcessTransaction(currentTradeGood.resourceType, numOfResourcesAfforded, numOfResourcesAfforded * costPerResourceUnit);
                    this.citizen.city.cityLogs += GameManager.Instance.currentDay.ToString() + ": Merchant has sold [FF0000]" + numOfResourcesAfforded + " " + currentTradeGood.resourceType.ToString() + "[-] in exchange for [FF0000]"
                                                  + (numOfResourcesAfforded * costPerResourceUnit).ToString() + " GOLD[-].\n\n";

                    this.targetCity.cityLogs += GameManager.Instance.currentDay.ToString() + ": City has bought [FF0000]" + numOfResourcesAfforded + " " + currentTradeGood.resourceType.ToString() + "[-] in exchange for [FF0000]"
                                                + (numOfResourcesAfforded * costPerResourceUnit).ToString() + " GOLD[-].\n\n";

                    UserInterfaceManager.Instance.externalAffairsLogList [UserInterfaceManager.Instance.externalAffairsLogList.Count - 1] += GameManager.Instance.currentDay.ToString() + ": TRADE: " + this.targetCity.kingdomTile.kingdom.lord.name + " ACCEPTED the trade.\n\n";
                }
                else
                {
                    this.citizen.city.kingdomTile.kingdom.lord.AdjustLikeness(this.targetCity.kingdomTile.kingdom.lord, DECISION.NEUTRAL, DECISION.RUDE, LORD_EVENTS.TRADE, true);
                    this.targetCity.kingdomTile.kingdom.lord.AdjustLikeness(this.citizen.city.kingdomTile.kingdom.lord, DECISION.RUDE, DECISION.NEUTRAL, LORD_EVENTS.TRADE, false);

                    this.citizen.city.cityLogs += GameManager.Instance.currentDay.ToString() + ": Trade was rejected by lord of city [FF0000]" + this.targetCity.cityName + "[-].\n\n";
                    this.targetCity.cityLogs   += GameManager.Instance.currentDay.ToString() + ": Trade from " + this.citizen.city.cityName + " was rejected this city's lord.\n\n";

                    UserInterfaceManager.Instance.externalAffairsLogList [UserInterfaceManager.Instance.externalAffairsLogList.Count - 1] += GameManager.Instance.currentDay.ToString() + ": TRADE: " + this.targetCity.kingdomTile.kingdom.lord.name + " REJECTED the trade.\n\n";
                }
            }
            else
            {
                this.targetCity.cityLogs += GameManager.Instance.currentDay.ToString() + ": Merchant from " + this.citizen.city.cityName + " arrived, offering "
                                            + currentTradeGood.resourceType.ToString() + ", but rejected since the city does not need more of that resource.\n\n";
            }
        }
    }
コード例 #7
0
            public void ResourceStatusShouldDeserialize(
                string resourceStatus
                )
            {
                var source = $@"""ResourceStatus={resourceStatus}""";
                var result = JsonSerializer.Deserialize <CloudFormationStackEvent>(source);

                result !.ResourceStatus.Should().Be(resourceStatus);
            }
コード例 #8
0
ファイル: ResourceThruput.cs プロジェクト: kyjb2000/uo-mes
        protected override bool ModifyEntity()
        {
            bool           success        = base.ModifyEntity();
            ResourceStatus resourceStatus = new ResourceStatus();

            resourceStatus.Name = "Run";
            ResourceProductionInfo.ResourceStatus = ResolveCDO(resourceStatus.GetType(), resourceStatus.Name) as ResourceStatus;
            return(success);
        }
コード例 #9
0
 /// <summary>
 /// See <see cref="IResourceDataAccessor.GetResourceStatus"/>. The
 /// status returned is the status returned by the first accessor which differs from
 /// <see cref="ResourceStatus.NotAvailable"/>.
 /// </summary>
 public ResourceStatus GetResourceStatus(System.Globalization.CultureInfo culture,
                                         LanguageResourceType t, bool fallback)
 {
     for (int i = 0; i < _IndividualAccessors.Count; ++i)
     {
         ResourceStatus s = _IndividualAccessors[i].GetResourceStatus(culture, t, fallback);
         if (s != ResourceStatus.NotAvailable)
         {
             return(s);
         }
     }
     return(ResourceStatus.NotAvailable);
 }
コード例 #10
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="callSign">The unique identification code of the resource</param>
        /// <param name="database">The database connection interface for retrieving generic resource information</param>
        /// <param name="name">The name of the resource</param>
        /// <param name="mobilePhoneNumber">The resource's mobile phone number</param>
        /// <param name="baseLocation">The base location of the resource</param>
        /// <param name="currentLocation">The current location of the resource</param>
        /// <param name="currentStatus">The current resource status</param>
        public Resource(string callSign, string name, string mobilePhoneNumber, Base baseLocation, Address currentLocation, ResourceStatus currentStatus, int assignedIncident)
        {
            //assign parameters to fields
            CallSign      = callSign;
            this.database = Tools.ResourceDB;

            this.name = name;
            this.mobilePhoneNumber = mobilePhoneNumber;
            this.baseLocation      = baseLocation;
            this.currentLocation   = currentLocation;
            this.currentStatus     = currentStatus;
            this.assignedIncident  = assignedIncident;
        }
コード例 #11
0
        /// <summary>
        /// Buffer registration
        /// </summary>
        /// <param name="type">Type of buffer</param>
        /// <param name="name">Name</param>
        /// <param name="usage">Resource usage</param>
        /// <param name="binding">Binding flags</param>
        /// <param name="sizeInBytes">Size in bytes</param>
        /// <param name="length">Number of elements</param>
        public static void RegBuffer(Type type, string name, int usage, int binding, long sizeInBytes, int length)
        {
            Buffers++;

            var key = string.Format("{0}.{1}", usage, type);

            if (!(Counters.GetStatistics(key) is ResourceStatus c))
            {
                c = new ResourceStatus();
                Counters.SetStatistics(key, c, true);
            }

            c.Add(name, usage, binding, sizeInBytes, length);
        }
コード例 #12
0
 /// <summary>
 /// See <see cref="IResourceDataAccessor.ReadResourceData"/>.
 /// The data returned is the data returned by the first accessor which has available data.
 /// </summary>
 public System.IO.Stream ReadResourceData(System.Globalization.CultureInfo culture,
                                          LanguageResourceType t, bool fallback)
 {
     for (int i = 0; i < _IndividualAccessors.Count; ++i)
     {
         // TODO could cache this information
         ResourceStatus s = _IndividualAccessors[i].GetResourceStatus(culture, t, fallback);
         if (s != ResourceStatus.NotAvailable)
         {
             return(_IndividualAccessors[i].ReadResourceData(culture, t, fallback));
         }
     }
     return(null);
 }
コード例 #13
0
        public ResourceTreeItem(ProjectReader reader)
        {
            Status  = (ResourceStatus)reader.ReadInt32();
            ResType = RESOURCE_KIND[reader.ReadInt32()];
            Index   = reader.ReadInt32();
            Name    = reader.ReadString();
            int content = reader.ReadInt32();

            Resources = new List <ResourceTreeItem>(content);
            for (int i = 0; i < content; i++)
            {
                Resources.Add(new ResourceTreeItem(reader));
            }
        }
コード例 #14
0
        /// <summary>
        /// Assigns a resource to a specified incident.  If this prototype was developed further, it would be here
        /// that external systems would be contacted to physically mobilise the appliances
        /// </summary>
        /// <param name="callSign">The unique callsign of the resource to mobilise</param>
        /// <param name="incidentNumber">The unique number of the incident to mobilise to</param>
        /// <param name="user">The user that carried out the mobilisation</param>
        /// <param name="trigger">The mobilising method that was used to contact the appliance, for example station bells</param>
        /// <returns>True if the resource was assigned successfully, false otherwise</returns>
        public bool AssignResource(string callSign, int incidentNumber, int user, string trigger)
        {
            //first add the resource to assign to the incident
            Tools.ResourceDB.SetToAlerted(callSign, DateTime.Now, incidentNumber, trigger, user);

            //then change the status of the resource to 'alerted'
            //retrieve all the resource states and find one that marks the resource as alerted
            List<ResourceStatus> states = new List<ResourceStatus>(Tools.ResourceControllerDB.GetAllResourceStates());
            ResourceStatus alertedStatus = states.Find(x => x.IncidentLogAction == ResourceLogTime.Alerted);

            //Create an appliance object with the callsign and then assign it the alerted status
            Appliance appliance = Tools.ResourceControllerDB.GetAppliance(callSign);
            appliance.CurrentResourceStatus = alertedStatus;

            return true;
        }
コード例 #15
0
 public void MergeFrom(Component other)
 {
     if (other == null)
     {
         return;
     }
     if (other.summary_ != null)
     {
         if (summary_ == null)
         {
             summary_ = new global::Apollo.Monitor.ComponentStatus();
         }
         Summary.MergeFrom(other.Summary);
     }
     if (other.processStatus_ != null)
     {
         if (processStatus_ == null)
         {
             processStatus_ = new global::Apollo.Monitor.ComponentStatus();
         }
         ProcessStatus.MergeFrom(other.ProcessStatus);
     }
     if (other.channelStatus_ != null)
     {
         if (channelStatus_ == null)
         {
             channelStatus_ = new global::Apollo.Monitor.ComponentStatus();
         }
         ChannelStatus.MergeFrom(other.ChannelStatus);
     }
     if (other.resourceStatus_ != null)
     {
         if (resourceStatus_ == null)
         {
             resourceStatus_ = new global::Apollo.Monitor.ComponentStatus();
         }
         ResourceStatus.MergeFrom(other.ResourceStatus);
     }
     if (other.otherStatus_ != null)
     {
         if (otherStatus_ == null)
         {
             otherStatus_ = new global::Apollo.Monitor.ComponentStatus();
         }
         OtherStatus.MergeFrom(other.OtherStatus);
     }
 }
コード例 #16
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ResourceName.Length != 0)
            {
                hash ^= ResourceName.GetHashCode();
            }
            if (lastChangeDateTime_ != null)
            {
                hash ^= LastChangeDateTime.GetHashCode();
            }
            if (ResourceType != 0)
            {
                hash ^= ResourceType.GetHashCode();
            }
            if (campaign_ != null)
            {
                hash ^= Campaign.GetHashCode();
            }
            if (adGroup_ != null)
            {
                hash ^= AdGroup.GetHashCode();
            }
            if (ResourceStatus != 0)
            {
                hash ^= ResourceStatus.GetHashCode();
            }
            if (adGroupAd_ != null)
            {
                hash ^= AdGroupAd.GetHashCode();
            }
            if (adGroupCriterion_ != null)
            {
                hash ^= AdGroupCriterion.GetHashCode();
            }
            if (campaignCriterion_ != null)
            {
                hash ^= CampaignCriterion.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #17
0
ファイル: T20_ResourceTxn.cs プロジェクト: kyjb2000/uo-mes
        public void T10_ResourceSetup_WD01()
        {
            ResourceSetup s = new ResourceSetup();

            s.Resource_Name = "WD-01";

            ResourceStatusReason r = new ResourceStatusReason();

            s.ResourceStatusReason = r;

            ResourceStatus tostatus = new ResourceStatus();

            tostatus.Name      = "PM";
            s.ResourceToStatus = tostatus;

            Assert.IsTrue(s.ExecuteService(), s.CompletionMessage);
        }
コード例 #18
0
        public bool IsStopword(string s)
        {
            if (_Stopwords == null)
            {
                if (_StopwordsStatus == ResourceStatus.NotAvailable)
                {
                    return(false);
                }

                _Stopwords = LoadWordlist(LanguageResourceType.Stopwords);
                if (_Stopwords != null)
                {
                    _StopwordsStatus = ResourceStatus.Loaded;
                }
            }

            // TODO case-insensitive lookup etc.

            return(_Stopwords.Contains(s /*, SearchOption.CaseInsensitive */));
        }
コード例 #19
0
        public bool IsAbbreviation(string s)
        {
            if (_Abbreviations == null)
            {
                if (_AbbreviationsStatus == ResourceStatus.NotAvailable)
                {
                    return(false);
                }

                _Abbreviations = LoadWordlist(LanguageResourceType.Abbreviations);
                if (_Abbreviations != null)
                {
                    _AbbreviationsStatus = ResourceStatus.Loaded;
                }
            }

            // TODO case-insensitive lookup etc.

            return(_Abbreviations.Contains(s));
        }
コード例 #20
0
        void SetResourcesStatus(ResourceStatus status, int currentTime)
        {
            foreach (var resource in SimResources)
            {
                resource.Status = status;
                switch (status)
                {
                case ResourceStatus.Busy:
                    resource.ActiveTime.Add((currentTime, 0));
                    break;

                case ResourceStatus.Free:
                {
                    var lastActiveTime = resource.ActiveTime.Last();
                    resource.ActiveTime.Remove(lastActiveTime);
                    resource.ActiveTime.Add((lastActiveTime.Item1, currentTime));
                    break;
                }
                }
            }
        }
コード例 #21
0
 public void Write(
     System.Xml.XmlWriter xmlWriter,
     ResourceStatus resourceStatus
     )
 {
     if (resourceStatus == ResourceStatus.Unknown)
         return;
     if (String.IsNullOrEmpty(xmlWriter.LookupPrefix(Configuration.Namespaces.XCRICAP11NamespaceUri)))
         xmlWriter.WriteAttributeString
             (
             "recstatus",
             ((int)resourceStatus).ToString()
             );
     else
         xmlWriter.WriteAttributeString
             (
             "recstatus",
             Configuration.Namespaces.XCRICAP11NamespaceUri,
             ((int)resourceStatus).ToString()
             );
 }
コード例 #22
0
        public LanguageResources(System.Globalization.CultureInfo culture, IResourceDataAccessor accessor)
        {
            if (culture == null)
            {
                throw new ArgumentNullException("culture");
            }
            if (accessor == null)
            {
                accessor = Configuration.Load();
            }

            _Culture  = culture;
            _Accessor = accessor;

            // TODO if we have a DB-based resource accessor, we don't want individual roundtrips to the DB to
            //  query the status for each resource. Rather the accessor should return all status in one call.
            // TODO this class intentionally implements a resource cache. We need however a protocol which
            //  detects changes to the resource storage and updates the cache.
            _AbbreviationsStatus = _Accessor.GetResourceStatus(culture, LanguageResourceType.Abbreviations, true);
            _StopwordsStatus     = _Accessor.GetResourceStatus(culture, LanguageResourceType.Stopwords, true);
            _StemmingRulesStatus = _Accessor.GetResourceStatus(culture, LanguageResourceType.StemmingRules, true);
        }
コード例 #23
0
        /// <summary>
        /// Sets the current status of the resource.
        /// </summary>
        /// <param name="code">The new status code</param>
        /// <param name="dateTime">The date and time the state was changed</param>
        /// <param name="userId">The user that has made the change</param>
        /// <param name="incidentNo">The incident number that the resource is currently attached to</param>
        /// <returns>true if the change was successfully made, otherwise false</returns>
        protected bool SetCurrentResourceStatus(ResourceStatus status, DateTime dateTime, int userId, int incidentNo)
        {
            //execute the change to the resource status
            if (database.SetCurrentResourceStatus(callSign: CallSign, code: status.Code, dateTime: dateTime, userId: userId))
            {
                //if the status code means that an incident log should be updated with the change, execute the appropriate method.
                switch (status.IncidentLogAction)
                {
                case ResourceLogTime.Mobile:
                    database.SetToMobile(callSign: CallSign, dateTime: dateTime, incidentNo: incidentNo);
                    break;

                case ResourceLogTime.OnScene:
                    database.SetToInAttendance(callSign: CallSign, dateTime: dateTime, incidentNo: incidentNo);
                    break;

                case ResourceLogTime.Available:
                    database.SetToAvailable(callSign: CallSign, dateTime: dateTime, incidentNo: incidentNo);
                    break;

                case ResourceLogTime.Finished:
                    database.SetToFinished(callSign: CallSign, dateTime: dateTime, incidentNo: incidentNo);
                    break;

                //nothing needs to be done with 'alerted' as the alerted time is already entered into the incident_resource
                //table in MySqlIncidentDB.AssignResource().  It is better this way because MySqlIncientDB knows the trigger
                case ResourceLogTime.Alerted:
                case ResourceLogTime.Ignore:
                default:
                    break;
                }
                return(true); //return true if the change was successful
            }
            else
            {
                return(false); //else false
            }
        }
        /// <summary>
        /// Retrieves a resource using its unique call sign
        /// </summary>
        /// <param name="callSign">The call sign to retrieve</param>
        /// <returns>An object representing the resource.
        /// Note that this is the abstract base class and the returned object should be cast to an Appliance or Officer object.</returns>
        public Appliance GetAppliance(string callSign)
        {
            string statement = "SELECT * FROM  resource, appliance, address_resource, address, resource_status, status, ApplianceType, Base" + Environment.NewLine +
                               "INNER JOIN address AS base_address ON base.Id = base_address.Id" + Environment.NewLine +
                               "WHERE resource.CallSign = appliance.CallSign" + Environment.NewLine +
                               "AND resource.CallSign = address_resource.ResourceCallSign" + Environment.NewLine +
                               "AND address_resource.DateTime = ((SELECT MAX(Address_Resource.DateTime) FROM Address_Resource WHERE Address_Resource.ResourceCallSign = resource.CallSign))" + Environment.NewLine +
                               "AND address_resource.AddressId = address.Id" + Environment.NewLine +
                               "AND resource.CallSign = resource_status.ResourceCallSign" + Environment.NewLine +
                               "AND resource_status.StatusCode = status.Code" + Environment.NewLine +
                               "AND resource_status.DateTime = (SELECT MAX(resource_status.DateTime) FROM resource_status WHERE resource_status.ResourceCallSign = resource.CallSign)" + Environment.NewLine +
                               "AND appliance.ApplianceTypeName = ApplianceType.Name" + Environment.NewLine +
                               "AND resource.BaseLocationId = base.Id" + Environment.NewLine +
                               "AND resource.CallSign = @callsign;";

            MySqlCommand command = new MySqlCommand(statement, connection);

            command.Parameters.AddWithValue("@callsign", callSign);

            //execute the query
            MySqlDataReader myReader = null;

            try
            {
                // open the connection only if it is currently closed
                if (command.Connection.State == System.Data.ConnectionState.Closed)
                {
                    command.Connection.Open();
                }

                //close the reader if it currently exists
                if (myReader != null && !myReader.IsClosed)
                {
                    myReader.Close();
                }

                myReader = command.ExecuteReader();

                //read the data sent back from MySQL server
                while (myReader.Read())
                {
                    string name = myReader.GetString(2);

                    string mobile = string.Empty;
                    if (!myReader.IsDBNull(3))
                    {
                        mobile = myReader.GetString(3);
                    }

                    int attachedIncident = -1;
                    if (!myReader.IsDBNull(4))
                    {
                        attachedIncident = myReader.GetInt32(4);
                    }

                    string oic = string.Empty;
                    if (!myReader.IsDBNull(7))
                    {
                        oic = myReader.GetString(7);
                    }

                    int crew = -1;
                    if (!myReader.IsDBNull(8))
                    {
                        crew = myReader.GetInt32(8);
                    }

                    int ba = -1;
                    if (!myReader.IsDBNull(9))
                    {
                        ba = myReader.GetInt32(9);
                    }

                    #region Address Data

                    int addressId = -1;
                    if (!myReader.IsDBNull(14))
                    {
                        addressId = myReader.GetInt32(14);
                    }

                    string building = string.Empty;
                    if (!myReader.IsDBNull(15))
                    {
                        building = myReader.GetString(15);
                    }

                    string number = string.Empty;
                    if (!myReader.IsDBNull(16))
                    {
                        number = myReader.GetString(16);
                    }

                    string street = string.Empty;
                    if (!myReader.IsDBNull(17))
                    {
                        street = myReader.GetString(17);
                    }

                    string town = string.Empty;
                    if (!myReader.IsDBNull(18))
                    {
                        town = myReader.GetString(18);
                    }

                    string postcode = string.Empty;
                    if (!myReader.IsDBNull(19))
                    {
                        postcode = myReader.GetString(19);
                    }

                    string county = string.Empty;
                    if (!myReader.IsDBNull(20))
                    {
                        county = myReader.GetString(20);
                    }

                    double latitude  = myReader.GetDouble(21);
                    double longitude = myReader.GetDouble(22);

                    Address address = new Address(addressId, building, number, street, town, postcode, county, longitude, latitude);

                    #endregion

                    #region Status Data

                    int code = -1;
                    if (!myReader.IsDBNull(27))
                    {
                        code = myReader.GetInt32(27);
                    }

                    string codeDescription = string.Empty;
                    if (!myReader.IsDBNull(28))
                    {
                        codeDescription = myReader.GetString(28);
                    }

                    bool isAvail = false;
                    if (!myReader.IsDBNull(29))
                    {
                        isAvail = myReader.GetBoolean(29);
                    }

                    bool isMob = false;
                    if (!myReader.IsDBNull(30))
                    {
                        isMob = myReader.GetBoolean(30);
                    }

                    ResourceLogTime log = ResourceLogTime.Ignore;
                    if (!myReader.IsDBNull(31))
                    {
                        log = (ResourceLogTime)myReader.GetInt32(31);
                    }

                    ResourceStatus status = new ResourceStatus(code, codeDescription, isAvail, isMob, log);

                    #endregion

                    #region Appliance Type Data

                    string typeName = string.Empty;
                    if (!myReader.IsDBNull(32))
                    {
                        typeName = myReader.GetString(32);
                    }

                    string typeDescription = string.Empty;
                    if (!myReader.IsDBNull(33))
                    {
                        typeDescription = myReader.GetString(33);
                    }

                    ApplianceType type = new ApplianceType(typeName, typeDescription);

                    #endregion

                    #region Base Data

                    int baseId = -1;
                    if (!myReader.IsDBNull(34))
                    {
                        baseId = myReader.GetInt32(34);
                    }

                    int baseAddressId = -1;
                    if (!myReader.IsDBNull(35))
                    {
                        baseAddressId = myReader.GetInt32(35);
                    }

                    string office = string.Empty;
                    if (!myReader.IsDBNull(36))
                    {
                        office = myReader.GetString(36);
                    }

                    string baseName = string.Empty;
                    if (!myReader.IsDBNull(37))
                    {
                        name = myReader.GetString(37);
                    }


                    string baseBuilding = string.Empty;
                    if (!myReader.IsDBNull(39))
                    {
                        building = myReader.GetString(39);
                    }

                    string baseNumber = string.Empty;
                    if (!myReader.IsDBNull(40))
                    {
                        number = myReader.GetString(40);
                    }

                    string baseStreet = string.Empty;
                    if (!myReader.IsDBNull(41))
                    {
                        street = myReader.GetString(41);
                    }

                    string baseTown = string.Empty;
                    if (!myReader.IsDBNull(42))
                    {
                        town = myReader.GetString(42);
                    }

                    string basePostcode = string.Empty;
                    if (!myReader.IsDBNull(43))
                    {
                        postcode = myReader.GetString(43);
                    }

                    string baseCounty = string.Empty;
                    if (!myReader.IsDBNull(44))
                    {
                        county = myReader.GetString(44);
                    }

                    double baseLatitude  = myReader.GetDouble(45);
                    double baseLongitude = myReader.GetDouble(46);

                    Address baseAddress  = new Address(baseId, baseBuilding, baseNumber, baseStreet, baseTown, basePostcode, baseCounty, baseLongitude, baseLatitude);
                    Base    baseLocation = new Base(baseId, office, baseAddress, baseName);

                    #endregion

                    ApplianceInfo info = new ApplianceInfo(name, mobile, baseLocation, address, status, oic, crew, ba, type, attachedIncident);
                    return(new Appliance(callSign, info));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                if (myReader != null)
                {
                    myReader.Close();
                }
                command.Connection.Close();
            }
            return(null);
        }
コード例 #25
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ResourceName.Length != 0)
            {
                hash ^= ResourceName.GetHashCode();
            }
            if (HasLastChangeDateTime)
            {
                hash ^= LastChangeDateTime.GetHashCode();
            }
            if (ResourceType != global::Google.Ads.GoogleAds.V6.Enums.ChangeStatusResourceTypeEnum.Types.ChangeStatusResourceType.Unspecified)
            {
                hash ^= ResourceType.GetHashCode();
            }
            if (HasCampaign)
            {
                hash ^= Campaign.GetHashCode();
            }
            if (HasAdGroup)
            {
                hash ^= AdGroup.GetHashCode();
            }
            if (ResourceStatus != global::Google.Ads.GoogleAds.V6.Enums.ChangeStatusOperationEnum.Types.ChangeStatusOperation.Unspecified)
            {
                hash ^= ResourceStatus.GetHashCode();
            }
            if (HasAdGroupAd)
            {
                hash ^= AdGroupAd.GetHashCode();
            }
            if (HasAdGroupCriterion)
            {
                hash ^= AdGroupCriterion.GetHashCode();
            }
            if (HasCampaignCriterion)
            {
                hash ^= CampaignCriterion.GetHashCode();
            }
            if (HasFeed)
            {
                hash ^= Feed.GetHashCode();
            }
            if (HasFeedItem)
            {
                hash ^= FeedItem.GetHashCode();
            }
            if (HasAdGroupFeed)
            {
                hash ^= AdGroupFeed.GetHashCode();
            }
            if (HasCampaignFeed)
            {
                hash ^= CampaignFeed.GetHashCode();
            }
            if (HasAdGroupBidModifier)
            {
                hash ^= AdGroupBidModifier.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #26
0
    IEnumerator OrderRoutine()
    {
        while (true)
        {
            if (BuildScript.m_IsBuild && m_IsSelect == true && transform.tag == "UnitLego")
            {
                m_Animator.SetBool("IsMineral", false);
                yield return(StartCoroutine("BuildRoutine"));

                StopCoroutine("OrderRoutine");
            }

            else if (m_IsPick)
            {
                if (IsInputRight() && TouchScript.m_Instance.IsOver)
                {
                    //m_IsStartToMove = true;
                    // SelectUnitScript.m_Instance.StopCoroutine("SelectRoutine");
                    // SelectUnitScript.m_Instance.StartCoroutine("SelectRoutine");
                    imgSelectbar.enabled = false;
                    imgHpbar.enabled     = false;
                    SelectUnitScript.m_Instance.SelectedUnit.Remove(transform.GetComponent <PlayerMove>());
                    Ray        ray = Camera.main.ScreenPointToRay(InputSpot());
                    RaycastHit hit;
                    if (Physics.Raycast(ray, out hit, Mathf.Infinity))
                    {
                        Debug.DrawRay(Camera.main.transform.position, hit.point - Camera.main.transform.position, Color.red);
                        HitOb = hit.collider.gameObject;
                        if (HitOb.layer == 30)   // Ground
                        {
                            SelectUnitScript.m_Instance.m_PickImage.transform.position = hit.point;
                            SelectUnitScript.m_Instance.m_PickImage.SetActive(true);
                            unitState = UnitState.walk;
                            m_Animator.SetBool("IsAttack", false);
                            m_Animator.SetBool("IsMineral", false);
                            m_Animator.SetBool("IsHeal", false);
                            m_Animator.SetBool("IsBuild", false);
                            StopCoroutine("AttackByBullet");
                            StopCoroutine("TraceRoutine");
                            StopCoroutine("MineralRoutine");
                            StopCoroutine("HealRoutine");
                            CancelInvoke("AttackByFlare");
                            yield return(StartCoroutine("Picking", hit.point));

                            SelectUnitScript.m_Instance.m_PickImage.SetActive(false);

                            m_IsSelect = false;
                        }
                    }
                }
            }

            else if (m_IsMineral)
            {
                if (IsInputRight())
                {
                    //m_IsStartToMove = true;
                    // SelectUnitScript.m_Instance.StopCoroutine("SelectRoutine");
                    //SelectUnitScript.m_Instance.StartCoroutine("SelectRoutine");
                    imgSelectbar.enabled = false;
                    imgHpbar.enabled     = false;
                    SelectUnitScript.m_Instance.SelectedUnit.Remove(transform.GetComponent <PlayerMove>());
                    Ray        ray = Camera.main.ScreenPointToRay(InputSpot());
                    RaycastHit hit;
                    if (Physics.Raycast(ray, out hit, Mathf.Infinity))
                    {
                        Debug.DrawRay(Camera.main.transform.position, hit.point - Camera.main.transform.position, Color.red);
                        HitOb = hit.collider.gameObject;
                        HitRS = HitOb.GetComponent <ResourceStatus>();
                        if (HitOb.layer == 26)   // Resource
                        {
                            if (transform.tag != "UnitLego")
                            {
                                StopCoroutine("OrderRoutine");
                            }
                            m_Animator.SetBool("IsMineral", false);

                            yield return(StartCoroutine("Picking", hit.point));

                            transform.rotation = Quaternion.LookRotation(hit.transform.position - transform.position);
                            unitState          = UnitState.mineral;
                            yield return(StartCoroutine("MineralRoutine"));
                        }
                    }
                }
            }

            else if (m_IsBoard)
            {
                if (IsInputRight() && TouchScript.m_Instance.IsOver)
                {
                    //m_IsStartToMove = true;
                    SelectUnitScript.m_Instance.StartCoroutine("SelectRoutine");
                    imgSelectbar.enabled = false;
                    imgHpbar.enabled     = false;
                    SelectUnitScript.m_Instance.SelectedUnit.Remove(transform.GetComponent <PlayerMove>());
                    Ray        ray = Camera.main.ScreenPointToRay(InputSpot());
                    RaycastHit hit;
                    if (Physics.Raycast(ray, out hit, Mathf.Infinity))
                    {
                        Debug.DrawRay(Camera.main.transform.position, hit.point - Camera.main.transform.position, Color.red);
                        HitOb = hit.collider.gameObject;
                        HitPM = HitOb.GetComponent <PlayerMove>();
                        if (HitOb.tag == "UnitAirballoon")   // AirUnit
                        {
                            unitState = UnitState.walk;
                            m_Animator.SetBool("IsAttack", false);
                            m_Animator.SetBool("IsMineral", false);
                            m_Animator.SetBool("IsBuild", false);
                            StopCoroutine("AttackByBullet");
                            StopCoroutine("TraceRoutine");
                            yield return(StartCoroutine("Picking", HitOb.transform.position));

                            m_IsSelect = false;
                            //yield return HitPM.StartCoroutine("Landing_TakeOff", false);
                            m_Nav.enabled = false;
                            transform.SetParent(HitPM.BalloonHeight, false);
                            Vector3 UPos  = Vector3.zero;
                            Vector3 URot  = Vector3.zero;
                            Vector3 UScal = Vector3.one;
                            UPos.x -= 5f;
                            URot.z -= 90f;
                            UScal  *= 0.6f;
                            transform.localPosition = UPos;
                            transform.localRotation = Quaternion.Euler(URot);
                            transform.localScale    = UScal;
                            //HitPM.m_IsFull = true;
                            UnitFuncScript.m_Instance.IsAirUnitfull = true;
                            //yield return HitPM.StartCoroutine("Landing_TakeOff", true);
                        }
                    }
                }
            }

            else if (m_IsAttack)
            {
                if (IsInputRight() || m_IsOffensive)
                {
                    TargetPointFalse();

                    //m_IsStartToMove = true;
                    //SelectUnitScript.m_Instance.StartCoroutine("SelectRoutine");
                    //if (transform.tag == "UnitLego" || transform.tag == "UnitClockMouse")
                    //{
                    //    m_IsSelect = false;
                    //    break;
                    //}

                    Ray        ray = Camera.main.ScreenPointToRay(InputSpot());
                    RaycastHit hit;

                    if (Physics.Raycast(ray, out hit, Mathf.Infinity) || m_IsOffensive)
                    {
                        Debug.DrawRay(Camera.main.transform.position, hit.point - Camera.main.transform.position, Color.red);
                        //SelectUnitScript.m_Instance.SelectedUnit.Remove(transform.GetComponent<PlayerMove>());
                        HitOb = hit.collider.gameObject;
                        UnitFuncScript.m_Instance.ClearFunc();
                        if ((HitOb.layer == 28 &&
                             !SelectUnitScript.m_Instance.IsUnitMyTeam(HitOb.GetComponent <PlayerMove>())) || m_IsOffensive)    // Unit
                        {
                            m_IsPM = true;
                            m_IsBS = false;
                            if (m_IsOffensive)
                            {
                                hit.point = HitPM.gameObject.transform.position;
                                goto offensive;
                            }
                            HitPM = HitOb.GetComponent <PlayerMove>();
                            offensive :;
                            HitPM.m_IsSelect           = false;
                            HitPM.imgSelectbar.enabled = false;
                            HitPM.m_Damage             = m_Power;
                            SelectUnitScript.m_Instance.SelectedUnit.Remove(HitPM);
                            SelectUnitScript.m_Instance.SelectedUnit.Remove(transform.GetComponent <PlayerMove>());

                            unitState = UnitState.attack;
                            yield return(StartCoroutine("Picking", hit.point));

                            switch (transform.tag)
                            {
                            case "UnitSoldier":
                            {
                                InvokeRepeating("AttackByBullet", 0f, 1.0f);
                                //HitPM.StartCoroutine("DamageRoutine");
                                //StartCoroutine("AttackByBullet");
                                yield return(StartCoroutine("ConditionForAttack", "no"));

                                CancelInvoke("AttackByBullet");
                                //StopCoroutine("AttackByBullet");
                                m_IsAttack = false;
                                break;
                            }

                            case "UnitBear":
                            {
                                StartCoroutine("BearAttackRoutine");
                                yield return(StartCoroutine("ConditionForAttack", "no"));

                                StopCoroutine("BearAttackRoutine");
                                m_IsAttack = false;
                                break;
                            }

                            case "UnitDinosaur":
                            {
                                InvokeRepeating("AttackByFlare", 1.8f, 1.5f);
                                yield return(StartCoroutine("ConditionForAttack", "no"));

                                CancelInvoke("AttackByFlare");
                                m_IsAttack = false;
                                break;
                            }

                            case "UnitRCcar":
                            {
                                CarAttakArea.gameObject.SetActive(true);
                                yield return(StartCoroutine("ConditionForAttack", "no"));

                                CarAttakArea.gameObject.SetActive(false);
                                m_IsAttack = false;
                                break;
                            }

                            default:
                                break;
                            }
                        }

                        else if (hit.transform.gameObject.layer == 27 &&
                                 !SelectUnitScript.m_Instance.IsBuildingMyTeam(hit.transform.GetComponent <BuildingStatus>())) // Building
                        {
                            //NoticeScript.m_Instance.Notice("빌딩 타겟 완료\n");
                            m_IsPM                     = false;
                            m_IsBS                     = true;
                            HitBS                      = HitOb.GetComponent <BuildingStatus>();
                            HitBS.m_IsSelect           = false;
                            HitBS.imgSelectbar.enabled = false;
                            HitBS.m_Damage             = m_Power;
                            unitState                  = UnitState.attack;
                            yield return(StartCoroutine("Picking", hit.point));

                            transform.rotation = Quaternion.LookRotation(hit.transform.position - transform.position);
                            m_Animator.SetBool("IsAttack", true);
                            switch (transform.tag)
                            {
                            case "UnitSoldier":
                            {
                                yield return(StartCoroutine("ConditionForAttack", "AttackByBullet"));

                                m_IsAttack = false;
                                break;
                            }

                            case "UnitBear":
                            {
                                yield return(StartCoroutine("ConditionForAttack", "BearAttackRoutine"));

                                m_IsAttack = false;
                                break;
                            }

                            case "UnitDinosaur":
                            {
                                yield return(StartCoroutine("ConditionForAttack", "AttackByFlare"));

                                break;
                            }

                            case "UnitRCcar":
                            {
                                CarAttakArea.gameObject.SetActive(true);
                                yield return(StartCoroutine("ConditionForAttack", "AttackByCar"));

                                CarAttakArea.gameObject.SetActive(false);
                                m_IsAttack = false;
                                break;
                            }

                            default:
                                break;
                            }
                        }
                    }
                }
            }

            else if (m_IsHeal)
            {
                imgSelectbar.enabled = false;
                imgHpbar.enabled     = false;
                //SelectUnitScript.m_Instance.SelectedUnit.Remove(transform.GetComponent<PlayerMove>());
                m_IsSelect = false;
                HealEffect.SetActive(true);
                yield return(StartCoroutine("HealRoutine"));

                HealEffect.SetActive(false);
                HealArea.gameObject.SetActive(false);
                m_IsSelect = false;
            }

            yield return(null);
        }
    }
コード例 #27
0
 public HttpStatusCode LookUp(ResourceStatus status)
 {
     return _lookUp[status];
 }
コード例 #28
0
        internal static VCenterData DeserializeVCenterData(JsonElement element)
        {
            Optional <ExtendedLocation>  extendedLocation = default;
            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 <string>       uuid                        = default;
            string                  fqdn                        = default;
            Optional <int>          port                        = default;
            Optional <string>       version                     = default;
            Optional <string>       instanceUuid                = default;
            Optional <string>       connectionStatus            = default;
            Optional <string>       customResourceName          = default;
            Optional <VICredential> credentials                 = default;
            Optional <IReadOnlyList <ResourceStatus> > statuses = default;
            Optional <string> provisioningState                 = 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("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("uuid"))
                        {
                            uuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("fqdn"))
                        {
                            fqdn = 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("version"))
                        {
                            version = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("instanceUuid"))
                        {
                            instanceUuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("connectionStatus"))
                        {
                            connectionStatus = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("customResourceName"))
                        {
                            customResourceName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("credentials"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            credentials = VICredential.DeserializeVICredential(property0.Value);
                            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;
                        }
                    }
                    continue;
                }
            }
            return(new VCenterData(id, name, type, systemData, tags, location, extendedLocation.Value, kind.Value, uuid.Value, fqdn, Optional.ToNullable(port), version.Value, instanceUuid.Value, connectionStatus.Value, customResourceName.Value, credentials.Value, Optional.ToList(statuses), provisioningState.Value));
        }
コード例 #29
0
 public void Resource_status_maps_to_correct_http_status_code(ResourceStatus input, HttpStatusCode expectedOutput)
 {
     var statusCodeTranslator = new DefaultStatusCodeTranslator();
     var result = statusCodeTranslator.LookUp(input);
     Assert.That(result, Is.EqualTo(expectedOutput));
 }
コード例 #30
0
 protected static Expression <Func <Resource, bool> > NotInStatus(ResourceStatus status)
 {
     return(resource => resource.ResourceStatus != status);
 }
コード例 #31
0
        internal static ResourcePoolData DeserializeResourcePoolData(JsonElement element)
        {
            Optional <ExtendedLocation>  extendedLocation = default;
            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 <string>  uuid               = default;
            Optional <string>  vCenterId          = default;
            Optional <string>  moRefId            = default;
            Optional <string>  inventoryItemId    = default;
            Optional <string>  moName             = default;
            Optional <string>  cpuSharesLevel     = default;
            Optional <long>    cpuReservationMHz  = default;
            Optional <long>    cpuLimitMHz        = default;
            Optional <string>  memSharesLevel     = default;
            Optional <long>    memReservationMB   = default;
            Optional <long>    memLimitMB         = default;
            Optional <string>  customResourceName = default;
            Optional <IReadOnlyList <ResourceStatus> > statuses = default;
            Optional <string> provisioningState = 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("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("uuid"))
                        {
                            uuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("vCenterId"))
                        {
                            vCenterId = property0.Value.GetString();
                            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("cpuSharesLevel"))
                        {
                            cpuSharesLevel = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("cpuReservationMHz"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            cpuReservationMHz = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("cpuLimitMHz"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            cpuLimitMHz = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("memSharesLevel"))
                        {
                            memSharesLevel = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("memReservationMB"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            memReservationMB = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("memLimitMB"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            memLimitMB = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("customResourceName"))
                        {
                            customResourceName = 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;
                        }
                    }
                    continue;
                }
            }
            return(new ResourcePoolData(id, name, type, systemData, tags, location, extendedLocation.Value, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, cpuSharesLevel.Value, Optional.ToNullable(cpuReservationMHz), Optional.ToNullable(cpuLimitMHz), memSharesLevel.Value, Optional.ToNullable(memReservationMB), Optional.ToNullable(memLimitMB), customResourceName.Value, Optional.ToList(statuses), provisioningState.Value));
        }
        internal static VirtualMachineTemplateData DeserializeVirtualMachineTemplateData(JsonElement element)
        {
            Optional <ExtendedLocation>  extendedLocation = default;
            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 <string>  uuid              = default;
            Optional <string>  vCenterId         = default;
            Optional <string>  moRefId           = default;
            Optional <string>  inventoryItemId   = default;
            Optional <string>  moName            = default;
            Optional <int>     memorySizeMB      = default;
            Optional <int>     numCPUs           = default;
            Optional <int>     numCoresPerSocket = default;
            Optional <OSType>  osType            = default;
            Optional <string>  osName            = default;
            Optional <string>  folderPath        = default;
            Optional <IReadOnlyList <NetworkInterface> > networkInterfaces = default;
            Optional <IReadOnlyList <VirtualDisk> >      disks             = default;
            Optional <string>       customResourceName          = default;
            Optional <string>       toolsVersionStatus          = default;
            Optional <string>       toolsVersion                = default;
            Optional <FirmwareType> firmwareType                = default;
            Optional <IReadOnlyList <ResourceStatus> > statuses = default;
            Optional <string> provisioningState = 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("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("uuid"))
                        {
                            uuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("vCenterId"))
                        {
                            vCenterId = property0.Value.GetString();
                            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("memorySizeMB"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            memorySizeMB = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("numCPUs"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            numCPUs = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("numCoresPerSocket"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            numCoresPerSocket = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("osType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            osType = new OSType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("osName"))
                        {
                            osName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("folderPath"))
                        {
                            folderPath = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("networkInterfaces"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <NetworkInterface> array = new List <NetworkInterface>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(NetworkInterface.DeserializeNetworkInterface(item));
                            }
                            networkInterfaces = array;
                            continue;
                        }
                        if (property0.NameEquals("disks"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VirtualDisk> array = new List <VirtualDisk>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VirtualDisk.DeserializeVirtualDisk(item));
                            }
                            disks = array;
                            continue;
                        }
                        if (property0.NameEquals("customResourceName"))
                        {
                            customResourceName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("toolsVersionStatus"))
                        {
                            toolsVersionStatus = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("toolsVersion"))
                        {
                            toolsVersion = 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("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;
                        }
                    }
                    continue;
                }
            }
            return(new VirtualMachineTemplateData(id, name, type, systemData, tags, location, extendedLocation.Value, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, Optional.ToNullable(memorySizeMB), Optional.ToNullable(numCPUs), Optional.ToNullable(numCoresPerSocket), Optional.ToNullable(osType), osName.Value, folderPath.Value, Optional.ToList(networkInterfaces), Optional.ToList(disks), customResourceName.Value, toolsVersionStatus.Value, toolsVersion.Value, Optional.ToNullable(firmwareType), Optional.ToList(statuses), provisioningState.Value));
        }
コード例 #33
0
ファイル: DataStore.designer.cs プロジェクト: varunkho/Akshar
 partial void OnStatusChanging(ResourceStatus value);
コード例 #34
0
ファイル: ResultItemDto.cs プロジェクト: bindopen/BindOpen
 /// <summary>
 /// Initializes a new instance of the ResultItemDto class.
 /// </summary>
 /// <param name="key">The key to consider.</param>
 /// <param name="status">The status to consider.</param>
 public ResultItemDto(string key, ResourceStatus status = ResourceStatus.None)
 {
     Key    = key;
     Status = status;
 }
コード例 #35
0
 public Resource() {
     this.statusField = ResourceStatus.active;
 }