Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

32 Commits

Repository files navigation

Settings Manager

This is a basic settings manager I made using Json to keep track of a few user settings.

Settings is strongly typed using the SettingsModel. Add whatever settings you want to the model just remember to give it an initial value or you might get null back depending on the situation.

publicstringSomeSetting{get;set;}="data";

Be sure to change "YourProjectName" in AppFolderPath = $"{appData}/YourProjectName"; to whatever the name of your published project will be that way it shows up correctly under C:\Users\UserName\AppData\Roaming

The project will create a new folder and settings file if it doesn't find your folder in Roaming when SettingsManager is called. It will also populate the Settings member at the same time.

To use the project just make a reference to it in the calling project. You might want to change the namespace in SettingsManager to whatever your namespace is or you'll have to call it as SettingsManager.SettingsManager.Settings

// Get Settingsvarsettings=SettingsManager.Settings;//Change a Settingsettings.SomeSetting="New Info";//Update SettingsSettingsManager.SetSettings(settings);//Get a new copy of Settingsvaroutput=SettingsManager.Settings;//output will be "New Info" instead of the default "data"Console.WriteLine(output.SomeSetting);

About

A basic user settings manager

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages