Отражает отдельный форум.
Inheritance: Rsdn.Janus.ObjectModel.Feature, IMessagesFeature, IGetData, IForum
Exemple #1
0
 /// <summary>
 /// Проверяет, находится ли форум, указанный с помощью <paramref name="forum"/> в списке подписанных форумов.
 /// </summary>
 /// <param name="forum">Проверяемый форум.</param>
 /// <returns><c>true</c>, если форум находится в списке подписанных форумов, иначе <c>false</c>.</returns>
 public bool IsSubscribed(Forum forum)
 {
     if (forum == null)
         throw new ArgumentNullException("forum");
     return Array.IndexOf(ForumList, forum) >= 0;
 }
Exemple #2
0
		private static string BuildHTMLPage(
			IServiceProvider provider,
			IList<IMsg> msgs,
			ProgressDelegate pd,
			bool processSmiles,
			Encoding encoding)
		{
			var formatter = new TextFormatter();
			var sb = new StringBuilder();
			var forum = new Forum(provider);
			forum.LoadData(msgs[0].ForumID);
			sb.AppendFormat(
				@"<tr><td class='s' colspan='2' align='center'>{0}&nbsp;<font size='1'>[{1}]</font></td></tr>",
				forum.Description, forum.Name);

			string messageFormat;
			using (var rd = new StreamReader(Assembly.GetExecutingAssembly().GetRequiredResourceStream(_messageFormatResource)))
				messageFormat = rd.ReadToEnd();

			var i = 0;
			foreach (var msg in msgs)
			{
				var formattedRating = msg.GetFormattedRating();

				sb.AppendFormat(
					messageFormat,
					msg.ID,
					msg.Subject,
					msg.ParentID,
					SR.Forum.ExportMessages.Export2ParentLink,
					msg.UserNick,
					FormatUserClass((UserClass)msg.UserClass, true),
					msg.Date,
					string.IsNullOrEmpty(formattedRating)
						? string.Empty
						: SR.TGColumnRate + " " + formattedRating,
					formatter.Format(msg.Body, processSmiles));

				i++;
				pd(i, msgs.Count);
			}

			string exportPageFormat;
			using (var rd = new StreamReader(Assembly.GetExecutingAssembly().GetRequiredResourceStream(_exportPageResource)))
				exportPageFormat = rd.ReadToEnd();

			string exportForumStyle;
			using (var rd = new StreamReader(Assembly.GetExecutingAssembly().GetRequiredResourceStream(_exportForumResource)))
				exportForumStyle = rd.ReadToEnd();

			return
				string.Format(
					exportPageFormat,
					forum.Description + " [" + forum.Name + "]",
					encoding.HeaderName,
					exportForumStyle,
					sb);
		}
Exemple #3
0
        private static string BuildHTMLPage(
            IServiceProvider provider,
            IList <IMsg> msgs,
            ProgressDelegate pd,
            bool processSmiles,
            Encoding encoding)
        {
            var formatter = new TextFormatter();
            var sb        = new StringBuilder();
            var forum     = new Forum(provider);

            forum.LoadData(msgs[0].ForumID);
            sb.AppendFormat(
                @"<tr><td class='s' colspan='2' align='center'>{0}&nbsp;<font size='1'>[{1}]</font></td></tr>",
                forum.Description, forum.Name);

            string messageFormat;

            using (var rd = new StreamReader(Assembly.GetExecutingAssembly().GetRequiredResourceStream(_messageFormatResource)))
                messageFormat = rd.ReadToEnd();

            var i = 0;

            foreach (var msg in msgs)
            {
                var formattedRating = msg.GetFormattedRating();

                sb.AppendFormat(
                    messageFormat,
                    msg.ID,
                    msg.Subject,
                    msg.ParentID,
                    SR.Forum.ExportMessages.Export2ParentLink,
                    msg.UserNick,
                    FormatUserClass((UserClass)msg.UserClass, true),
                    msg.Date,
                    string.IsNullOrEmpty(formattedRating)
                                                ? string.Empty
                                                : SR.TGColumnRate + " " + formattedRating,
                    formatter.Format(msg.Body, processSmiles));

                i++;
                pd(i, msgs.Count);
            }

            string exportPageFormat;

            using (var rd = new StreamReader(Assembly.GetExecutingAssembly().GetRequiredResourceStream(_exportPageResource)))
                exportPageFormat = rd.ReadToEnd();

            string exportForumStyle;

            using (var rd = new StreamReader(Assembly.GetExecutingAssembly().GetRequiredResourceStream(_exportForumResource)))
                exportForumStyle = rd.ReadToEnd();

            return
                (string.Format(
                     exportPageFormat,
                     forum.Description + " [" + forum.Name + "]",
                     encoding.HeaderName,
                     exportForumStyle,
                     sb));
        }