Binoculars
Binoculars copied to clipboard
Configuration/Settings Method
We need to add Settings or Configuration methods in to the application. I'm leaning towards a Settings
class that reads a settings.json
file within the extension folder.
I theorised this as json
file but that could just be due to my background in javascript. Dynamo is also moving towards json
so it is fitting but what would the standard C# way be? @radumg @brencass
Would something simpler to understand such as yaml
be more fitting?
- https://en.wikipedia.org/wiki/YAML
- https://yaml.org/
Working prototype is on the settings branch. It's still a work in progress so refinement is needed before it's merged.
I theorised this as
json
file but that could just be due to my background in javascript.
you'll find this very useful : https://app.quicktype.io/#l=cs&r=json2csharp
Dynamo is also moving towards
json
so it is fitting but what would the standard C# way be? @radumg @brencass
Json 👍 Yaml 👎
Had a look on the settings
branch, here's a few notes
Settings
should be a non-static class with children objects if required. This will allow easy deserialisation & use throughout code (instead of using error-prone dictionary lookups).
{
"consent": {
"requested": true,
"given": true
}
For example, the Consent
"section" above could be quickly modelled as :
public class Consent
{
public bool Requested { get; set; }
public bool Given { get; set; }
}
Similarly for the collect
section :
"collect": {
"user": true,
"computerName": true,
"dynamoVersion": true,
"revitVersion": true,
"ip": true,
"geolocation": true,
"latlng": true,
"city": true,
"country": true,
"filename": true,
"date": true
}
would be
public class DataCollectionSettings
{
public bool User { get; set; }
public bool ComputerName { get; set; }
public bool DynamoVersion { get; set; }
public bool RevitVersion { get; set; }
public bool Ip { get; set; }
public bool Geolocation { get; set; }
public bool LatLng { get; set; }
public bool City { get; set; }
public bool Country { get; set; }
public bool Filename { get; set; }
public bool Date { get; set; }
}
etc.
Settings have now been merged into master https://github.com/teamtreedyn/Binoculars/pull/32 but I'll leave this issue open until @radumg comments are resolved.