Example #1
0
        public override bool Equals(object obj)
        {
            TargetKey other = obj as TargetKey;

            if (other != null)
            {
                return(other.m_TargetType == m_TargetType && other.m_Sign == m_Sign);;
            }
            return(false);
        }
Example #2
0
        public ITarget GetTarget(TargetType targetType, string ext = null)
        {
            ITarget   target = null;
            TargetKey key    = new TargetKey(targetType, ext);

            if (m_Targets.TryGetValue(key, out target))
            {
                return(target);
            }

            switch (targetType)
            {
            case TargetType.Console:
                ConsoleTarget consoleTarget = new ConsoleTarget();
                consoleTarget.Init();
                target = consoleTarget;
                break;

            case TargetType.File:
                string     filepath   = ext;
                FileTarget fileTarget = new FileTarget(filepath);
                fileTarget.Init();
                target = fileTarget;
                break;

            default:
                throw new Exception("Don't support type " + targetType.ToString());
            }

            if (target != null)
            {
                m_Targets[key] = target;
            }

            return(target);
        }