public ShitarabaThread(Uri uri, string threadTitle, string numberOfReses, ShitarabaBoard board) { Uri = uri; var match = Regex.Match(uri.AbsolutePath, @"^/bbs/read\.cgi/([A-Za-z]+)/(\d+)/(\d+)"); if (!match.Success) throw new FormatException("bad uri"); m_Board = board; m_ThreadNumber = match.Groups[3].Value; Title = threadTitle; LatestMessageNumber = int.Parse(numberOfReses); Reload(); }
// 板オブジェクトを作成する private static IBoard CreateBoard(Uri uri) { // 適切な板クラスを選択して、実体化する IBoard board = null; if (ShitarabaBoard.IsBoardUri(uri)) { board = new ShitarabaBoard(uri); } else if (WaiwaiBoard.IsBoardUri(uri)) { board = new WaiwaiBoard(uri); } else if (BintanBoard.IsBoardUri(uri)) { board = new BintanBoard(uri); } else if (GenericNichanBoard.IsBoardUri(uri)) { board = new GenericNichanBoard(uri); } else throw new ApplicationException("URLは対応した掲示板ではありません"); return board; }