Exemple #1
0
 public void AddBytes(byte[] value)
 {
     DataEntries.Add(new DataEntry()
     {
         Type = DataType.Bytes, BytesValue = value
     });
 }
Exemple #2
0
 public void AddString(string value)
 {
     DataEntries.Add(new DataEntry()
     {
         Type = DataType.String, StringValue = value
     });
 }
Exemple #3
0
 public void AddVector3(Vector3 value)
 {
     DataEntries.Add(new DataEntry()
     {
         Type = DataType.Vector3, Vector3Value = value
     });
 }
Exemple #4
0
 public void AddBool(bool value)
 {
     DataEntries.Add(new DataEntry()
     {
         Type = DataType.Bool, BoolValue = value
     });
 }
Exemple #5
0
 public void AddByte(byte value)
 {
     DataEntries.Add(new DataEntry()
     {
         Type = DataType.Byte, ByteValue = value
     });
 }
Exemple #6
0
 public void AddFloat(float value)
 {
     DataEntries.Add(new DataEntry()
     {
         Type = DataType.Float, FloatValue = value
     });
 }
Exemple #7
0
 public void AddInt(int value)
 {
     DataEntries.Add(new DataEntry()
     {
         Type = DataType.Int, IntValue = value
     });
 }
        public async Task EnsureDataPopulationAsync()
        {
            try
            {
                if (IsPopulated())
                {
                    return;
                }

                DataEntries = _dataRepository.GetDataEntries();

                // If there is no data in the database, scrape it from the website and insert into the DB
                if (!DataEntries.Any())
                {
                    var result = await _dataScraper.FetchDataFromWebAsync();

                    result.ForEach(resultEntry => DataEntries.Add(new IanaTimeZoneEntry {
                        IANATimeZoneID = resultEntry[0], WinTimeZoneID = resultEntry[1]
                    }));
                    _dataRepository.InsertEntries(DataEntries);
                }

                if (DataEntries.Any())
                {
                    PopulateDictionaries();
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Failed to populate data due to {e}");
            }
        }
Exemple #9
0
        /// <summary>
        /// Basic constructor
        /// </summary>
        /// <param name="ID">Patient ID</param>
        /// <param name="patientClass">Patient class of patient</param>
        public EntityPatient(int ID, PatientClass patientClass)
            : base(ID)
        {
            _patientClass        = patientClass;
            _correspondingDoctor = null;
            _staysInBed          = false;

            DataEntries.Add("TotalWait", 0d);
        } // end of EntityPatient
Exemple #10
0
        public void Read(NetBuffer buffer)
        {
            DataEntries.Clear();

            Label = buffer.ReadString();
            byte entryCount = buffer.ReadByte();

            for (int i = 0; i < entryCount; i++)
            {
                var entry = new DataEntry();
                entry.Type = (DataType)buffer.ReadByte();
                switch (entry.Type)
                {
                case DataType.Bool:
                    entry.BoolValue = buffer.ReadBoolean();
                    break;

                case DataType.Int:
                    entry.IntValue = buffer.ReadInt32();
                    break;

                case DataType.Float:
                    entry.FloatValue = buffer.ReadSingle();
                    break;

                case DataType.Byte:
                    entry.ByteValue = buffer.ReadByte();
                    break;

                case DataType.String:
                    entry.StringValue = buffer.ReadString();
                    break;

                case DataType.Vector3:
                    entry.Vector3Value = buffer.ReadVector3();
                    break;

                case DataType.Bytes:
                    var byteCount = buffer.ReadInt32();
                    entry.BytesValue = buffer.ReadBytes(byteCount);
                    break;
                }

                DataEntries.Add(entry);
            }
        }