-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Settings not written #3
Comments
Not sure. I am thinking about changing this to a library rather than just putting the code into your project. This will make it easier to hide internals and make it easier to get started. Can you paste some code so I can see what you are doing? |
Hi @JakeGinnivan thanks for replying. These are the following two methods I am using in order o save and retrieve the settings: public ClientSettings GetClientSettings()
{
SettingsProvider provider = new SettingsProvider();
return provider.GetSettings<ClientSettings>(false); //I cant seem to call the Load Method for some reason. I think its no longer supported.
} public bool SaveClientSettings(ClientSettings settings)
{
try
{
provider.SaveSettings<ClientSettings>(settings);
}
catch (Exception ex)
{
return false;
}
return true;
} And this is what my ClientSettings class looks like: [Serializable]
public class ClientSettings
{
public int orgID { get; set; }
public string username { get; set; }
} I will really appreciate if you can help with this. Thanks |
The class doesn't have to be marked as serializable. Interesting. That looks like a bug (I have only reused the settings provider rather than newing it up every time). I think it is related to that. Try making it a static property and ill look into it over the weekend |
Thanks @JakeGinnivan I will check by creating it as a static property. |
Still not working :( This is how i have implemented the static instance of the provider now: public static SettingsProvider _settingsProvider;
static SettingsService()
{
_settingsProvider = new SettingsProvider();
}
public ClientSettings GetClientSettings()
{
return _settingsProvider.GetSettings<ClientSettings>();
}
public bool SaveClientSettings(ClientSettings settings)
{
try
{
_settingsProvider.SaveSettings<ClientSettings>(settings);
}
catch (Exception ex)
{
return false;
}
return true;
} |
Try uninstalling, deleting the classes which are put into your project, then reinstalling. I fixed a bug a few weeks ago which caused things not to write properly I am working on v2 which will be a class library, but will be a few more days |
Ok I will add directly from the github repo rather than using the nuget package. |
Sadly I got the same result :( I can see the created file but its empty, no settings inside it. |
Hey @JakeGinnivan any updates on this? Regards |
@aliirz I know it has been ages, I have just finished overhauling the internals and converting this to a class library in prep for v2. Once its released if you still need this let me know how you go |
Hi Again
I am using the nuget in a class library i call to save settings. However i can see the file being created but it appears to be empty and when I try to read it, i get empty values. What am I doing wrong?
Please help.
The text was updated successfully, but these errors were encountered: