Skip to content

Instantly share code, notes, and snippets.

@abfo
Created October 1, 2018 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abfo/ccf6e573fc25e479c2d16461618558ae to your computer and use it in GitHub Desktop.
Save abfo/ccf6e573fc25e479c2d16461618558ae to your computer and use it in GitHub Desktop.
private void SetDeviceIntProperty(ref Device device, int propertyID, int propertyValue)
{
foreach (Property p in device.Properties)
{
if (p.PropertyID == propertyID)
{
object value = propertyValue;
p.set_Value(ref value);
break;
}
}
}
private int GetDeviceIntProperty(ref Device device, int propertyID)
{
int ret = -1;
foreach (Property p in device.Properties)
{
if (p.PropertyID == propertyID)
{
ret = (int)p.get_Value();
break;
}
}
return ret;
}
private void SetItemIntProperty(ref Item item, int propertyID, int propertyValue)
{
foreach (Property p in item.Properties)
{
if (p.PropertyID == propertyID)
{
object value = propertyValue;
p.set_Value(ref value);
break;
}
}
}
private int GetItemIntProperty(ref Item item, int propertyID)
{
int ret = -1;
foreach (Property p in item.Properties)
{
if (p.PropertyID == propertyID)
{
ret = (int)p.get_Value();
break;
}
}
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment