⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 settings.cs

📁 YetAnotherForum.Net+ScrewTurnWiki中文完美汉化增强版
💻 CS
📖 第 1 页 / 共 3 页
字号:
				string page;
				lock(config) {
					if(config.TryGetValue("DefaultPage", out page)) return page;
					else return "MainPage";
				}
			}
			set {
				lock(config) {
					config["DefaultPage"] = value;
				}
			}
		}

		/// <summary>
		/// Gets or sets a value specifying whether to enable double-click Page editing.
		/// </summary>
		public static bool EnableDoubleClickEditing {
			get {
				string dc;
				lock(config) {
					if(config.TryGetValue("EnableDoubleClickEditing", out dc)) return dc.ToLower().Equals("yes");
					else return false;
				}
			}
			set {
				lock(config) {
					config["EnableDoubleClickEditing"] = value ? "YES" : "NO";
				}
			}
		}

		/// <summary>
		/// Gets or sets a value indicating whether to disable the Breadcrumbs Trail.
		/// </summary>
		public static bool DisableBreadcrumbsTrail {
			get {
				string dbc;
				lock(config) {
					if(config.TryGetValue("DisableBreadcrumbsTrail", out dbc)) return dbc.ToLower().Equals("yes");
					else return false;
				}
			}
			set {
				lock(config) {
					config["DisableBreadcrumbsTrail"] = value ? "YES" : "NO";
				}
			}
		}

		/// <summary>
		/// Gets or sets the # of Backups that are kept. Older backups are deleted after Page editing.
		/// </summary>
		/// <remarks>-1 indicates that no backups are deleted.</remarks>
		public static int KeptBackupNumber {
			get {
				string kb;
				lock(config) {
					if(config.TryGetValue("KeptBackupNumber", out kb)) return int.Parse(kb);
					else return -1;
				}
			}
			set {
				lock(config) {
					config["KeptBackupNumber"] = value.ToString();
				}
			}
		}

		/// <summary>
		/// Gets or sets the Theme.
		/// </summary>
		public static string Theme {
			get {
				string theme;
				lock(config) {
					if(config.TryGetValue("Theme", out theme)) return theme;
					else return "Default";
				}
			}
			set {
				lock(config) {
					config["Theme"] = value;
				}
			}
		}

		/// <summary>
		/// Gets the Theme Path.
		/// </summary>
		public static string ThemePath {
			get {
				return ThemesDirectoryName + "/" + Theme + "/";
			}
		}

		/// <summary>
		/// Gets or sets the list of allowed file types.
		/// </summary>
		public static string[] AllowedFileTypes {
			get {
				string aft;
				lock(config) {
					if(config.TryGetValue("AllowedFileTypes", out aft)) return aft.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
					else return new string[] { "jpg", "jpeg", "gif", "png", "tif", "tiff", "bmp", "htm", "html", "zip", "rar", "pdf", "txt" };
				}
			}
			set {
				string res = "";
				for(int i = 0; i < value.Length; i++) {
					res += value[i];
					if(i != value.Length - 1) res += "|";
				}
				lock(config) {
					config["AllowedFileTypes"] = res;
				}
			}
		}

		/// <summary>
		/// Gets or sets a value specifying whether script tags are allowed.
		/// </summary>
		public static bool ScriptTagsAllowed {
			get {
				string sta;
				lock(config) {
					if(config.TryGetValue("ScriptTagsAllowed", out sta)) return sta.ToLower().Equals("yes");
					else return false;
				}
			}
			set {
				lock(config) {
					config["ScriptTagsAllowed"] = value ? "YES" : "NO";
				}
			}
		}

		/// <summary>
		/// Gets or sets the Logging Level.
		/// </summary>
		public static int LoggingLevel {
			get {
				string ll;
				lock(config) {
					if(config.TryGetValue("LoggingLevel", out ll)) return int.Parse(ll);
					else return 3;
				}
			}
			set {
				lock(config) {
					config["LoggingLevel"] = value.ToString();
				}
			}
		}

		/// <summary>
		/// Gets or sets the Max size of the Log file (KB).
		/// </summary>
		public static int MaxLogSize {
			get {
				string m;
				lock(config) {
					if(config.TryGetValue("MaxLogSize", out m)) return int.Parse(m);
					else return 64;
				}
			}
			set {
				lock(config) {
					config["MaxLogSize"] = value.ToString();
				}
			}
		}

		/// <summary>
		/// Gets or sets a valus specifying whether or not Administrators cannot access the Configuration section in the Administration page.
		/// </summary>
		public static bool ConfigVisibleToAdmins {
			get {
				string cvta;
				lock(config) {
					if(config.TryGetValue("ConfigVisibleToAdmins", out cvta)) return cvta.ToLower().Equals("yes");
					else return false;
				}
			}
			set {
				lock(config) {
					config["ConfigVisibleToAdmins"] = value ? "YES" : "NO";
				}
			}
		}

		/// <summary>
		/// Gets or sets the Type name of the Default Users Provider.
		/// </summary>
		public static string DefaultUsersProvider {
			get {
				string dup;
				lock(config) {
					if(config.TryGetValue("DefaultUsersProvider", out dup)) return dup;
					else return typeof(UsersStorageProvider).ToString();
				}
			}
			set {
				lock(config) {
					config["DefaultUsersProvider"] = value;
				}
			}
		}

		/// <summary>
		/// Gets or sets the Type name of the Default Pages Provider.
		/// </summary>
		public static string DefaultPagesProvider {
			get {
				string dup;
				lock(config) {
					if(config.TryGetValue("DefaultPagesProvider", out dup)) return dup;
					else return typeof(PagesStorageProvider).ToString();
				}
			}
			set {
				lock(config) {
					config["DefaultPagesProvider"] = value;
				}
			}
		}

		/// <summary>
		/// Gets or sets the Discussion Permissions.
		/// </summary>
		public static string DiscussionPermissions {
			get {
				string dp;
				lock(config) {
					if(config.TryGetValue("DiscussionPermissions", out dp)) return dp;
					else return "PAGE";
				}
			}
			set {
				lock(config) {
					config["DiscussionPermissions"] = value;
				}
			}
		}

		/// <summary>
		/// Gets or sets a value specifying whether or not to disable concurrent editing of Pages.
		/// </summary>
		public static bool DisableConcurrentEditing {
			get {
				string dce;
				lock(config) {
					if(config.TryGetValue("DisableConcurrentEditing", out dce)) return dce.ToLower().Equals("yes");
					else return false;
				}
			}
			set {
				lock(config) {
					config["DisableConcurrentEditing"] = value ? "YES" : "NO";
				}
			}
		}

		#endregion

		#region Advanced Settings and Associated Data

		/// <summary>
		/// Gets or sets a value indicating whether to disable the Automatic Version Check.
		/// </summary>
		public static bool DisableAutomaticVersionCheck {
			get {
				string dvc;
				lock(config) {
					if(config.TryGetValue("DisableAutomaticVersionCheck", out dvc)) return dvc.ToLower().Equals("yes");
					else return false;
				}
			}
			set {
				lock(config) {
					config["DisableAutomaticVersionCheck"] = value ? "YES" : "NO";
				}
			}
		}

		/// <summary>
		/// Gets or sets the Max file size for upload (in KB).
		/// </summary>
		public static int MaxFileSize {
			get {
				string mfs;
				lock(config) {
					if(config.TryGetValue("MaxFileSize", out mfs)) return int.Parse(mfs);
					else return 10240;
				}
			}
			set {
				lock(config) {
					config["MaxFileSize"] = value.ToString();
				}
			}
		}

		/// <summary>
		/// Gets or sets the # of tries for File Access.
		/// </summary>
		public static int FileAccessTries {
			get {
				string fat;
				lock(config) {
					if(config.TryGetValue("FileAccessTries", out fat)) return int.Parse(fat);
					return 10;
				}
			}
			set {
				lock(config) {
					config["FileAccessTries"] = value.ToString();
				}
			}
		}

		/// <summary>
		/// Gets or sets the delay in milliseconds between File Access tries.
		/// </summary>
		public static int FileAccessTryDelay {
			get {
				string fatd;
				lock(config) {
					if(config.TryGetValue("FileAccessTryDelay", out fatd)) return int.Parse(fatd);
					else return 50;
				}
			}
			set {
				lock(config) {
					config["FileAccessTryDelay"] = value.ToString();
				}
			}
		}

		/// <summary>
		/// Gets or sets a value specifying whether to disable the cache.
		/// </summary>
		public static bool DisableCache {
			get {
				string dc;
				lock(config) {
					if(config.TryGetValue("DisableCache", out dc)) return dc.ToLower().Equals("yes");
					else return false;
				}
			}
			set {
				lock(config) {
					config["DisableCache"] = value ? "YES" : "NO";
				}
			}
		}

		/// <summary>
		/// Gets or sets the Cache Size.
		/// </summary>
		public static int CacheSize {
			get {
				string cs;
				lock(config) {
					if(config.TryGetValue("CacheSize", out cs)) return int.Parse(cs);
					else return 100;
				}
			}
			set {
				lock(config) {
					config["CacheSize"] = value.ToString();
				}
			}
		}

		/// <summary>
		/// Gets or sets the Cache Cut Size.
		/// </summary>
		public static int CacheCutSize {
			get {
				string ccs;
				lock(config) {
					if(config.TryGetValue("CacheCutSize", out ccs)) return int.Parse(ccs);
					else return 20;
				}
			}
			set {
				lock(config) {
					config["CacheCutSize"] = value.ToString();
				}
			}
		}

		/// <summary>
		/// Gets or sets a value specifying whether ViewState compression is enabled or not.
		/// </summary>
		public static bool EnableViewStateCompression {
			get {
				string comp;
				lock(config) {
					if(config.TryGetValue("EnableViewStateCompression", out comp)) return comp.ToLower().Equals("yes");
					else return false;
				}
			}
			set {
				lock(config) {
					config["EnableViewStateCompression"] = value ? "YES" : "NO";
				}
			}
		}

		/// <summary>
		/// Gets or sets a value specifying whether HTTP compression is enabled or not.
		/// </summary>
		public static bool EnableHttpCompression {
			get {
				string comp;
				lock(config) {
					if(config.TryGetValue("EnableHttpCompression", out comp)) return comp.ToLower().Equals("yes");
					return false;
				}
			}
			set {
				lock(config) {
					config["EnableHttpCompression"] = value ? "YES" : "NO";
				}
			}
		}

		/// <summary>
		/// Gets or sets the Username validation Regex.
		/// </summary>
		public static string UsernameRegex {
			get {
				string ur;
				lock(config) {
					if(config.TryGetValue("UsernameRegex", out ur)) return ur;
					else return @"^\w[\w\ !$@%^\.\(\)]{3,25}$";
				}
			}
			set {
				lock(config) {
					config["UsernameRegex"] = value;
				}
			}
		}

		/// <summary>
		/// Gets or sets the Password validation Regex.
		/// </summary>
		public static string PasswordRegex {
			get {
				string pr;
				lock(config) {
					if(config.TryGetValue("PasswordRegex", out pr)) return pr;
					else return @"^\w[\w~!@#$%^\(\)\[\]\{\}\.,=\-_\ ]{6,25}$";
				}
			}
			set {
				lock(config) {
					config["PasswordRegex"] = value;
				}
			}
		}

		#endregion

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -