Пример #1
0
 private void AddObject(ToffeeObject tObject)
 {
     if (tObject.Network != this)
     {
         throw new ToffeeException("Tried to add object to network '{0}' but object belongs to '{1}'", Name, tObject.Network.Name);
     }
     if (Objects.ContainsKey(tObject.GetType()))
     {
         Objects[tObject.GetType()].Add(tObject);
         ObjectIdentifierLookup[tObject.GetType()].Add(tObject.FullName, tObject);
         ObjectLookup[tObject.GetType()].Add(tObject.ObjectId, tObject);
     }
     else
     {
         Objects.Add(tObject.GetType(), new List <ToffeeObject>());
         ObjectIdentifierLookup.Add(tObject.GetType(), new Dictionary <string, ToffeeObject>());
         ObjectLookup.Add(tObject.GetType(), new Dictionary <uint, ToffeeObject>());
         Objects[tObject.GetType()].Add(tObject);
         ObjectIdentifierLookup[tObject.GetType()].Add(tObject.FullName, tObject);
         ObjectLookup[tObject.GetType()].Add(tObject.ObjectId, tObject);
     }
 }
Пример #2
0
 public ToffeeProperty(ToffeeObject owner, PropertyInfo propertyInfo, ToffeeModifiers modifiers)
     : base(owner, propertyInfo.Name, modifiers)
 {
     PropertyInfo = propertyInfo;
 }
Пример #3
0
 public ToffeeField(ToffeeObject owner, string identifier, ToffeeModifiers modifiers = ToffeeModifiers.None)
 {
     Owner      = owner;
     Identifier = identifier;
     Modifiers  = modifiers;
 }
Пример #4
0
 public ToffeeMethod(ToffeeObject owner, MethodInfo methodInfo, ToffeeModifiers modifiers = ToffeeModifiers.None)
     : base(owner, methodInfo.Name, modifiers)
 {
     MethodInfo = methodInfo;
     Parameters = MethodInfo.GetParameters().Select(p => p.ParameterType).ToArray();
 }