예제 #1
0
        public async Task <List <IDayModel> > Get(IChannelModel channel, IMonthModel month)
        {
            var    url = month.ApiUrl;
            string response;

            try {
                response = await _httpClient.GetStringAsync(url);
            }
            catch (Exception e) {
                _snackbarMessageQueue(e.Message);
                return(null);
            }
            var dayList = JsonConvert.DeserializeObject <List <string> >(response);

            dayList.Insert(0, "userlogs");
            var days = new List <IDayModel>();

            foreach (var day in dayList)
            {
                var dayurl =
                    $"https://overrustlelogs.net/{channel.Name}%20chatlog/{month.Name.Replace(" ", "%20")}/{day.Replace(".txt", string.Empty)}";
                var dayurlapi = $"https://overrustlelogs.net/{channel.Name}/{month.Name}/users.json";
                days.Add(new DayModel(day, dayurl, dayurlapi));
            }
            return(days);
        }
 private void ShowMonths(IChannelModel channel = null)
 {
     if (channel != null)
     {
         _currentState.Channel = channel;
         _currentState.Month   = null;
     }
     MonthsDataContext = _viewModelFactory.CreateMonthsViewModel(ChangeTitle);
     ViewIndex         = 1;
 }
예제 #3
0
        public async Task <List <IUserModel> > Get(IChannelModel channel, IMonthModel month)
        {
            var    url = month.ApiUrl.Replace("days.json", "users.json");
            string response;

            try {
                response = await _httpClient.GetStringAsync(url);
            }
            catch (Exception e) {
                _snackbarMessageQueue(e.Message);
                return(null);
            }
            var userList = JsonConvert.DeserializeObject <List <string> >(response);
            var users    = new List <IUserModel>();

            foreach (var user in userList)
            {
                users.Add(new UserModel(user,
                                        $"https://overrustlelogs.net/{channel.Name}%20chatlog/{month.Name}/userlogs/{user.Replace(".txt", string.Empty)}"));
            }
            return(users);
        }
예제 #4
0
 public async Task <List <IMonthModel> > Get(IChannelModel channel)
 {
     return(await Get(channel.Name));
 }