I am trying to read config value from the user control on button click .
I can read a xml file instead by getting the rhp path like
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase and read the file .
But I am bit curious to know is there anything else I need to do or it wont work in the Rhino solutions
Why don’t you just use RhinoCommon’s PersistentSettings class? There is a PersistentSettings object on your plug-in object and on every Command object.
What I can understand is persistent setting class is similar like a ReadOnly variables.
This values can only set fro code , if we need to update then we need to make code changes.
If we need to populate the persistent setting class values from a config is is there any way which is common used for Rhino plugin creation.
As I tried I can read a xml file from the location using the System.Reflection.Assembly.GetExecutingAssembly().GetName().
But bit curious to know is there any particular reason why the ConfigurationManager.AppSettings is not able to read a app.config file .
once again thanks a lot for your response, have a nice day head.
Rhino’s persistent settings class allows your plug-in and plug-in command to both read and write settings to the plug-in’s settings file.
The problem with using the traditional .NET config file is that it is often in the same folder as the calling assembly, which is often a location that users don’t have rights to write to.
Have you tried using the persistent setting feature I referenced above?
Thanks Dale.
I can only see the option to add one type of setting file in the add new item option and I tried to read like the below and pfa the screen shot for your reference.
var pathFromPersistentSettingFile = MyPlugIn.Instance.Settings.GetString(“path”);
it didnt worked.
can you please share how to add a settings file .
I am able read and set the value on runtime, but my requirement is to read from a file because we have new value to read from and udpate the file locally