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} <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); }
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} <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)); }