config文件节选:
<Core
defaultLanguage="zh-CN"
filesPath="/"
disableEmail="false"
disableIndexing="false"
disableThreading="false"
cacheFactor="5"
smtpServerConnectionLimit="-1"
enableLatestVersionCheck="true"
systemType = "Self"
backwardsCompatiblePasswords = "true"
textEditorType = "Openlab.FreeTextBoxWraper.FTB, Openlab.CSAddOns"
requireSSL = "false"
defaultRoles = "Everyone;Registered Users"
wwwStatus = "Ignore"
AttachmentsPath = "~/Attachments/"
AvatarsPath = "~/Avatars/Uploads/"
AttachmentSaveMode = "Disk"
AvatarSaveMode = "Disk"
>
defaultLanguage="zh-CN"
filesPath="/"
disableEmail="false"
disableIndexing="false"
disableThreading="false"
cacheFactor="5"
smtpServerConnectionLimit="-1"
enableLatestVersionCheck="true"
systemType = "Self"
backwardsCompatiblePasswords = "true"
textEditorType = "Openlab.FreeTextBoxWraper.FTB, Openlab.CSAddOns"
requireSSL = "false"
defaultRoles = "Everyone;Registered Users"
wwwStatus = "Ignore"
AttachmentsPath = "~/Attachments/"
AvatarsPath = "~/Avatars/Uploads/"
AttachmentSaveMode = "Disk"
AvatarSaveMode = "Disk"
>
enum类型:
/// <summary>
/// 附件保存模式——磁盘、数据库
/// </summary>
public enum FileSaveMode
{
/// <summary>
/// 数据库
/// </summary>
DataBase,
/// <summary>
/// 磁盘
/// </summary>
Disk
}
/// 附件保存模式——磁盘、数据库
/// </summary>
public enum FileSaveMode
{
/// <summary>
/// 数据库
/// </summary>
DataBase,
/// <summary>
/// 磁盘
/// </summary>
Disk
}
读取config中的值
att = attributeCollection["AttachmentSaveMode"];
if(att != null)
{
try
{
attachmentSaveMode = (FileSaveMode)Enum.Parse(typeof(FileSaveMode), attributeCollection["AttachmentSaveMode"].Value);
}
catch{}
}
浙公网安备 33010602011771号