Ejemplo n.º 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;
		}
Ejemplo n.º 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;
		}