[Mono-list] Cross-platform user settings files

Daniel Lo Nigro lists at dan.cx
Sat Dec 29 03:18:37 UTC 2012


With application settings you can store any class that's serializable. The
framework handles serializing and deserializing for you. :). You just need
to tell it which type each setting is - not sure where this is in
MonoDevelop (or if it even has the tooling for it) but in Visual Studio
it's in the project properties on the "Settings" tab.

On Linux the settings file should be in the user's home directory - see if
it's in a hidden directory called ".settings"

---
Regards,
Daniel

Sent from my phone - please excuse any typos.
On 29/12/2012 2:09 PM, "Hristo Pavlov" <hristo_dpavlov at yahoo.com> wrote:

> Hi Daniel,
>
> I didn't think of the application settings, thanks for mentioning them. I
> rarely use them because they are rather flat for my liking and .NET classes
> are serialized into XML quite trivially.
>
> However I tested using the Application Settings on Ubuntu 12 and a normal
> user can indeed save changes to the user settings.
>
> I couldn't find where the file was saved on the Linux system btw which
> means that it will not be obvious for users i.e. they will not be able to
> edit the settings file manually. I will provide a way for them to edit the
> settings from the app so I guess I can live with the actuall physical file
> that contains the settings being hidden.
>
> So what I am thinking now is that I may just save my settings class
> serialized as xml and saved as a single user setting value. I think this
> will solve my problem!
>
> Thanks for your help,
> Hristo.
>
>   *From:* Daniel Lo Nigro <lists at dan.cx>
> *To:* Hristo Pavlov <hristo_dpavlov at yahoo.com>
> *Cc:* "mono-list at lists.ximian.com" <mono-list at lists.ximian.com>
> *Sent:* Saturday, December 29, 2012 12:11 PM
> *Subject:* Re: [Mono-list] Cross-platform user settings files
>
>  What's wrong with the built-in Application Settings features in the .NET
> Framework? I've never tested this with Mono, but it's been there since .NET
> Framework 2.0 so I assume it would work fine. The .NET Framework handles
> loading and saving the settings into an XML file, and gives strongly-typed
> access to all the properties.
>
> See http://msdn.microsoft.com/en-us/library/k4s6c3a0(v=vs.100).aspx
>
>
> On Sat, Dec 29, 2012 at 2:49 AM, Hristo Pavlov <hristo_dpavlov at yahoo.com>wrote:
>
>  Hello,
>
> What is the recommended way to save user settings files from Mono across
> different platforms?
>
> For example I have an XML file with settings that I want to store
> somewhere. I thought the IsolatedFileStorage would be a good place but I
> have permission problems (read and write) on both Mac OSX and Linux.
>
> Would the solution require setting file access permissions during
> deployment or is there a place a user can always save a file?
>
> Where is the best location on Linux/Mac OSX to store such setting files?
>
> Regards,
> Hristo Pavlov
>
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20121229/68acd375/attachment.html>


More information about the Mono-list mailing list