These are chat archives for JaCraig/Craig-s-Utility-Library

26th
Jul 2016
james9837
@james9837
Jul 26 2016 20:52

Trying to use your Configuration namespace, but having some issues: 1. Value changes are not loaded, objects only contain defaults. 2. file is storing XML despite using JSONConfig<>
Full Code:

namespace CUL_Config_Test
{
    public class TestClass : Utilities.Configuration.JSONConfig<TestClass>
    {
        public TestClass()
            : base()
        {
            A = "A";
            B = "B";
        }

        public string A { get; set; }

        public string B { get; set; }

        public override string Name
        {
            get { return "Test1"; }
        }

        protected override string ConfigFileLocation
        {
            get
            {
                return "./Test.config";
            }
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            dynamic ExampleObj = Utilities.Configuration.ConfigurationManager.Get<TestClass>("Test1");

            ExampleObj.B = "E"; // Breakpoint Here... ExampleObj.B == "B" at this point rather than "E" from previous run.

            ExampleObj.Save();  
            // File is XML format, but does show ExampleObj.B as value "E"
        }
    }
}

Any suggestions appreciated. I have so far been unsuccessful getting the unit tests in the repo to run to investigate further on my own.