public void Write(string configFilePath) { StringBuilder xmlBuilder = new StringBuilder(bbsmaxConfig); xmlBuilder.Replace("{connectionstring}", StringUtil.HtmlEncode(this.ConnectionString)); xmlBuilder.Replace("{dataprovidername}", this.DataProviderName); xmlBuilder.Replace("{licence}", this.Licence); xmlBuilder.Replace("{dynamiccompress}", this.DynamicCompress ? "ON" : "OFF"); xmlBuilder.Replace("{staticcompress}", this.StaticCompress ? "ON" : "OFF"); string ownersXml; if (this.OwnerUsernames.Count > 0) { StringBuilder ownerLinesBuilder = new StringBuilder(); foreach (string username in OwnerUsernames) { ownerLinesBuilder.AppendLine(bbsbaxConfig_Owners_Line.Replace("{username}", username)); } ownersXml = bbsbaxConfig_Owners_Tag.Replace("{lines}", ownerLinesBuilder.ToString()); } else { ownersXml = string.Empty; } xmlBuilder.Replace("{owners}", ownersXml); string passportXml; if (this.PassportClient.EnablePassport) { StringBuilder passportXmlBuilder = new StringBuilder(bbsbaxConfig_Passport_Tag); passportXmlBuilder.Replace("{enable}", PassportClient.EnablePassport ? "true" : "false"); passportXmlBuilder.Replace("{server}", PassportClient.PassportRoot); passportXmlBuilder.Replace("{clientid}", PassportClient.ClientID.ToString()); passportXmlBuilder.Replace("{accesskey}", PassportClient.AccessKey); passportXmlBuilder.Replace("{timeout}", PassportClient.PassportTimeout.ToString()); passportXml = passportXmlBuilder.ToString(); } else { passportXml = string.Empty; } xmlBuilder.Replace("{passport}", passportXml); xmlBuilder.Replace("{maxPlugins}", MaxPlugins.GetAppConfigString()); File.WriteAllText(configFilePath, xmlBuilder.ToString(), Encoding.UTF8); }
private string ProcessChatContent(int senderUserID, string contentNoEncode) { string content = contentNoEncode; content = StringUtil.HtmlEncode(content); content = EmoticonParser.ParseToHtml(senderUserID, content , AllSettings.Current.ChatSettings.EnableUserEmoticon , AllSettings.Current.ChatSettings.EnableDefaultEmoticon ); int replaceCount = 0; content = Pool <SplitLineRegex> .Instance.Replace(content, delegate(Match match) { string result; if (replaceCount < MaxContentRows - 1) { result = "<br />"; } else { result = string.Empty; } replaceCount++; return(result); }, MaxContentRows); if (replaceCount >= (MaxContentRows - 1)) { ThrowError(new MessageContentRowsError("contentWithoutEncode", contentNoEncode, MaxContentRows)); return(string.Empty); } return(content); }