Git Product home page Git Product logo

jsonconfig's People

Contributors

bitdeli-chef avatar dynalon avatar samrg472 avatar slestak avatar sohjsolwin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsonconfig's Issues

Weird type comparison

If you look at line 98 in the current version of Merger.cs, it's using the same value twice when determining types

var value1 = kvp1.Value;
var value2 = kvp2.Value;
var type1 = value1.GetType ();
var type2 = value1.GetType ();

Doesn't seem right to me...

enable nuget package restore for solution

It would be nice if you enabled nuget package restore for the solution, this way we can very easily retrieve any dependencies after checking out the repository. As it is, we have to manually find and retrieve any dependencies manually.

Fix TODO in Config() constructor

You had a TODO in the Config constructor for checking IDE build dir and adjusting the execution path accordingly to make in windows-aware. Here is a patch for that.

Reading Strings with "\" in them

I have a db connection string in my config file:

Connection: "localhost\sqlexpress"

but when I debug. in code the variable is " localhostsqlexpress" (no "" )

and if put two "" then both of them appear in the variable?

is there a special way I need to read the string?

A global jsonconfig for sharing between two .net apps

Hello

thanks for developing this. I was wondering if there is a way through which i can save the config file in a shared folder and have two .net based desktop applications read and write it?

Looking forward to the response. Thanks

Case insensitive access

internal Dictionary<string, object> members = new Dictionary<string, object> ();

Would it be possible to access the keys case insensitive, if the initialitazion of the dictionary were like this:

internal Dictionary<string, object> members = new Dictionary<string, object> (StringComparer.InvariantCultureIgnoreCase);

Build for .net standard

Good day,

We are busy migrating to .net core and cannot get this library to work.

Please can you update nuget with the dll build for .net standard

where to put default.conf

I am not sure where exactly to put my default.conf file? I have put it in the root directory but when I debug there are 0 keys on my Config.Default instance?

switch to newtonsoft.json

Hi there, great library.

I've run into a number of problems trying to compile the solution and it is largely due to JsonFX. I was able to get it running on some sites, but others would crash unexpectedly.

I modified your code to use http://www.nuget.org/packages/newtonsoft.json/ which is the most widely and popular used json library in .NET. Now it works without any issues at all.

Just thought you should know, I can provide details on the code I changed if you'd like.

JsonConfig.Config not initialized?

I'm having an issue where when I try to access a config element, say

JsonConfig.Config.MergedConfig.ServiceName

, which is a string in the default.conf file. I'm getting a null value. BUT if I pause execution and then add

JsonConfig.Config.MergedConfig

to the watch variables, and I expand it, it will evaluate properly.

Any thoughts?

BTW great job on this - I was about to write one, but now I dont need to!

Is it a bug?

It's so surprising!
I try to read a array from a json format file. The file has two elements in Repository array, but after deserializing, I get a 3-element array.

capture

This is the json file

{"Repository":["http://mirrors.neusoft.edu.cn/android/repository","https://dl.google.com/android/repository"],"SeletedRepository":0}

This is my code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace MeloduetAndroidSDKManagerWinform.Helper
{
    public class ApplicationSetting
    {
        public List<string> Repository { get;  } = new List<string>() { "http://mirrors.neusoft.edu.cn/android/repository" };
        public int SeletedRepository { get; set; } = 0;
        public static ApplicationSetting Load(string path)
        {

            if (System.IO.File.Exists(path))
            {
                ApplicationSetting obj = null; 
                string json = System.IO.File.ReadAllText(path);
                obj = JsonConvert.DeserializeObject<ApplicationSetting>(json);
                return obj;
            }
            else
            {
                var obj = new ApplicationSetting();
                obj.Save(path);
                return obj;       
            }

        }
        public void Save(string path)
        {
            System.IO.File.WriteAllText(path, JsonConvert.SerializeObject(this),Encoding.UTF8);
        }

    }
}

Merging with null as default

Hey everyone,

I just ran into the problem, that you cannot merge the default value null with anothe value. They key simply will not show up in the result. Here is a quick example in Pseudocode:

var actual = @"{"override":"1png","onlyActual":1}"
var default = @"{"override":null,"onlyDefault":2}"
JsonConfig.Merger.Merge(JsonConfig.Config.ParseJson(actual),JsonConfig.Config.ParseJson(default));
// => "{"onlyActual":1,"onlyDefault:2}"

A quick research in the code lead to line 67 in Merger.cs:

                // skip already copied over keys
                if (!dict2.Keys.Contains(kvp1.Key) || dict2[kvp1.Key] == null)
                    continue;

Could this be the problem?

Cheers! Marvin

nuget package

Is there a nuget package available for jsonconfig?

Global config not updating when user or default config changes

This is shown when running the ManualDefaultAndUserConfig unit test together with CurrentScopeTest, before bfb1f4d.

When executed separately both will pass, but when ran together the line:

dynamic c = Config.GetCurrentScope ();

will initialize the global config object, causing it to be an outdated merge of the user/default configs after they're set in the set up of ManualDefaultAndUserConfig:

Config.SetUserConfig (parsed.Fruits);
Config.SetDefaultConfig (parsed.Vegetables);
//...
dynamic scope = Config.Global; //no longer up-to-date

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.