本文整理汇总了C#中IScope.GetBasicScope方法的典型用法代码示例。如果您正苦于以下问题:C# IScope.GetBasicScope方法的具体用法?C# IScope.GetBasicScope怎么用?C# IScope.GetBasicScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScope
的用法示例。
在下文中一共展示了IScope.GetBasicScope方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LookupProviderInputType
/// <summary>
/// Lookups the input type of the provider.
/// </summary>
/// <param name="scope">The scope.</param>
/// <param name="name">The provider name.</param>
/// <returns><code>Live</code> if live, <code>Vod</code> if VOD stream, <code>NotFound</code> otherwise.</returns>
/// <remarks>Live is checked first and VOD second.</remarks>
public InputType LookupProviderInputType(IScope scope, string name)
{
InputType result = InputType.NotFound;
if (scope.GetBasicScope(Constants.BroadcastScopeType, name) != null)
{
//We have live input
result = InputType.Live;
}
else
{
try
{
FileInfo file = GetStreamFile(scope, name);
if (file != null)
{
//We have vod input
result = InputType.Vod;
}
}
catch (Exception ex)
{
log.Warn(string.Format("Exception attempting to lookup file: {0}", name), ex);
}
}
return result;
}
示例2: GetLiveProviderInput
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: GetSharedObject
public ISharedObject GetSharedObject(IScope scope, string name)
{
return scope.GetBasicScope(ScopeType, name) as ISharedObject;
}
示例4: ClearSharedObjects
public bool ClearSharedObjects(IScope scope, string name)
{
bool result = false;
if(HasSharedObject(scope, name))
{
// "/" clears all local and persistent shared objects associated
// with the instance
// if (name.equals("/")) {
// /foo/bar clears the shared object /foo/bar; if bar is a directory
// name, no shared objects are deleted.
// if (name.equals("/")) {
// /foo/bar/* clears all shared objects stored under the instance
// directory /foo/bar. The bar directory is also deleted if no
// persistent shared objects are in use within this namespace.
// if (name.equals("/")) {
// /foo/bar/XX?? clears all shared objects that begin with XX,
// followed by any two characters. If a directory name matches this
// specification, all the shared objects within this directory are
// cleared.
// if (name.equals("/")) {
// }
result = (scope.GetBasicScope(ScopeType, name) as ISharedObject).Clear();
}
return result;
}
示例5: UnregisterBroadcastStream
public bool UnregisterBroadcastStream(IScope scope, string name)
{
bool status = false;
lock(scope.SyncRoot)
{
IBasicScope basicScope = scope.GetBasicScope(Constants.BroadcastScopeType, name);
if (basicScope is IBroadcastScope)
{
scope.RemoveChildScope(basicScope);
status = true;
}
}
return status;
}
示例6: RegisterBroadcastStream
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;
}
示例7: GetBroadcastScope
/// <summary>
/// Returns broadcast scope object for given scope and child scope name.
/// </summary>
/// <param name="scope">Scope object.</param>
/// <param name="name">Child scope name.</param>
/// <returns>Broadcast scope.</returns>
public IBroadcastScope GetBroadcastScope(IScope scope, string name)
{
IBasicScope basicScope = scope.GetBasicScope(Constants.BroadcastScopeType, name);
return basicScope as IBroadcastScope;
}