示例#1
0
        public static void WriteConfig()
        {
            var Path       = Directory.GetCurrentDirectory();
            var JsonName   = Path + @"\appsettings.json";
            var JsonHelper = new JsonFileHelper(JsonName);

            JsonHelper.Write <SystemPara>("AppSettings", Global.SystemPara);
        }
示例#2
0
        public static void ReadConfig()
        {
            //var configuration = new ConfigurationBuilder().SetBasePath(Path).AddJsonFile("appsettings.json").Build();
            //Global.IP1 = configuration.GetSection("AppSettings")["IP1"];
            //Global.IP2 = configuration.GetSection("AppSettings")["IP2"];
            //Global.con_chek_x = Convert.ToInt32(configuration.GetSection("AppSettings")["con_chek_x"]);
            //Global.con_chek_y = Convert.ToInt32(configuration.GetSection("AppSettings")["con_chek_y"]);
            //Global.con_factor_x = Convert.ToSingle(configuration.GetSection("AppSettings")["con_factor_x"]);
            //Global.con_factor_y = Convert.ToSingle(configuration.GetSection("AppSettings")["con_factor_y"]);
            //Global.min_x = Convert.ToInt32(configuration.GetSection("AppSettings")["min_x"]);
            //Global.min_y = Convert.ToInt32(configuration.GetSection("AppSettings")["min_y"]);
            //Global.max_x = Convert.ToInt32(configuration.GetSection("AppSettings")["max_x"]);
            //Global.max_y = Convert.ToInt32(configuration.GetSection("AppSettings")["max_y"]);
            var Path       = System.IO.Directory.GetCurrentDirectory();
            var JsonName   = Path + @"\appsettings.json";
            var JsonHelper = new JsonFileHelper(JsonName);

            Global.SystemPara = JsonHelper.Read <SystemPara>("AppSettings");
        }