Assets/Watson/Scripts/Utilities/Config.cs
/// <summary>
/// Load the configuration from the given JSON data.
/// </summary>
/// <param name="json">The string containing the configuration JSON data.</param>
/// <returns></returns>
Load the configuration from the given JSON data.
Load the configuration from the given JSON data .
public bool LoadConfig(string json)
        {
            try
            {
                fsData data = null;
                fsResult r = fsJsonParser.Parse(json, out data);
                if (!r.Succeeded)
                {
                    Log.Error("Config", "Failed to parse Config.json: {0}", r.ToString());
                    return false;
                }
                object obj = this;
                r = sm_Serializer.TryDeserialize(data, GetType(), ref obj);
                if (!r.Succeeded)
                {
                    Log.Error("Config", "Failed to parse Config.json: {0}", r.ToString());
                    return false;
                }
                ConfigLoaded = true;
                return true;
            }
            catch (Exception e)
            {
                Log.Error("Config", "Failed to load config: {0}", e.ToString());
            }
            ConfigLoaded = true;
            return false;
        }
public bool LoadConfig ( string json ) { try { fsData data = null ; fsResult r = fsJsonParser . Parse ( json , out data ) ; if ( ! r . Succeeded ) { Log . Error ( " " , " " , r . ToString ( ) ) ; return false ; } object obj = this ; r = sm_Serializer . TryDeserialize ( data , GetType ( ) , ref obj ) ; if ( ! r . Succeeded ) { Log . Error ( " " , " " , r . ToString ( ) ) ; return false ; } ConfigLoaded = true ; return true ; } catch ( Exception e ) { Log . Error ( " " , " " , e . ToString ( ) ) ; } ConfigLoaded = true ; return false ; }
Load the configuration from the given JSON data.
Load the configuration from the given JSON data .
None
json
string
The string containing the configuration JSON data.
The string containing the configuration JSON data .