public void SetProperty(NetworkMeasureProperty prop, string val) { long dbVal = long.Parse(val); switch (prop) { case NetworkMeasureProperty.DownloadRate: case NetworkMeasureProperty.CurrentDownload: case NetworkMeasureProperty.CurrentUpload: case NetworkMeasureProperty.UploadRate: case NetworkMeasureProperty.TrafficMaxLimit: SetProperty(prop, Octet.FromOctet(dbVal)); break; case NetworkMeasureProperty.StartDay: SetProperty(prop, Convert.ToInt32(dbVal)); break; } }
private void SetProperty <T> (NetworkMeasureProperty name, T val) => GetType().GetField(name.ToString()).SetValue(this, val);