Application/AppDecoratorHelper.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using ComLib;
using ComLib.Arguments;
using ComLib.Diagnostics;
using ComLib.Logging;
using ComLib.Caching;
using ComLib.Configuration;
using ComLib.EmailSupport;
using ComLib.StatusUpdater;


namespace ComLib.Application
{
    /// <summary>
    /// This is a static decorator( As opposed to using AOP ) to get cross-cutting behaviour.).
    /// </summary>
    public class AppDecoratorHelper
    {
        private Type _appType;
        private string _delimitedDecorators;
        private IDictionary<string, bool> _decorators;


        /// <summary>
        /// Initialize the decorators.
        /// </summary>
        /// <param name="appType"></param>
        /// <param name="delimitedDecorators"></param>
        public AppDecoratorHelper(Type appType, string delimitedDecorators)
        {
            Init(appType, delimitedDecorators);
        }


        /// <summary>
        /// Determine if there are any decorations specified.
        /// </summary>
        public void Init(Type appType, string delimitedDecorators)
        {
            _appType = appType;
            _delimitedDecorators = delimitedDecorators;
            _decorators = new Dictionary<string, bool>();

            // No decorators?
            if (string.IsNullOrEmpty(_delimitedDecorators))
                return;

            string[] decorators = _delimitedDecorators.Split(',');
            if (decorators == null || decorators.Length == 0)
                return;

            // Store the decorator in the dictionary.
            decorators.ForEach(decorator => _decorators[decorator.ToLower().Trim()] = true);
        }


后面还有 100 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。