예제 #1
0
        public IMessageInput GetLiveProviderInput(IScope scope, string name, bool needCreate)
        {
            IBasicScope basicScope = scope.GetBasicScope("bs", name);

            if (basicScope == null)
            {
                if (!needCreate)
                {
                    return(null);
                }
                lock (scope.SyncRoot)
                {
                    basicScope = scope.GetBasicScope("bs", name);
                    if (basicScope == null)
                    {
                        basicScope = new BroadcastScope(scope, name);
                        scope.AddChildScope(basicScope);
                    }
                }
            }
            if (basicScope is IBroadcastScope)
            {
                return(basicScope as IBroadcastScope);
            }
            return(null);
        }
예제 #2
0
        public IMessageInput GetLiveProviderInput(IScope scope, string name, bool needCreate)
        {
            IBasicScope basicScope = scope.GetBasicScope(Constants.BroadcastScopeType, name);

            if (basicScope == null)
            {
                if (needCreate)
                {
                    lock (scope.SyncRoot)
                    {
                        // Re-check if another thread already created the scope
                        basicScope = scope.GetBasicScope(Constants.BroadcastScopeType, name);
                        if (basicScope == null)
                        {
                            basicScope = new BroadcastScope(scope, name);
                            scope.AddChildScope(basicScope);
                        }
                    }
                }
                else
                {
                    return(null);
                }
            }
            if (!(basicScope is IBroadcastScope))
            {
                return(null);
            }
            return(basicScope as IBroadcastScope);
        }
예제 #3
0
        public bool RegisterBroadcastStream(IScope scope, string name, IBroadcastStream broadcastStream)
        {
            bool flag = false;

            lock (scope.SyncRoot)
            {
                IBasicScope basicScope = scope.GetBasicScope("bs", name);
                if (basicScope == null)
                {
                    basicScope = new BroadcastScope(scope, name);
                    scope.AddChildScope(basicScope);
                }
                if (basicScope is IBroadcastScope)
                {
                    (basicScope as IBroadcastScope).Subscribe(broadcastStream.Provider, null);
                    flag = true;
                }
            }
            return(flag);
        }
예제 #4
0
        public IMessageInput GetLiveProviderInput(IScope scope, string name, bool needCreate)
        {
		    IBasicScope basicScope = scope.GetBasicScope(Constants.BroadcastScopeType, name);
		    if (basicScope == null) 
            {
			    if (needCreate) 
                {
				    lock(scope.SyncRoot)
                    {
					    // Re-check if another thread already created the scope
					    basicScope = scope.GetBasicScope(Constants.BroadcastScopeType, name);
					    if (basicScope == null) 
                        {
						    basicScope = new BroadcastScope(scope, name);
						    scope.AddChildScope(basicScope);
					    }
				    }
			    } 
                else
				    return null;
		    }
		    if (!(basicScope is IBroadcastScope))
			    return null;
            return basicScope as IBroadcastScope;
        }
예제 #5
0
        public bool RegisterBroadcastStream(IScope scope, string name, IBroadcastStream broadcastStream)
        {
		    bool status = false;
		    lock(scope.SyncRoot) 
            {
			    IBasicScope basicScope = scope.GetBasicScope(Constants.BroadcastScopeType, name);
			    if (basicScope == null) 
                {
				    basicScope = new BroadcastScope(scope, name);
				    scope.AddChildScope(basicScope);
			    }
			    if (basicScope is IBroadcastScope) 
                {
                    (basicScope as IBroadcastScope).Subscribe(broadcastStream.Provider, null);
				    status = true;
			    }
		    }
		    return status;
        }