public bool IsAccessible(IAccessibleMember member)
        {
            if (member.IsPublic)
            {
                return(true);
            }

            IInternalEntity internalEntity = GetInternalEntity(member);

            if (null != internalEntity)
            {
                internalEntity.Node.RemoveAnnotation("PrivateMemberNeverUsed");
                if (member.IsInternal)
                {
                    return(true);
                }
            }

            IType declaringType = member.DeclaringType;

            if (declaringType == CurrentType())
            {
                return(true);
            }

            if (member.IsProtected && CurrentType().IsSubclassOf(declaringType))
            {
                return(true);
            }

            return(IsDeclaredInside(declaringType));
        }
Exemple #2
0
        bool IsDeclaredInside(IType candidate)
        {
            IInternalEntity entity = candidate as IInternalEntity;

            if (null == entity)
            {
                return(false);
            }

            return(_classStack.Contains(entity.Node));
        }
Exemple #3
0
        protected virtual void EnsureRelatedNodeWasVisited(Node sourceNode, IEntity entity)
        {
            IInternalEntity internalEntity = entity as IInternalEntity;

            if (null != internalEntity)
            {
                Node node = internalEntity.Node;
                if (!WasVisited(node))
                {
                    Visit(node);
                }
            }
        }
        public override void OnReferenceExpression(ReferenceExpression node)
        {
            IInternalEntity entity = node.Entity as IInternalEntity;

            if (entity != null)
            {
                InternalField evaluationContextField = this.GetEvaluationContextField(entity.Node);
                if (evaluationContextField != null)
                {
                    node.ParentNode.Replace(node, this.CreateEvaluationContextFieldReference(evaluationContextField));
                }
            }
        }
Exemple #5
0
        protected virtual void EnsureRelatedNodeWasVisited(Node sourceNode, IEntity entity)
        {
            IInternalEntity internalEntity = GetConstructedInternalEntity(entity);

            if (null == internalEntity)
            {
                return;
            }

            Node node = internalEntity.Node;

            if (WasVisited(node))
            {
                return;
            }

            Visit(node);
        }
        private bool IsDeclaredInside(IType candidate)
        {
            IInternalEntity entity = candidate as IInternalEntity;

            if (null == entity)
            {
                return(false);
            }

            TypeDefinition type = _scope.DeclaringType;

            while (type != null)
            {
                if (type == entity.Node)
                {
                    return(true);
                }
                type = type.DeclaringType;
            }
            return(false);
        }
Exemple #7
0
 /// <summary>
 /// Applies entity data to entity
 /// </summary>
 /// <param name="entityData">Entity data</param>
 /// <param name="entity">Entity</param>
 private static void ApplyEntityDataToEntity(EntityData entityData, IInternalEntity entity)
 {
     if (!string.IsNullOrWhiteSpace(entityData.EntityType))
     {
         entity.SetEntityTypeInternally(entityData.EntityType);
     }
     if (entityData.IsSpectating != null)
     {
         entity.SetSpectatingStateInternally(entityData.IsSpectating.Value);
     }
     if (entityData.GameColor != null)
     {
         entity.SetGameColorInternally(entityData.GameColor.Value);
     }
     if (entityData.Position != null)
     {
         entity.SetPositionInternally(new Vector3(entityData.Position.X, entityData.Position.Y, entityData.Position.Z));
     }
     if (entityData.Rotation != null)
     {
         entity.SetRotationInternally(new Quaternion(entityData.Rotation.X, entityData.Rotation.Y, entityData.Rotation.Z, entityData.Rotation.W));
     }
     if (entityData.Velocity != null)
     {
         entity.SetVelocityInternally(new Vector3(entityData.Velocity.X, entityData.Velocity.Y, entityData.Velocity.Z));
     }
     if (entityData.AngularVelocity != null)
     {
         entity.SetAngularVelocityInternally(new Vector3(entityData.AngularVelocity.X, entityData.AngularVelocity.Y, entityData.AngularVelocity.Z));
     }
     if (entityData.Actions != null)
     {
         entity.SetActionsInternally(entityData.Actions);
     }
     if (entityData.IsResyncRequested != null)
     {
         entity.SetResyncRequestedStateInternally(entityData.IsResyncRequested.Value);
     }
 }
Exemple #8
0
 public StateManager(IModelDataStorage <Type> modelDataStorage)
 {
     trackedEntities_   = new Dictionary <(Type, string), IInternalEntity <object> >();
     modelDataStorage_  = modelDataStorage;
     entitiesToBeAdded_ = new Queue <IInternalEntity <object> >();
 }