예제 #1
0
        public AccessController(
            MethodWeb web)
        {
            this.web = web;
            const bool truth = true;

            this.timerFinished =
                new ManualResetEvent(truth);
        }
예제 #2
0
        public override bool AddWeb(
            MethodWeb web,
            string name = null)
        {
            if (web == null)
            {
                return(falsity);
            }

            ICollection <NamedMethodWebHolder> ws;
            NamedMethodWebHolder alreadyAddedWeb;

            lock (this.locker)
            {
                ws = this.webs;
                alreadyAddedWeb = EH.FirstOrDefault(
                    ws,
                    webHolder => ReferenceEquals(web, webHolder?.Web));
            }

            if (alreadyAddedWeb != null)
            {
                return(falsity);
            }

            lock (this.locker)
            {
                if (EH.Contains(
                        EH.Select(
                            ws,
                            webHolder => webHolder?.Name),
                        name))
                {
                    return(falsity);
                }
            }

            this.add(
                new NamedMethodWebHolder
            {
                Web  = web,
                Name = name
            });

            return(truth);
        }
예제 #3
0
        public virtual bool AddWeb(
            MethodWeb web,
            string name = null)
        {
            if (web == null)
            {
                return(falsity);
            }

            var ws = this.webs;
            var alreadyAddedWeb = EH.FirstOrDefault(
                ws,
                webHolder => ReferenceEquals(
                    web,
                    webHolder?.Web));

            if (alreadyAddedWeb != null)
            {
                return(falsity);
            }

            if (EH.Contains(
                    EH.Select(
                        ws,
                        webHolder => webHolder?.Name),
                    name))
            {
                return(falsity);
            }

            this.add(
                new NamedMethodWebHolder
            {
                Web  = web,
                Name = name
            });
            return(truth);
        }