Ejemplo n.º 1
0
 public ServerInfoViewModel(int serverID)
 {
     if (serverManager.Servers.Keys.Contains(serverID))
     {
         _server = serverManager.Servers[serverID];
         if (_server.Enabled)
         {
             _server.CheckForNewData();
             CreateServerCharts(_server.GetServerBoundDic());
         }
     }
     else
     {
         throw new HttpException(404, "Not found");
     }
 }
Ejemplo n.º 2
0
 public ServerRankingViewModel(int serverID, int limit, string date)
 {
     if (serverManager.Servers.Keys.Contains(serverID))
     {
         _server = serverManager.Servers[serverID];
         if (_server.Enabled)
         {
             if (date == null)
             {
                 _server.CheckForNewData();
                 d = _server.LastUpdateTime.DateTime;
                 _rankingDataSet = _server.GetRankingList(limit);
             }
             else
             {
                 limit = 990;
                 SenkaTimeInfo dateInfo, compareDateInfo;
                 if (DateTime.TryParseExact(date, "yyMMddHH", null, DateTimeStyles.None, out d) &&
                     _server.GetDateID(d, out dateInfo, out compareDateInfo))
                 {
                     _rankingDataSet = _server.GetRankingList(limit, dateInfo, compareDateInfo);
                 }
                 else
                 {
                     throw new HttpException(404, "Not found");
                 }
             }
             string timeMarkup = d.ToString("s");
             string timeString = d.ToString("yyyy年M月d日 H時");
             _state            = new HtmlString(string.Format("<time datetime=\"{0}\">{1}</time>", timeMarkup, timeString));
             _isDefaultListing = (limit == 0);
             if (!string.IsNullOrEmpty(date))
             {
                 _description = string.Format("{0} {1}の戦果データ。", timeString, _server.Name);
             }
         }
         else
         {
             _rankingDataSet = new List <SenkaData>();
             _state          = new HtmlString("情報なし");
         }
     }
     else
     {
         throw new HttpException(404, "Not found");
     }
 }