Example #1
0
        public async Task <CInfo> GetDatabases()
        {
            var content = await communicationManager.GetDatabases(m_Url, m_Session.Id, serverName);

            if (content == null)
            {
                return(await Task.FromResult <CInfo>(null));
            }
            JObject json = JObject.Parse(content);

            if (json == null)
            {
                return(await Task.FromResult <CInfo>(null));
            }

            List <CDatabase> databases = new List <CDatabase>();
            JToken           dbs       = json.SelectTokens("Databases").FirstOrDefault();

            databases = JsonConvert.DeserializeObject <List <CDatabase> >(dbs.ToString());

            List <CLanguage> languages = new List <CLanguage>();

            dbs       = json.SelectTokens("Languages").FirstOrDefault();
            languages = JsonConvert.DeserializeObject <List <CLanguage> >(dbs.ToString());

            return(new CInfo()
            {
                Databases = databases.ToArray(), Languages = languages.ToArray()
            });
        }