コード例 #1
0
        public static (bool, string) ValidateConfigFile(ConfigJson config = null, string schemaFile = null)
        {
            if (schemaFile == null)
            {
                schemaFile = ConfigVars.CONFIG_FILE_SCHEMA;
            }

            try
            {
                JSchema schema = JSchema.Parse(FileUtilities.GetFileContents(schemaFile));

                var configJO = JObject.Parse(config.ToJson());

                bool valid = configJO.IsValid(schema);
            }
            catch (Exception exc)
            {
                Debug.WriteLine(1);

                return(false, exc.Message);
            }

            return(true, "");
        }