本文整理汇总了C#中Scope.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Scope.Add方法的具体用法?C# Scope.Add怎么用?C# Scope.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scope
的用法示例。
在下文中一共展示了Scope.Add方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BaseSessionManager
public BaseSessionManager(string sessionId, SimplTypesScope translationScope, Scope<object> applicationObjectScope, ServerProcessor frontend)
{
FrontEnd = frontend;
SessionId = sessionId;
TranslationScope = translationScope;
LocalScope = GenerateContextScope(applicationObjectScope);
LocalScope.Add(SessionObjects.SessionId, sessionId);
LocalScope.Add(SessionObjects.ClientManager, this);
}
示例2: NativeCallContext
public NativeCallContext(NativeMethod source, IElfObject @this, params IElfObject[] args)
{
Stack = new Stack<IElfObject>();
var callScope = new Scope();
callScope.Add("@this", @this);
source.FuncDef.Args.Zip(args, callScope.Add);
Scopes = new Stack<Scope>();
Scopes.Push(callScope);
Source = source;
if (source.FuncDef.Args.Count() != args.Length)
{
throw new UnexpectedElfRuntimeException(@this.VM, String.Format(
"Fatal error invoking native call '{0}({1})' with args '{2}'. Reason: args count mismatch.",
Source.Name, Source.FuncDef.Args.StringJoin(), args.StringJoin()));
}
CurrentEvi = 0;
PrevEvi = -1;
if (source.Body.IsNullOrEmpty())
{
throw new UnexpectedElfRuntimeException(@this.VM, String.Format(
"Fatal error invoking native call '{0}'. Reason: empty method body.", Source.Name));
}
}
示例3: ChatClient
public ChatClient()
{
chatTranslation = ChatTranslations.Get();
clientScope = new Scope<object>();
clientScope.Add(ChatConstants.ChatUpdateLisener, this);
_client = new WebSocketOODSSClient(ServerAddress, PortNumber, chatTranslation, clientScope);
}
示例4: WebSocketOODSSServer
/// <summary>
/// Initialize a websocket oodss server object
/// </summary>
/// <param name="serverTranslationScope">translationscope for the oodss messages</param>
/// <param name="applicationObjectScope">server object scope</param>
/// <param name="idleConnectionTimeout"></param>
/// <param name="maxMessageSize"></param>
public WebSocketOODSSServer(SimplTypesScope serverTranslationScope, Scope<object> applicationObjectScope,
int idleConnectionTimeout=-1, int maxMessageSize=-1, int port=0)
: base(port, Dns.GetHostAddresses(Dns.GetHostName()), serverTranslationScope, applicationObjectScope,
idleConnectionTimeout, maxMessageSize)
{
MaxMessageSize = maxMessageSize + NetworkConstants.MaxHttpHeaderLength;
TranslationScope = serverTranslationScope;
ApplicationObjectScope = applicationObjectScope;
ApplicationObjectScope.Add(SessionObjects.SessionsMap, ClientSessionManagerMap);
ApplicationObjectScope.Add(SessionObjects.WebSocketOODSSServer, this);
_serverInstance = this;
SetUpWebSocketServer(port);
}
示例5: TestServiceClient
public TestServiceClient(string serviceAddress, int port)
{
_serviceAddress = serviceAddress;
_port = port;
_testTypesScope = TestClientTypesScope.Get();
_clientScope = new Scope<object>();
_clientScope.Add(TestServiceConstants.ServiceUpdateListener, this);
_client = new WebSocketOODSSClient(_serviceAddress, _port, _testTypesScope, _clientScope);
}
示例6: DoSemanticChecks
public override void DoSemanticChecks(ErrorHandler errs, Scope currentScope)
{
_scope = new Scope(currentScope, this);
// Add foreach loop iterator variable to the scope
if (!string.IsNullOrEmpty(_iterator))
{
_scope.Add(new NVLocalNode(_iterator, null));
}
foreach (AstNode astNode in _content)
{
astNode.DoSemanticChecks(errs, _scope);
}
}
示例7: Wrap
public override void Wrap(Scope scope)
{
base.Wrap(scope);
// now we need to add default columns if necessary
if (Columns.Count == 0)
AddDefaultColumns(scope);
// next we need to remove child extents of the select from scope
if (Name != null)
{
scope.Remove(this);
scope.Add(Name, this);
}
}
示例8: AddIdentsToScope
public void AddIdentsToScope(ErrorHandler errs, Scope currentScope)
{
_scope = new Scope(currentScope, this);
foreach (NVMethodNode methodNode in _methods)
{
if (_scope.Exists(methodNode.Name))
{
AddSemanticError(errs, string.Format("Type '{0}' already defines a member called {1}", _name, methodNode.Name),
methodNode.Position, ErrorSeverity.Error);
}
else
{
_scope.Add(methodNode);
}
}
}
示例9: WebSocketOODSSClient
// background working thread
#endregion WebSocketComponent
#region Constructor
/// <summary>
/// Initialze a websocket OODSS client object
/// </summary>
/// <param name="ipAddress">server's ip address</param>
/// <param name="portNumber">server's port number</param>
/// <param name="translationScope">TranslationScope for OODSS messages</param>
/// <param name="objectRegistry">application object scope</param>
public WebSocketOODSSClient(String ipAddress, int portNumber, SimplTypesScope translationScope,
Scope<object> objectRegistry)
{
ObjectRegistry = objectRegistry;
TranslationScope = translationScope;
ObjectRegistry.Add(SessionObjects.SessionId, _sessionId);
ServerAddress = ipAddress;
PortNumber = portNumber;
_pendingRequests = new ConcurrentDictionary<long, RequestQueueObject>();
_requestQueue = new BlockingCollection<RequestQueueObject>(new ConcurrentQueue<RequestQueueObject>());
_responseQueue = new BlockingCollection<ResponseQueueObject>(new ConcurrentQueue<ResponseQueueObject>());
}
示例10: UpdateMapWithEntry
/// <summary>
///
/// </summary>
/// <param name="newMap"></param>
/// <param name="key"></param>
/// <param name="translationEntry"></param>
/// <param name="warn"></param>
private void UpdateMapWithEntry(Scope<ClassDescriptor> newMap, string key, ClassDescriptor translationEntry, string warn)
{
ClassDescriptor existingEntry = null;
Boolean entryExists = newMap.TryGetValue(key, out existingEntry);
Boolean newEntry = !entryExists ? true : existingEntry.DescribedClass != translationEntry.DescribedClass;
if (newEntry)
{
if (entryExists)
Debug.WriteLine("Overriding " + warn + " " + key + " with " + translationEntry);
newMap.Add(key, translationEntry);
}
}
示例11: CompileAssign
public static Expression CompileAssign(Assign node, Scope scope)
{
var variable = node.Variable as Value;
var value = node.Value;
if (variable != null)
{
if (variable.IsObject)
{
var obj = variable.Base as Obj;
return CompileObjectAssignment(obj, value, scope);
}
if (!node.Variable.IsAssignable)
throw new InvalidOperationException("Variable is not assignable");
if (!variable.HasProperties)
{
foreach(var name in CompileToNames(variable))
scope.Add(name, VariableType.Variable);
}
}
var right = Compile(value, scope);
return GetMemberInvocaton(node.Variable, scope,
(memberObject, name) => Expression.Dynamic(scope.GetRuntime().SetMemberBinders.Get(name), typeof (object), memberObject, right),
(memberObject) => Expression.Assign(memberObject, right));
}
示例12: Push
public void Push(JObject doc)
{
Scope currentScope = new Scope();
JToken t;
if (doc.TryGetValue("@context", out t))
{
JObject context = (JObject)t;
foreach (JProperty prop in context.Properties())
{
if (prop.Value.Type == JTokenType.Object)
{
currentScope.Add(prop.Name, new TermDefinition((JObject)prop.Value));
}
else
{
string value = prop.Value.ToString();
switch (prop.Name)
{
case "@base":
currentScope.Base = value;
break;
case "@vocab":
currentScope.Vocab = value;
break;
case "@language":
currentScope.Language = value;
break;
default:
switch (value)
{
case "@id":
case "@type":
//TODO: other keywords
currentScope.AddAlias(prop.Name, value);
break;
default:
currentScope.Add(prop.Name, new TermDefinition(value));
break;
}
break;
}
}
}
currentScope.Expand(this);
}
_context.Push(currentScope);
}