Exemple #1
0
        private static void DrawGridByStep(IBoardInfo boardInfo, double xLeftPosition, double yLeftPosition, int step, Color color)
        {
            var smallGridPen = new Pen(color);

            const int offsetX = 400;
            const int offsetY = 400;

            var leftCornerX = (int)Math.Round(xLeftPosition / step) * step - offsetX;
            var leftCornerY = (int)Math.Round(yLeftPosition / step) * step - offsetY;

            for (var i = leftCornerX;
                 i < boardInfo.ScreenInfo.CenterScreenOnMap.X + boardInfo.ScreenInfo.Center.X + offsetX * 2;
                 i += step)
            {
                var lineFrom = UI.ToScreenCoordinates(boardInfo.ScreenInfo, new PointF(i, leftCornerY));
                var lineTo   = UI.ToScreenCoordinates(boardInfo.ScreenInfo, new PointF(i, leftCornerY + boardInfo.ScreenInfo.Height + offsetY));


                boardInfo.GraphicSurface.DrawLine(smallGridPen, lineFrom.X, lineFrom.Y, lineTo.X, lineTo.Y);
            }

            for (var i = leftCornerY;
                 i < boardInfo.ScreenInfo.CenterScreenOnMap.Y + boardInfo.ScreenInfo.Center.Y + offsetY * 2;
                 i += step)
            {
                var lineFrom = UI.ToScreenCoordinates(boardInfo.ScreenInfo, new PointF(leftCornerX, i));
                var lineTo   = UI.ToScreenCoordinates(boardInfo.ScreenInfo, new PointF(leftCornerX + boardInfo.ScreenInfo.Width + offsetX * 2, i));


                boardInfo.GraphicSurface.DrawLine(smallGridPen, lineFrom.X, lineFrom.Y, lineTo.X, lineTo.Y);
            }
        }
Exemple #2
0
 public bool Contains(IBoardInfo board)
 {
     if (board == null)
     {
         throw new ArgumentNullException("board");
     }
     return this.Any(category => category.Children.Contains(board));
 }
Exemple #3
0
        //public static void DrawGrid(Graphics graphics, GameSession gameSession, IEnumerable<ICelestialObject> connectors, SortedDictionary<int, GranularObjectInformation> granularTurnInformation, int turnStep, ScreenParameters screenParameters)
        public static void DrawGrid(IBoardInfo boardInfo)
        {
            double xLeftPosition = boardInfo.ScreenInfo.CenterScreenOnMap.X - boardInfo.ScreenInfo.Center.X;
            double yLeftPosition = boardInfo.ScreenInfo.CenterScreenOnMap.Y - boardInfo.ScreenInfo.Center.Y;

            DrawGridByStep(boardInfo, xLeftPosition, yLeftPosition, 10, Color.FromArgb(8, 8, 8));
            DrawGridByStep(boardInfo, xLeftPosition, yLeftPosition, 100, Color.FromArgb(18, 18, 18));
        }
Exemple #4
0
 public ThreadHeader(IBoardInfo source, string key, string title)
     : this()
 {
     //Parent = parent;
     SourceBoard = source;
     url = ThreadUrlFormatter.FormatUrl(source.Server, source.Path, key);
     Title = title;
     Key = key;
     Since = ThreadUtility.CalculateSinceTime(key);
 }
Exemple #5
0
        public static IThreadHeader[] Parse(IBoardInfo source, string subjects)
        {
            List<IThreadHeader> result = new List<IThreadHeader>();
            foreach (Match thread in subjectPattern.Matches(subjects))
            {
                result.Add(new ThreadHeader(
                    source, thread.Groups["key"].Value, System.Web.HttpUtility.HtmlDecode(thread.Groups["title"].Value)));
            }

            return result.ToArray();
        }
 public BoardTableTreeViewItemSelectedEventArgs(IBoardInfo selectedBoard)
 {
     SelectedBoard = selectedBoard;
 }
 public BoardController(IBoardInfo boardInfo)
 {
     this.boardInfo = boardInfo;
 }
Exemple #8
0
 public ICategory FindFromBoardInfo(IBoardInfo board)
 {
     return this.FirstOrDefault(category => category.Children.Contains(board));
 }
Exemple #9
0
 public void Replace(IBoardInfo oldBoard, IBoardInfo newBoard)
 {
     if (oldBoard == null)
     {
         throw new ArgumentNullException("oldBoard");
     }
     if (newBoard == null)
     {
         throw new ArgumentNullException("newBoard");
     }
     foreach (ICategory category in this)
     {
         int index = category.Children.IndexOf(oldBoard);
         if (index != -1)
         {
             IBoardInfo info = category.Children[index];
             info.Path = newBoard.Path;
             info.Server = newBoard.Server;
         }
     }
 }
Exemple #10
0
 public PatrolResult(bool success, IBoardInfo source,
     IList<IThreadHeader> aliveThreads, DateTime patrolledTime)
 {
     Success = success;
     Source = source;
     AliveThreads = aliveThreads;
     PatrolledTime = patrolledTime;
 }
Exemple #11
0
 private PatrolResult UpdateBoard(IBoardInfo board, bool followBoard = true)
 {
     try
     {
         IThreadHeader[] allHeaders = ThreadParser.Parse(board, board.Read());
         bool success = allHeaders.Length > 0;
         if (!success && followBoard)
         {
             Common.CurrentSettings.Boards.FollowMovedBoard();
             UpdateBoard(board, false);
         }
         return new PatrolResult(success, board, allHeaders, DateTime.Now);
     }
     catch (System.Net.WebException ex)
     {
         Common.Logs.Add("通信エラー", board.Name + ex.Message, LogStatus.Error);
         return new PatrolResult(false, board, null, DateTime.Now);
     }
 }
Exemple #12
0
 public void ChangeBoard(IBoardInfo newBoard)
 {
     Server = newBoard.Server;
 }