Jump to content
  • Advertisement
Sign in to follow this  
Angelic Ice

C# C# Core - Application Data

This topic is 375 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone!

Just a quick question: I would like to save some application data, similar to here: https://technet.microsoft.com/en-us/library/bb397755(v=vs.100).aspx/css

But this seems to be either WinForm or .NET exclusive? At least I cannot use these methods, as properties does not exist. Furthermore, I feel like the way of serialising data in that manner is a bad sub-optimal for my liking, as I like to group multiple data-entries in a context (e.g. screen-width and screen-height in a folder/file/table/.. called window).

Some pseudo-code to give an idea:

Properties.Settings.Window.Width = 500;
Properties.Settings.ErrorMessages.Loading.MissingFile = "File could not be found.";

Is there a common practice to do this? JSON? Values should be editable during runtime!

Even though an SQL-database is implemented, I do not want to scatter around key-value-tables.

Thanks for your time!

Share this post


Link to post
Share on other sites
Advertisement

From what I can think, the Properties namespace was something that got introduced back in early .net days, so I think that it is part of the .net framework.

Most of my work at the moment is in .Net an we use Properties.Settings a fair amount, so if you cant without .net then would assume it is part of .net ;p

 

As an aside - im not sure why you would be in C# and without .net really.. but ya know.. Properties should be a thing if you have .net

Edited by GibbonThatCodes

Share this post


Link to post
Share on other sites

Thanks for confirming it.

22 minutes ago, GibbonThatCodes said:

As an aside - im not sure why you would be in C# and without .net really.. but ya know.. Properties should be a thing if you have .net

Because I like C# as a language but want to release on a non-windows-operating-system. Core is gaining more and more steam.

Beside that, if somebody knows a common practice for "editable settings during run-time" on core, I would be all ears : )

Edited by Angelic Ice

Share this post


Link to post
Share on other sites

Mono / Xamarin should support it since you're aiming at cross platform.

6 hours ago, Angelic Ice said:

I cannot use these methods, as properties does not exist.

That is odd. What version are you using?

5 hours ago, Angelic Ice said:

Because I like C# as a language but want to release on a non-windows-operating-system. Core is gaining more and more steam.

A common trap is to avoid them because you think they are not supported on another system. In practice things like this tend to work fine and support exists. Are you avoiding it because you believe it doesn't exist, or because you verified it does not exist?

6 hours ago, Angelic Ice said:

I feel like the way of serialising data in that manner is a bad sub-optimal for my liking, as I like to group multiple data-entries in a context (e.g. screen-width and screen-height in a folder/file/table/.. called window).

You can do some of that with data structures.  If it truly doesn't meet your needs (rather than just preferences) then yes, you'll need something else.  Otherwise, I suspect the system already exists on the platforms and is ready for use.

Share this post


Link to post
Share on other sites

Property files were copied from Java, afaik.

Anyway, worst case you have to open a file, read lines of text, find the ":" or "=", and strip some white-space. I mean, how hard can it be? Is it really so complicated that you must have that available as library call?

Share this post


Link to post
Share on other sites

Those specific settings come from the app.config file, which is tightly integrated with VS. You don't use them because you don't know how to read a text file, you use them because Visual Studio can assist you in creating/managing them. With a spec file you get a settings editor, and VS can generate the strongly typed Settings.Default object that lets you read the properties as properly typed fields from it. In ASP in particular it even hot reloads the file and re assigns the fields if you change your web.config.

Anyway, read this issue https://github.com/dotnet/corefx/issues/1348

Apparently they're not supporting them anymore. A guy there suggested to use https://github.com/aspnet/Configuration/ instead.

You *could* just try to import System.Configuration assembly and see how it goes.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!