From 346490f5760772ba629e2f895e5387b7d5bf9ad1 Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Fri, 26 Feb 2021 22:25:40 +0100 Subject: [PATCH 01/21] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 789cf32..00744ae 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - +![alt text](/Configs/Assets/icons8-window-settings-96.png) # Configs A simple way to save the configurations of a C# app as a json file. @@ -56,3 +56,5 @@ Pretty much anything supported by Newtonsoft.Json and is serializable can be use appConfigs.Activated = false; // Save the file. appConfigs.Save(); + +Window Settings icon icon by Icons8 From d11a71dceffb0132422e1b32d095ff77a09af110 Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Fri, 26 Feb 2021 22:35:47 +0100 Subject: [PATCH 02/21] Update README.md --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 00744ae..32ca3a1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![alt text](/Configs/Assets/icons8-window-settings-96.png) +![Configs icon](/Configs/Assets/icons8-window-settings-96.png) # Configs A simple way to save the configurations of a C# app as a json file. @@ -57,4 +57,20 @@ Pretty much anything supported by Newtonsoft.Json and is serializable can be use // Save the file. appConfigs.Save(); +## Result + + { + "Activated": true, + "RandomString": "Hey", + "ImportantStuff": [ + { + "ownerName": "Elias Youssef" + }, + { + "ownerName": "Slim Shady" + } + ] + } + Window Settings icon icon by Icons8 + From 91278ddfc8011adedb33376aec5cd55cf27a0a28 Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Sat, 27 Feb 2021 01:57:55 +0100 Subject: [PATCH 03/21] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 32ca3a1..23ca7a6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ ![Configs icon](/Configs/Assets/icons8-window-settings-96.png) # Configs + +https://www.nuget.org/packages/Configs/1.0.3 + A simple way to save the configurations of a C# app as a json file. The json file(s) is saved in AppData/Local and there is currently no way to change that. From cd952331ebf6615baba495e42b8433ecfa37b229 Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Sat, 27 Feb 2021 01:58:18 +0100 Subject: [PATCH 04/21] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 23ca7a6..8754e5d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![Configs icon](/Configs/Assets/icons8-window-settings-96.png) # Configs -https://www.nuget.org/packages/Configs/1.0.3 +https://www.nuget.org/packages/Configs/ A simple way to save the configurations of a C# app as a json file. From 660a9cd3edbed21f9f5a90d692b110815559441c Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Sun, 28 Feb 2021 18:42:16 +0100 Subject: [PATCH 05/21] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8754e5d..12374c0 100644 --- a/README.md +++ b/README.md @@ -63,9 +63,9 @@ Pretty much anything supported by Newtonsoft.Json and is serializable can be use ## Result { - "Activated": true, - "RandomString": "Hey", - "ImportantStuff": [ + "Activated": true, + "RandomString": "Hey", + "ImportantStuff": [ { "ownerName": "Elias Youssef" }, @@ -73,7 +73,7 @@ Pretty much anything supported by Newtonsoft.Json and is serializable can be use "ownerName": "Slim Shady" } ] - } + } Window Settings icon icon by Icons8 From 6316419a84f61f3331bccd867e2bc1cf9a2fbb65 Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Sun, 28 Feb 2021 18:42:42 +0100 Subject: [PATCH 06/21] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 12374c0..56cb3a2 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ Pretty much anything supported by Newtonsoft.Json and is serializable can be use } ] } + Window Settings icon icon by Icons8 From 6e603b0f134110e6296648a6fdad5a9c6bce02e9 Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Sun, 28 Feb 2021 18:43:35 +0100 Subject: [PATCH 07/21] Update README.md --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 56cb3a2..1cec856 100644 --- a/README.md +++ b/README.md @@ -63,18 +63,18 @@ Pretty much anything supported by Newtonsoft.Json and is serializable can be use ## Result { - "Activated": true, - "RandomString": "Hey", - "ImportantStuff": [ - { - "ownerName": "Elias Youssef" - }, - { - "ownerName": "Slim Shady" - } - ] + "Activated": true, + "RandomString": "Hey", + "ImportantStuff": [ + { + "ownerName": "Elias Youssef" + }, + { + "ownerName": "Slim Shady" + } + ] } - + Window Settings icon icon by Icons8 From c9c2506726a1bcabc91da680bdfc0d3ccc6dfced Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Sun, 28 Feb 2021 18:54:42 +0100 Subject: [PATCH 08/21] formatting --- README.md | 120 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 69 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 1cec856..c567f9f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ ![Configs icon](/Configs/Assets/icons8-window-settings-96.png) + # Configs https://www.nuget.org/packages/Configs/ @@ -6,75 +7,92 @@ https://www.nuget.org/packages/Configs/ A simple way to save the configurations of a C# app as a json file. The json file(s) is saved in AppData/Local and there is currently no way to change that. + # How to use + Before we start, install the package from NuGet. -This package uses [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) and the idea is to make a class that's going to be used as the model for the configuration file. +This package uses [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) and the idea is to make a class that's +going to be used as the model for the configuration file. + ## Setup -Make a class that inherits from ConfigsTools. This class is the model for your configurations file, so it details how the json file is going to look like. - using Configs; - using Newtonsoft.Json; +Make a class that inherits from ConfigsTools. This class is the model for your configurations file, so it details how +the json file is going to look like. + +```C# +using Configs; +using Newtonsoft.Json; - namespace MyApp +namespace MyApp +{ + class AppConfigs : ConfigsTools + { + public AppConfigs() { - class AppConfigs : ConfigsTools - { - public AppConfigs() - { - ConfigsFileName = "MyConfigurations.json"; - } - - [JsonProperty("activated", Required = Required.AllowNull)] - public bool Activated { get; set; } - - [JsonProperty("randomString", Required = Required.Default)] - public string RandomString { get; set; } - - [JsonProperty("registeredTriggerSenders", Required = Required.AllowNull)] - public List ImportantStuff { get; set; } - - public ImportantThing GetImportantThing(string owner) - { - return ImportantStuff.Find(x => x.OwnerName.Equals(owner)); - } - } + ConfigsFileName = "MyConfigurations.json"; } -Pretty much anything supported by Newtonsoft.Json and is serializable can be used in this model. You can of course make multiple models each with a different ConfigsFileName to have multiple configurations files. + + [JsonProperty("activated", Required = Required.AllowNull)] + public bool Activated { get; set; } + + [JsonProperty("randomString", Required = Required.Default)] + public string RandomString { get; set; } + + [JsonProperty("registeredTriggerSenders", Required = Required.AllowNull)] + public List ImportantStuff { get; set; } + + public ImportantThing GetImportantThing(string owner) + { + return ImportantStuff.Find(x => x.OwnerName.Equals(owner)); + } + } +} +``` + +Pretty much anything supported by Newtonsoft.Json and is serializable can be used in this model. You can of course make +multiple models each with a different ConfigsFileName to have multiple configurations files. ## Usage: -### Getting the file's values: - // Get the current app configurations from the json configurations file. - AppConfigs appConfigs = Configs.ConfigsTools.GetConfigs(); - // Get a value from the configurations file. - bool appConfigActivated = appConfigs.Activated; - // This the value at time GetConfigs was called. If you want updated values then you have to call GetConfigs again. +### Getting the file's values: + +```C# +// Get the current app configurations from the json configurations file. +AppConfigs appConfigs = Configs.ConfigsTools.GetConfigs(); +// Get a value from the configurations file. +bool appConfigActivated = appConfigs.Activated; +// This the value at time GetConfigs was called. If you want updated values then you have to call GetConfigs again. +``` ### Editing and saving the file: - // Get the current app configurations from the json configurations file. - AppConfigs appConfigs = Configs.ConfigsTools.GetConfigs(); - // Change value. - appConfigs.Activated = false; - // Save the file. - appConfigs.Save(); +```C# +// Get the current app configurations from the json configurations file. +AppConfigs appConfigs = Configs.ConfigsTools.GetConfigs(); +// Change value. +appConfigs.Activated = false; +// Save the file. +appConfigs.Save(); +``` ## Result +```json +{ + "Activated": true, + "RandomString": "Hey", + "ImportantStuff": [ { - "Activated": true, - "RandomString": "Hey", - "ImportantStuff": [ - { - "ownerName": "Elias Youssef" - }, - { - "ownerName": "Slim Shady" - } - ] + "ownerName": "Elias Youssef" + }, + { + "ownerName": "Slim Shady" } + ] +} +``` - -Window Settings icon icon by Icons8 +Window Settings icon icon +by Icons8 From 25cb809373f0e66bd0929312e76dc4c46f130af7 Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Sun, 28 Feb 2021 18:56:06 +0100 Subject: [PATCH 09/21] fixed names --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c567f9f..4851989 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ namespace MyApp [JsonProperty("randomString", Required = Required.Default)] public string RandomString { get; set; } - [JsonProperty("registeredTriggerSenders", Required = Required.AllowNull)] + [JsonProperty("importantStuff", Required = Required.AllowNull)] public List ImportantStuff { get; set; } public ImportantThing GetImportantThing(string owner) @@ -80,9 +80,9 @@ appConfigs.Save(); ```json { - "Activated": true, - "RandomString": "Hey", - "ImportantStuff": [ + "activated": true, + "randomString": "Hey", + "importantStuff": [ { "ownerName": "Elias Youssef" }, From 85be4d213513964d1083d7ba438fffbe98c5f7af Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Thu, 1 Apr 2021 23:13:13 +0200 Subject: [PATCH 10/21] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4851989..3009a9e 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ multiple models each with a different ConfigsFileName to have multiple configura AppConfigs appConfigs = Configs.ConfigsTools.GetConfigs(); // Get a value from the configurations file. bool appConfigActivated = appConfigs.Activated; -// This the value at time GetConfigs was called. If you want updated values then you have to call GetConfigs again. +// This is the value at time GetConfigs was called. If you want updated values then you have to call GetConfigs again. ``` ### Editing and saving the file: From b226b543e6ae2cc68a059980b6af6df2d61a9aff Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Thu, 1 Apr 2021 23:21:23 +0200 Subject: [PATCH 11/21] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3009a9e..ed8dace 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,8 @@ multiple models each with a different ConfigsFileName to have multiple configura AppConfigs appConfigs = Configs.ConfigsTools.GetConfigs(); // Get a value from the configurations file. bool appConfigActivated = appConfigs.Activated; -// This is the value at time GetConfigs was called. If you want updated values then you have to call GetConfigs again. +// This is the value at time GetConfigs was called. If you want updated values then you have to call +// GetConfigs again. ``` ### Editing and saving the file: From 9e44310fffcd0d31292b1ba3979d7faf42190604 Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Fri, 2 Apr 2021 01:54:05 +0200 Subject: [PATCH 12/21] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ed8dace..85808a9 100644 --- a/README.md +++ b/README.md @@ -58,8 +58,12 @@ multiple models each with a different ConfigsFileName to have multiple configura ### Getting the file's values: ```C# +using Configs; + +... + // Get the current app configurations from the json configurations file. -AppConfigs appConfigs = Configs.ConfigsTools.GetConfigs(); +AppConfigs appConfigs = ConfigsTools.GetConfigs(); // Get a value from the configurations file. bool appConfigActivated = appConfigs.Activated; // This is the value at time GetConfigs was called. If you want updated values then you have to call From c4f89d9d1c6f053c47e2ead2d45ba063e8e5848b Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Fri, 2 Apr 2021 01:55:15 +0200 Subject: [PATCH 13/21] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 85808a9..39d0178 100644 --- a/README.md +++ b/README.md @@ -73,8 +73,12 @@ bool appConfigActivated = appConfigs.Activated; ### Editing and saving the file: ```C# +using Configs; + +... + // Get the current app configurations from the json configurations file. -AppConfigs appConfigs = Configs.ConfigsTools.GetConfigs(); +AppConfigs appConfigs = ConfigsTools.GetConfigs(); // Change value. appConfigs.Activated = false; // Save the file. From d9ea68e7f5bc26fe0fd585bdc806b3fd63479a44 Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Fri, 2 Apr 2021 01:57:15 +0200 Subject: [PATCH 14/21] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 39d0178..9733ced 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,9 @@ namespace MyApp Pretty much anything supported by Newtonsoft.Json and is serializable can be used in this model. You can of course make multiple models each with a different ConfigsFileName to have multiple configurations files. -## Usage: +## Usage -### Getting the file's values: +### Getting the file's values ```C# using Configs; @@ -70,7 +70,7 @@ bool appConfigActivated = appConfigs.Activated; // GetConfigs again. ``` -### Editing and saving the file: +### Editing and saving the file ```C# using Configs; From acb64da78f4e33dc0c5b7b94c888725acb541d1f Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Fri, 2 Apr 2021 01:58:23 +0200 Subject: [PATCH 15/21] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9733ced..474fa86 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ https://www.nuget.org/packages/Configs/ A simple way to save the configurations of a C# app as a json file. -The json file(s) is saved in AppData/Local and there is currently no way to change that. +The json file(s) is saved in AppData/Local/{YourAppName} and there is currently no way to change that. # How to use From 5d3f8b997faeb73f6d1bdfa0fc4169fab51b0f9a Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Fri, 2 Apr 2021 01:59:26 +0200 Subject: [PATCH 16/21] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 474fa86..91fcd91 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ using Configs; AppConfigs appConfigs = ConfigsTools.GetConfigs(); // Get a value from the configurations file. bool appConfigActivated = appConfigs.Activated; -// This is the value at time GetConfigs was called. If you want updated values then you have to call +// This is the value at the time GetConfigs was called. If you want updated values then you have to call // GetConfigs again. ``` From 0a538a61e5f9b05eb9539db3b2c8a4e2906031c9 Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Fri, 2 Apr 2021 02:00:39 +0200 Subject: [PATCH 17/21] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 91fcd91..e112e58 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ appConfigs.Save(); ```json { - "activated": true, + "activated": false, "randomString": "Hey", "importantStuff": [ { From 97078ec9ec57a884d97081b13855269bb4e0f5a0 Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Fri, 2 Apr 2021 02:05:23 +0200 Subject: [PATCH 18/21] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index e112e58..bb3a316 100644 --- a/README.md +++ b/README.md @@ -66,8 +66,6 @@ using Configs; AppConfigs appConfigs = ConfigsTools.GetConfigs(); // Get a value from the configurations file. bool appConfigActivated = appConfigs.Activated; -// This is the value at the time GetConfigs was called. If you want updated values then you have to call -// GetConfigs again. ``` ### Editing and saving the file From 01ae939a8ebe34590c542dedaa5d7a7a91063593 Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Sat, 3 Apr 2021 19:06:20 +0200 Subject: [PATCH 19/21] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bb3a316..1abcecf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Configs icon](/Configs/Assets/icons8-window-settings-96.png) +![Configs icon](https://raw.githubusercontent.com/Eliasyoussef47/Configs/master/Configs/Assets/icons8-window-settings-96.png) # Configs From e454439445ec2a32b960940236a776fdc196ed88 Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Sat, 3 Apr 2021 19:42:10 +0200 Subject: [PATCH 20/21] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1abcecf..e47d8b9 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ going to be used as the model for the configuration file. ## Setup -Make a class that inherits from ConfigsTools. This class is the model for your configurations file, so it details how -the json file is going to look like. +Make a class that inherits from ConfigsTools. This class is the model for your configurations file, so it details how the json file is going to look like. +Model example: ```C# using Configs; From 347edd62e25126447c17095ea83639ff7aa9d7a1 Mon Sep 17 00:00:00 2001 From: Eliasyoussef47 <31613492+Eliasyoussef47@users.noreply.github.com> Date: Sat, 3 Apr 2021 19:44:29 +0200 Subject: [PATCH 21/21] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index e47d8b9..0b6e735 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,4 @@ appConfigs.Save(); } ``` -Window Settings icon icon -by Icons8 - +[Window Settings icon](https://icons8.com/icons/set/window-settings) icon by [Icons8](https://icons8.com)