We've got a custom .settings file which we use to store variables and custom actions defined under certain circumstances.
Basically all we have is a format right now and no way of reading it. I did propose an idea but it was quickly turned down and I was told that we "must use Linq".
Now I'm sitting here wondering how I am going to do this. The file we have looks like this:
[SET Name:"NeverAcquireRemoteFiles" Value:"False"]
[SET Name:"CheckForUpdates" Value:"True"]
[SET Name:"" Value:""]
[SET Name:"" Value:""]
[PERFORM Action:"AcquireRemoteFiles" When:"ApplicationWindowShown"]
[PERFORM Action:"CheckForUpdates" When:""]
[PERFORM Action:"" When:""]
[PERFORM Action:"" When:""]
[PERFORM Action:"" When:""]
[PERFORM Action:"" When:""]
[PERFORM Action:"" When:""]
[PERFORM Action:"" When:""]
Don't mind the empty lines, they're just there to demonstrate that there is no specific amount of lines, set's or actions in this file.
To be honest, I don't know enough of Linq to figure this out (without needing a bit more time) and I just don't see how I could write a query against this file.
The lines beginning with SET
are variables. The Name attribute represents the name of the variable, while the Value representing it's value (duh). Lines beginning with PERFORM are the actions. I think you know the rest.
Basically, we have certain "stages" in our application where we may or may not need to do certain things. And these aren't necessarily things that can be automated with 100% accuracy. And we need 100% accuracy. So hence the idea of a settings file. Based on the conditions and current circumstances, we amend or remove from or add to the settings file before we launch the application.
Is it possible to read this file using Linq, if so, how?