Exemplo n.º 1
0
 public bool LoadNetwork()
 {
     Unload();
     try
     {
         _configDataJsonNode = ConfigDatabase.LoadFromUrlAsync <ConfigDataJsonNode>(_httpClient,
                                                                                    _networkSourceSettings.DatabaseUrl).GetAwaiter().GetResult();
         foreach (var language in _configDataJsonNode.Languages)
         {
             var url = _networkSourceSettings.DatabaseTranslateUrl(language);
             _configDataTranslateJsonNodes.Add(language,
                                               ConfigDatabase.LoadFromUrlAsync <ConfigDataTranslateJsonNode>(_httpClient, url).GetAwaiter().GetResult());
         }
         _configData = ConfigDatabase.Build(_configDataJsonNode);
     }
     catch (Exception e)
     {
         Unload();
         _errorOutput.WriteLine("Error: Failed load database - " + e.Message);
         return(false);
     }
     return(true);
 }