コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
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;
        }
コード例 #4
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;
        }