コード例 #1
0
        protected IEnumerable<TreeViewResult> GetDistinctDictionaryTablesTree(List<IUserField> userFields, Aspect.Domain.CommonDomain provider)
        {
            List<Guid> list = userFields.Select(s => s.DictionaryTreeID).Distinct().ToList();
            List<Aspect.Domain.GetDictionaryTreeParentsResult> tableList = new List<Aspect.Domain.GetDictionaryTreeParentsResult>();
            foreach (Guid item in list)
            {
                List<Aspect.Domain.GetDictionaryTreeParentsResult> lll = provider.GetDictionaryTreeParents(item).ToList();
                int max =lll.Max(l => l.Level).Value;
                lll.ForEach(delegate(GetDictionaryTreeParentsResult n)
                {
                    n.Level = (n.Level - max) * -1;
                });
                tableList.AddRange(lll);
            }

            //return tableList.Distinct(DictionaryTreeResultEqualityComparer.Instance).OrderByDescending(d => d.Level).ToList().ConvertAll(
            return tableList.Distinct(DictionaryTreeResultEqualityComparer.Instance).OrderBy(d => d.Level).ToList().ConvertAll(
                delegate(GetDictionaryTreeParentsResult n)
                {
                    return new TreeViewResult()
                    {
                        ID = n.ID,
                        Level = (int)n.Level
                    };
                }
                ).ToList();
        }
コード例 #2
0
 public ClassificationWhereClauseBuilder(List<Guid?> classificationTreeIDs, Aspect.Domain.CommonDomain provider)
 {
     if (classificationTreeIDs.Count > 0)
     {
         List<Guid?> ids = new List<Guid?>();
         foreach (Guid? item in classificationTreeIDs)
         {
             if (item.HasValue)
             {
                 ids.AddRange(
                     provider.GetClassificationTreeChilds(item.Value).ToList().ConvertAll(
                     delegate(Aspect.Domain.GetClassificationTreeChildsResult n){
                     return n.id; }));
                 ids.Add(item);
             }
             //if(item != null) list.Add(string.Format("'{0}'", item.ToString()));
         }
         string[] list = ids.Distinct().Where(d => d.HasValue).ToList().ConvertAll(delegate(Guid? n){
             return string.Format("'{0}'", n.Value.ToString());
         }).ToArray();
         if (list.Count() > 0)
         {
             Expression.AppendFormat(classificationWhereClauseTemplate, string.Join(",", list));
         }
     }
 }
コード例 #3
0
        /// <summary>Initializes a new instance of the <see cref="ParallelEntityProcessingSystem" /> class.</summary>
        /// <param name="aspect">The aspect.</param>
        protected ParallelEntityProcessingSystem(Aspect aspect)
            : base(aspect)
        {
#if FULLDOTNET || CLIENTPROFILE
            this.factory = new TaskFactory(TaskScheduler.Default);
#endif
        }
コード例 #4
0
ファイル: InjectorImpl.cs プロジェクト: kyungtaak/TANG
 public void BindAspect(Aspect a)
 {
     if(aspect != null)
     {
         throw new BindException("Attempt to re-bind aspect! old=" + aspect + " new=" + a);
     }
     aspect = a;
 }
コード例 #5
0
        protected EntityRenderer(EntityWorld entityWorld, Aspect aspect)
        {
            _entityWorld = entityWorld;
            _entityTracker = EntityTracker.FromAspect(aspect);
            _entityTracker.EntityAdded += this.OnEntityAdded;
            _entityTracker.EntityRemoved += this.OnEntityRemoved;

            entityWorld.AddEntityTracker(_entityTracker);
        }
コード例 #6
0
 protected virtual void AddPluginRow(TabSection tabSection, Aspect.MethodInvocation methodInformation)
 {
     tabSection.AddRow()
             .Column(methodInformation.ClassName)
             .Column(methodInformation.MethodName)
             .Column(methodInformation.Parameters)
             .Column(methodInformation.InvocationTimeMilliseconds)
             .WarnIf(methodInformation.InvocationTimeMilliseconds >= this.warningThresholdMs);
 }
コード例 #7
0
 public Talent(string name, TalentType type, Aspect primaryAspect, Aspect secondaryAspect = Aspect.None, bool savoir = false)
 {
     Level = 0;
     _name = name;
     _primaryAspect = primaryAspect;
     _secondaryAspect = secondaryAspect;
     _type = type;
     _savoir = savoir;
 }
コード例 #8
0
ファイル: AspectsSequence.cs プロジェクト: GNewsCo/DrawPub
        /// <summary>
        /// Gets the sequence order in which the given aspect will run.
        /// </summary>
        /// <param name="aspect">The aspect to get the sequence order of</param>
        public static int GetOrder(Aspect aspect)
        {
            Type aspectType = aspect.GetType();
            var index = aspectsSequence.IndexOf(aspectType);
            if (index >= 0)
            {
                return index;
            }

            string message = string.Format("Sequence order is not specified for {0}. Please  go to {1} and specify the sequence order of {0}.", aspectType.Name, MethodBase.GetCurrentMethod().DeclaringType);
            throw new Exception(message);
        }
コード例 #9
0
 /*private StringBuilder expression;
 /// <summary>
 /// Classification WHERE Clause
 /// </summary>
 public override StringBuilder Expression
 {
     get
     {
         if (expression == null) expression = new StringBuilder();
         return expression;
     }
 }*/
 public ClassificationWhereClauseBuilder(Guid classificationTreeID, Aspect.Domain.CommonDomain provider)
 {
     if (classificationTreeID != Guid.Empty)
     {
         List<string> list = new List<string>();
         foreach (Aspect.Domain.GetClassificationTreeChildsResult item in provider.GetClassificationTreeChilds(classificationTreeID))
         {
             if (item.id != null) list.Add(string.Format("'{0}'", item.id.ToString()));
         }
         list.Add(string.Format("'{0}'", classificationTreeID.ToString()));
         string[] ids = list.ToArray();
         Expression.AppendFormat(classificationWhereClauseTemplate, string.Join(",", ids));
     }
 }
コード例 #10
0
        public Task<SubscriptionsResponse> Create(Object type, Aspect aspect)
        {
            // create a new guid that uniquely identifies this subscription request
            var verifyToken = Guid.NewGuid().ToString();
            var request = new HttpRequestMessage {Method = HttpMethod.Post};

            request.AddParameter("client_id", config.ClientId);
            request.AddParameter("client_secret", config.ClientSecret);
            request.AddParameter("object", type.ToString().ToLower());
            request.AddParameter("aspect", aspect.ToString().ToLower());
            request.AddParameter("verify_token", verifyToken);
            request.AddParameter("callback_url", config.CallbackUri);

            return client.ExecuteAsync<SubscriptionsResponse>(request);
        }
コード例 #11
0
        static AspectacularTest()
        {
            Aspect.DefaultAspectFactory = () =>
            {
                var defaultAspects = new Aspect[]
                {
                    TestInProcCache.CreateCacheAspect(),
                    new LinqToSqlAspect(),
                    new ReturnValueLoggerAspect(),
                    new SlowFullMethodSignatureAspect(),
                    new SqlConnectionAttributesAspect(),
                    //new SqlCmdExecutionPlanAspect(),
                };

                return defaultAspects;
            };
        }
コード例 #12
0
        public DictionaryFieldsSQLBuilder(List<Aspect.Domain.IUserField> userFields, Aspect.Domain.CommonDomain provider)
            : base(userFields)
        {
            IEnumerable<Aspect.Domain.TreeViewResult> tableList = this.GetDistinctDictionaryTablesTree(userFields, provider);
            foreach (Aspect.Domain.TreeViewResult node in tableList)
            {
                Aspect.Domain.DictionaryTree item = provider.DictionaryTrees.Single(d => d.ID == node.ID);

                if (item.ParentID != null)
                {
                    Join.AppendFormat(propertyJoinTemplate, item.Dictionary.TableName, item.Alias, item.DictionaryTree1.Alias, item.FK, item.PK);
                }
                else
                {
                    Join.AppendFormat(propertyJoinTemplate, item.Dictionary.TableName, item.Alias, Aspect.Model.ProductDomain.ProductProvider.ProductTable, item.FK, item.PK);
                }
            }
        }
コード例 #13
0
        public DictionaryFieldsSQLBuilder(List<IUserField> userFields, Aspect.Domain.CommonDomain provider, Guid topNode)
            : base(userFields)
        {
            IEnumerable<Aspect.Domain.TreeViewResult> tableList = this.GetDistinctDictionaryTablesTree(userFields, provider);

            List<Aspect.Domain.TreeViewResult> childs = provider.GetDictionaryTreeChilds(topNode).ToList();

            foreach (Aspect.Domain.TreeViewResult node in tableList)
            {
                Aspect.Domain.DictionaryTree item = provider.DictionaryTrees.Single(d => d.ID == node.ID);

                if (childs.Contains(node, Aspect.Model.Query.DictionaryTreeEqualityComparer.Instance))
                {
                    if (item.ParentID == null) throw new ArgumentOutOfRangeException(string.Format("DictionaryTreeID {0}", item.ID));
                    Join.AppendFormat(propertyJoinTemplate, item.Dictionary.TableName, item.Alias, item.DictionaryTree1.Alias, item.FK, item.PK);
                }
            }
        }
コード例 #14
0
ファイル: AspectVisitor.cs プロジェクト: sagifogel/NCop
        public Func<IAspectDefinition, IAspectExpressionBuilder> Visit(MethodInterceptionAspectAttribute aspect)
        {
            return aspectDefinition => {
                Func<IAspectExpression, IAspectExpression> ctor = null;
                var _topAspectInScopeDefinition = (IMethodAspectDefinition)topAspectInScopeDefinition;
                var methodAspectDefinition = aspectDefinition as IMethodAspectDefinition;

                if (lastAspect.Top) {
                    ctor = expression => {
                        return new TopMethodInterceptionAspectExpression(expression, methodAspectDefinition);
                    };

                    lastAspect = new Aspect();
                }
                else {
                    if (lastAspect.IsInBinding) {
                        if (lastAspect.IsTopBinding) {
                            lastAspect.IsTopBinding = false;

                            ctor = expression => {
                                return new TopBindingMethodInterceptionAspectExpression(expression, methodAspectDefinition);
                            };
                        }
                        else {
                            ctor = expression => {
                                return new BindingMethodInterceptionAspectExpression(expression, methodAspectDefinition, _topAspectInScopeDefinition);
                            };
                        }
                    }
                    else {
                        ctor = expression => {
                            return new NestedMethodInterceptionAspectExpression(expression, methodAspectDefinition, _topAspectInScopeDefinition);
                        };
                    }
                }

                lastAspect.IsInBinding = true;
                lastAspect.IsTopBinding = true;
                topAspectInScopeDefinition = aspectDefinition;

                return new AspectNodeExpressionBuilder(ctor);
            };
        }
コード例 #15
0
        public void ConstructorParametersTest(TalentType type, Aspect primary, Aspect secondary)
        {
            Talent talent;
            if (secondary == Aspect.None)
                talent = new Talent("Test",
                    type,
                    primary);
            else
            {
                talent = new Talent("Test",
                    type,
                    primary,
                    secondary);
            }

            Assert.Equal("Test", talent.Name);
            Assert.Equal(type, talent.Type);
            Assert.Equal(primary, talent.PrimaryAspect);
            Assert.Equal(secondary, talent.SecondaryAspect);
        }
コード例 #16
0
ファイル: AspectVisitor.cs プロジェクト: sagifogel/NCop
        public Func<IAspectDefinition, IAspectExpressionBuilder> Visit(OnMethodBoundaryAspectAttribute aspect)
        {
            return aspectDefinition => {
                Func<IAspectExpression, IAspectExpression> ctor = null;
                var _topAspectInScopeDefinition = topAspectInScopeDefinition;
                var methodAspectDefinition = aspectDefinition as IMethodAspectDefinition;

                if (lastAspect.Top) {
                    ctor = expression => {
                        return new TopOnMethodBoundaryAspectExpression(expression, methodAspectDefinition);
                    };

                    lastAspect = new Aspect();
                }
                else {
                    if (lastAspect.IsInBinding) {
                        if (lastAspect.IsTopBinding) {
                            lastAspect.IsTopBinding = false;

                            ctor = expression => {
                                return new TopBindingOnMethodBoundaryAspectExpression(expression, methodAspectDefinition);
                            };
                        }
                        else {
                            ctor = expression => {
                                return new BindingOnMethodBoundaryAspectExpression(expression, methodAspectDefinition, _topAspectInScopeDefinition);
                            };
                        }
                    }
                    else {
                        ctor = expression => {
                            return new NestedOnMethodBoundaryAspectExpression(expression, methodAspectDefinition);
                        };
                    }
                }

                topAspectInScopeDefinition = aspectDefinition;

                return new AspectNodeExpressionBuilder(ctor);
            };
        }
コード例 #17
0
 public void SetTalentsOption(TalentTest test, Aspect aspect = Aspect.None)
 {
     this.aspect = aspect;
     talentTest = test;
 }
コード例 #18
0
ファイル: CameraSystem.cs プロジェクト: LutzenH/DProject
 public CameraSystem() : base(Aspect.All(typeof(LensComponent), typeof(FlyCameraComponent)))
 {
 }
コード例 #19
0
        void SetAspect(System.Windows.Controls.Image image)
        {
            Aspect aspect = Element.Aspect;

            image.Stretch = aspect.ToStretch();
        }
コード例 #20
0
ファイル: RainfallSystem.cs プロジェクト: Ramos04/CIS580
 public RainfallSystem()
     : base(Aspect.All(typeof(Transform2), typeof(Raindrop)))
 {
 }
コード例 #21
0
 public PlayerInputSystem() : base(Aspect.All(typeof(PlayerInputComponent)))
 {
     _commandManager = EntitySystem.BlackBoard.GetEntry <ICommandManager>("CommandManager");
 }
コード例 #22
0
 public TextBoxProductGridField(Aspect.Domain.EditableGridColumn gridColumn)
     : base(gridColumn)
 {
 }
コード例 #23
0
ファイル: AspectVisitor.cs プロジェクト: sagifogel/NCop
        public Func<IAspectDefinition, IAspectExpressionBuilder> Visit(SetPropertyFragmentInterceptionAspect aspect)
        {
            return aspectDefinition => {
                Func<IAspectExpression, IAspectExpression> ctor = null;
                var propertyAspectDefinition = (IFullPropertyAspectDefinition)aspectDefinition;

                if (lastAspect.Top) {
                    ctor = expression => {
                        var propertyBuilder = propertyAspectDefinition.PropertyBuilder;

                        propertyBuilder.SetSetExpression(expression);

                        return new TopSetPropertyFragmentInterceptionAspectExpression(expression, propertyAspectDefinition, propertyBuilder);
                    };

                    lastAspect = new Aspect();
                }
                else {
                    if (lastAspect.IsInBinding) {
                        ctor = expression => {
                            var propertyBuilder = propertyAspectDefinition.PropertyBuilder;

                            propertyBuilder.SetSetExpression(expression);

                            return new BindingSetPropertyFragmentInterceptionAspectExpression(expression, propertyAspectDefinition, propertyBuilder);
                        };
                    }
                }

                lastAspect.IsInBinding = true;
                topAspectInScopeDefinition = aspectDefinition;

                return new AspectNodeExpressionBuilder(ctor);
            };
        }
コード例 #24
0
 public EnchantmentSystem()
     : base(Aspect.All(typeof(Enchantment)))
 {
 }
コード例 #25
0
 public FightSystem() : base(Aspect.All(typeof(Move), typeof(Player)))
 {
 }
コード例 #26
0
        private List <SyncResultObject> GetFilesAndSync(Content cntToSync, string filePath)
        {
            var result = new List <SyncResultObject>();

            DirectoryInfo         dirInfo  = new DirectoryInfo(filePath);
            IEnumerable <Content> children = cntToSync.Children.Where(c => c.TypeIs("File"));
            //Content lastContent = children.OrderByDescending(c => c.CreationDate).FirstOrDefault();
            //DateTime lastContentDate = (lastContent != null) ? lastContent.CreationDate : DateTime.MinValue;
            //technical debt: I think creationdate won't be good here, we should probably use last syncdate

            var fileInfos = dirInfo.GetFiles();

            //if (fileInfos.Length == 0)
            //    result.Add(new SyncResultObject(filePath, SyncResult.NoSyncToDo));
            //else
            if (fileInfos.Length > 0)
            {
                foreach (var file in fileInfos)
                {
                    var    fileSynced = false;
                    string fileName   = file.Name;
                    try
                    {
                        using (Stream fileStream = file.Open(FileMode.Open, FileAccess.Read)) //Open the file ReadOnly mode
                        {
                            fileName = ContentNamingHelper.GetNameFromDisplayName(file.Name);

                            using (new SystemAccount())
                            {//Technical Debt: as for now we do not check if file needs to be updated or not
                                Content fileContent = cntToSync.Children.Where(c => c.Name == fileName).FirstOrDefault();
                                if (fileContent == null)
                                {
                                    // create new
                                    SenseNet.ContentRepository.File newFile = new SenseNet.ContentRepository.File(cntToSync.ContentHandler);
                                    newFile.Name        = ContentNamingHelper.GetNameFromDisplayName(file.Name);
                                    newFile.DisplayName = file.Name;
                                    newFile.Save();
                                    fileContent = Content.Load(newFile.Id);
                                    var fileSyncAspect = Aspect.LoadAspectByPathOrName(ASPECTNAME);
                                    fileContent.Save(); // ez miert? elo is kell menteni?
                                    fileContent.AddAspects(fileSyncAspect);
                                }

                                SaveAsTechnicalUser(fileContent, fileStream);
                                result.Add(new SyncResultObject(fileContent.Path, SyncResult.SyncSuccess));
                            }
                            fileSynced = true;
                        }
                    }
                    catch (Exception ex)
                    {
                        SnLog.WriteException(ex);
                        result.Add(new SyncResultObject(string.Concat(cntToSync.Path, "/", fileName), SyncResult.SyncFailed));
                    }

                    // result add would be better at here

                    // delete file
                    try
                    {
                        if (fileSynced)
                        {
                            //Logger.WriteInformation(40002, "FILESYNC delete 545 " + file.Name);
                            file.Delete();
                        }
                        // should we log deletion?
                    }
                    catch (Exception ex)
                    {
                        SnLog.WriteException(ex);
                    }
                }
            }

            //// save refresh date on parent
            //SaveAsTechnicalUser(cntToSync, null, true);

            return(result);
        }
コード例 #27
0
 public MonoSystem()
     : base(Aspect.All(typeof(MonoA), typeof(MonoB), typeof(MonoX)))
 {
 }
コード例 #28
0
 public ArmyAiSystem() : base(Aspect.All(typeof(Army), typeof(GeoEntity), typeof(ArmyAi)))
 {
 }
コード例 #29
0
        public void Aspects_Can_Be_Installed()
        {
            using (var store = GetDocumentStore(_options))
            {
                // currency
                var currency = new[]
                {
                    new Currency {
                        Name = "Money"
                    },
                    new Currency {
                        Name = "Points"
                    },
                };

                // assert
                using (var session = store.OpenSession())
                {
                    // ensure optimistic concurrency
                    session.Advanced.UseOptimisticConcurrency = true;

                    // try to insert the apertures into the database
                    session.Store(currency[0], "currencies/1");
                    session.Store(currency[1], "currencies/2");

                    session.SaveChanges();
                }

                // arrange
                var aspects = new[]
                {
                    new Aspect {
                        Name = "Strength", Kind = Kind.Attribute, Category = Category.Physical
                    },
                    new Aspect {
                        Name = "Stamina", Kind = Kind.Attribute, Category = Category.Physical
                    },
                };

                // assert
                using (var session = store.OpenSession())
                {
                    // ensure optimistic concurrency
                    session.Advanced.UseOptimisticConcurrency = true;

                    // try to insert the aspects into the database
                    session.Store(aspects[0], "aspects/1");
                    session.Store(aspects[1], "aspects/2");

                    session.SaveChanges();

                    // try to query each of the newly inserted aspects.
                    var query = session.Query <Aspect>().ToList();

                    // unit test each aspect.
                    foreach (var aspect in query)
                    {
                        Assert.NotNull(aspect.Id);
                        Assert.NotNull(aspect.Name);
                        Assert.NotNull(aspect.Kind);
                        Assert.NotNull(aspect.Category);
                    }
                }

                // update
                using (var session = store.OpenSession())
                {
                    // ensure optimistic concurrency
                    session.Advanced.UseOptimisticConcurrency = true;

                    // create an array to hold the results.
                    var results = new Aspect[2];

                    // try to query each of the newly inserted aspects.
                    results[0] = session.Load <Aspect>("aspects/1");
                    results[1] = session.Load <Aspect>("aspects/2");

                    // load the flexskill points currency.
                    var points = session.Load <Currency>("currencies/2");

                    results[0].Path = new Path
                    {
                        Steps = new List <Step>
                        {
                            new Step
                            {
                                Cost         = 5,
                                Number       = 1,
                                Currency     = points.Id,
                                Requirements = new List <Requirement>
                                {
                                    new Requirement
                                    {
                                        What  = results[1].Id,
                                        Value = 2
                                    },
                                    new Requirement
                                    {
                                        What  = points.Id,
                                        Value = 5
                                    }
                                }
                            }
                        }
                    };

                    session.SaveChanges();
                }


                // assert
                using (var session = store.OpenSession())
                {
                    // ensure optimistic concurrency
                    session.Advanced.UseOptimisticConcurrency = true;

                    // create an array to hold the results.
                    // try to query each of the newly inserted aspects.
                    var results = session.Include("Path.Steps,Requirements,What").Load <Aspect>("aspects/1");
                    //var results = session.Include<Aspect>(aspect => aspect.Path.Steps[0].Requirements[0].What).Load<Aspect>("aspects/1");


                    // the first requirement should be an aspect
                    var requirements = new Entity[2];

                    requirements[0] = session.Load <Aspect>(results.Path.Steps[0].Requirements[0].What);
                    requirements[1] = session.Load <Currency>(results.Path.Steps[0].Requirements[1].What);

                    Assert.IsType <Aspect>(requirements[0]);
                    Assert.IsType <Currency>(requirements[1]);

                    //Assert.Equal(1, session.Advanced.NumberOfRequests);

                    session.SaveChanges();
                }
            }
        }
コード例 #30
0
        public int GetAspectValue(Aspect aspect,bool rawValue=false)
        {
            int n = 0;
            int value = 10;
            for (int i = 0; i <= 10; i++)
            {
                n += i * 10;
                if (_aspectPoint[aspect] >= n && _aspectPoint[aspect] < (i + 1) * 10 + n)
                {
                    value = i + _bonusAspect[aspect];
                }
            }
            if (aspect == Aspect.Equilibre)
            {
                int level = GetLevel();
                int count = _talents.Values.Count(talent => talent.Type == TalentType.General && talent.Level > 0);
                int aspects = new[] {Aspect.Eau, Aspect.Feu, Aspect.Vent, Aspect.Terre, Aspect.Acier, Aspect.Arcane}
                    .Where(a => _talents.Values
                        .Where(talent => talent.Type == TalentType.General && talent.PrimaryAspect == a)
                        .Sum(talent => talent.XPCost) >= 5*level)
                    .Count();

                value += count/(10 - aspects);
            }
            if (rawValue == false)
            {
                if (inventory.Ring1 != null)
                {
                    Trinket ring = inventory.Ring1;
                    if (ring.Quality > 0)
                    {
                        if (ring.Material.HaveBonusOn(aspect, ring.Quality))
                            value++;
                    }
                }
                if (inventory.Ring2 != null)
                {
                    Trinket ring = inventory.Ring2;
                    if (ring.Quality > 0)
                    {
                        if (ring.Material.HaveBonusOn(aspect, ring.Quality))
                            value++;
                    }
                }
            }
            return value;
        }
コード例 #31
0
ファイル: EntitySystem.cs プロジェクト: coryleeio/SPShared
 /// <summary>Initializes a new instance of the <see cref="EntitySystem" /> class.</summary>
 protected EntitySystem()
 {
     this.Bit = 0;
     this.aspect = Aspect.Empty();
     this.IsEnabled = true;
 }
コード例 #32
0
ファイル: AISystem.cs プロジェクト: Engensmax/Warlocked
 public AISystem()
     : base(Aspect.One(typeof(AI), typeof(Input)))
 {
 }
コード例 #33
0
ファイル: AspectVisitor.cs プロジェクト: sagifogel/NCop
        public Func<IAspectDefinition, IAspectExpressionBuilder> Visit(RaiseEventFragmentInterceptionAspect aspect)
        {
            return aspectDefinition => {
                Func<IAspectExpression, IAspectExpression> ctor = null;
                var eventAspectDefinition = (IFullEventAspectDefinition)aspectDefinition;

                if (lastAspect.Top) {
                    ctor = expression => {
                        var eventBuilder = eventAspectDefinition.EventBuilder;

                        eventBuilder.SetInvokeExpression(expression);

                        return new TopRaiseEventFragmentInterceptionAspectExpression(expression, eventAspectDefinition, eventBuilder);
                    };

                    lastAspect = new Aspect();
                }
                else {
                    if (lastAspect.IsInBinding) {
                        ctor = expression => {
                            var eventBuilder = eventAspectDefinition.EventBuilder;

                            eventBuilder.SetInvokeExpression(expression);

                            return new BindingRaiseEventFragmentInterceptionAspectExpression(expression, eventAspectDefinition, eventBuilder);
                        };
                    }
                }

                lastAspect.IsInBinding = true;
                topAspectInScopeDefinition = aspectDefinition;

                return new AspectNodeExpressionBuilder(ctor);
            };
        }
コード例 #34
0
ファイル: OverstepSystem.cs プロジェクト: Engensmax/Warlocked
 public OverstepSystem()
     : base(Aspect.One(typeof(Input)))
 {
 }
コード例 #35
0
 public IntervalProcessingSystem(Aspect aspect)
     : this(aspect, TimeSpan.FromSeconds(0.5))
 {
 }
コード例 #36
0
 public PlayerMovementSystem(Keybinds keybinds) : base(Aspect.All(typeof(Player), typeof(FreePosition), typeof(Velocity)))
 {
     _keybinds = keybinds;
 }
コード例 #37
0
 public LifeTimeReductionSystem() : base(Aspect.One(typeof(LifeTimeComponent)))
 {
 }
コード例 #38
0
 public HighlightedTileSystem(IEditorInputManager input)
     : base(Aspect.All(typeof(RenderableRectangle)))
 {
     _input = input;
 }
コード例 #39
0
ファイル: ExpressionBuilder.cs プロジェクト: kimduquan/DMIS
        internal Expression BuildMemberPath(List <string> steps)
        {
            Type type;
            int  k;

            if (steps[0].Contains('.'))
            {
                type = TypeHandler.GetType(steps[0]);
                if (type == null)
                {
                    throw ODataParser.SyntaxError(this.Parser.Lexer, "Unknown type: " + steps[0]);
                }
                k = 1;
            }
            else
            {
                if (steps.Count == 1 && steps[0] == "ContentType")
                {
                    steps.Add("Name");
                }
                type = typeof(ContentRepository.Content);
                k    = 0;
            }

            Expression expression     = this.x; // Expression.Parameter(type, "x");
            Expression lastExpr       = null;
            Expression lastLastExpr   = null;
            string     lastAspectName = null;

            for (var i = k; i < steps.Count; i++)
            {
                lastLastExpr = lastExpr;
                lastExpr     = expression;

                if (lastAspectName == null)
                {
                    var member = type.GetProperty(steps[i]);
                    expression = member == null?GetDynamicMember(type, steps[i]) : Expression.MakeMemberAccess(member.GetGetMethod().IsStatic ? null : expression, member);

                    if (expression == null)
                    {
                        lastAspectName = steps[i];
                    }
                }
                else
                {
                    var aspect       = Aspect.LoadAspectByName(lastAspectName);
                    var fieldSetting = aspect.FieldSettings.Where(f => f.Name == steps[i]).FirstOrDefault();
                    if (fieldSetting == null)
                    {
                        throw new InvalidOperationException("Field not found: " + lastAspectName + "." + steps[i]);
                    }

                    var fieldName = lastAspectName + "." + steps[i];
                    var fieldType = fieldSetting.FieldDataType;

                    expression     = CreateFieldOfContentAccessExpression(lastLastExpr, fieldName, fieldType);
                    lastAspectName = null;
                }
                type = expression == null ? null : expression.Type;
            }

            if (expression == null)
            {
                throw new InvalidOperationException("Field not found: " + lastAspectName);
            }

            return(expression);
        }
コード例 #40
0
 public StatDisplaySystem()
     : base(Aspect.All(typeof(StatsDisplay)))
 {
 }
コード例 #41
0
ファイル: GoodsService.cs プロジェクト: maintell/MsWeb
        public async Task <ReturnResult <bool> > SaveGoodsInfo(GoodsModel goodsInfo)
        {
            LogUtil.WebLog("进入SaveGoodsInfo");
            return(await Aspect.Task(async() =>
            {
                ReturnResult <bool> result = new ReturnResult <bool>();
                //新增
                if (string.IsNullOrEmpty(goodsInfo.ID))
                {
                    goodsInfo.ID = Guid.NewGuid().ToString();
                    try
                    {
                        goodsInfo.image = ImageUtil.StrToUri(goodsInfo.image, goodsInfo.ID + ".jpg");
                        goodsInfo.buyimage = ImageUtil.StrToUri(goodsInfo.buyimage, goodsInfo.ID + "_buy.jpg");
                    }
                    catch (Exception exp)
                    {
                        LogUtil.WebError(exp);
                        //可以增加默认图片的加载
                    }

                    goodsInfo.recommendtime = DateTime.Now;
                    if (goodsInfo.state == 2)
                    {
                        goodsInfo.audittime = DateTime.Now;
                    }
                    result.data = await this.Add(goodsInfo);
                    if (result.data)
                    {
                        result.code = 1;
                    }
                    else
                    {
                        result.code = -106;
                        result.message = "商品信息新增失败!";
                    }
                    return result;
                }
                //修改
                else
                {
                    //修改的商品,可能已经是地址模式化
                    if (goodsInfo.image != null && !goodsInfo.image.Contains(".jpg"))
                    {
                        goodsInfo.image = ImageUtil.StrToUri(goodsInfo.image, goodsInfo.ID + ".jpg");
                    }
                    if (goodsInfo.buyimage != null && !goodsInfo.buyimage.Contains("_buy.jpg"))
                    {
                        goodsInfo.buyimage = ImageUtil.StrToUri(goodsInfo.buyimage, goodsInfo.ID + "_buy.jpg");
                    }
                    result.data = await this.Update(goodsInfo);
                    if (result.data)
                    {
                        result.code = 1;
                    }
                    else
                    {
                        result.code = -103;
                        result.message = "商品信息更新失败!";
                    }
                    return result;
                }
            })
                   .WithLog("保存商品信息.")
                   .Execute());
        }
コード例 #42
0
 /// <summary>Initializes a new instance of the <see cref="TestEntityProcessingSystem1" /> class.</summary>
 public TestEntityProcessingSystem1()
     : base(Aspect.All(typeof(TestHealthComponent)))
 {
 }
コード例 #43
0
 /// <summary>Initializes a new instance of the <see cref="IntervalEntityProcessingSystem" /> class.</summary>
 /// <param name="timeSpan">The time span.</param>
 /// <param name="aspect">The aspect.</param>
 protected IntervalEntityProcessingSystem(TimeSpan timeSpan, Aspect aspect)
     : base(timeSpan, aspect)
 {
 }
コード例 #44
0
 public ShipBulletMovementSystem() : base(Aspect.All(typeof(Transform2), typeof(ShipBullet)))
 {
 }
コード例 #45
0
 public int GetAspectPoint(Aspect aspect)
 {
     return _aspectPoint[aspect];
 }
コード例 #46
0
 public ManaRegenSystem()
     : base(Aspect.All(typeof(Mana)))
 {
     this.manaTimer = new Timer(new TimeSpan(250));
 }
コード例 #47
0
        public void SetBonusMalus(Aspect bonus, Aspect malus, Aspect bonus2, Aspect malus2)
        {
            _aspectBonus.Clear();
            _aspectMalus.Clear();

            _aspectBonus.Add(bonus);
            _aspectMalus.Add(malus);

            _aspectBonus.Add(bonus2);
            _aspectMalus.Add(malus2);
            RecomputePA();
        }
コード例 #48
0
 /// <summary>Initializes a new instance of the <see cref="IntervalEntitySystem"/> class.</summary>
 /// <param name="timeSpan">The time span.</param>
 /// <param name="aspect">The aspect.</param>
 protected IntervalEntitySystem(TimeSpan timeSpan, Aspect aspect)
     : base(aspect)
 {
     this.timer = new Timer(timeSpan);
 }
コード例 #49
0
ファイル: AspectVisitor.cs プロジェクト: sagifogel/NCop
        public Func<IAspectDefinition, IAspectExpressionBuilder> Visit(GetPropertyInterceptionAspect aspect)
        {
            return aspectDefinition => {
                Func<IAspectExpression, IAspectExpression> ctor = null;
                var propertyAspectDefinition = aspectDefinition as IPropertyAspectDefinition;

                if (lastAspect.Top) {
                    ctor = expression => {
                        return new TopGetPropertyInterceptionAspectExpression(expression, propertyAspectDefinition);
                    };

                    lastAspect = new Aspect();
                }
                else {
                    if (lastAspect.IsInBinding) {
                        ctor = expression => {
                            return new BindingGetPropertyInterceptionAspectExpression(expression, propertyAspectDefinition);
                        };
                    }
                }

                lastAspect.IsInBinding = true;
                topAspectInScopeDefinition = aspectDefinition;

                return new AspectNodeExpressionBuilder(ctor);
            };
        }
コード例 #50
0
        /// <summary>
        /// Returns true if VideoCard instances are equal
        /// </summary>
        /// <param name="other">Instance of VideoCard to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(VideoCard other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Aspect == other.Aspect ||
                     Aspect != null &&
                     Aspect.Equals(other.Aspect)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Subtitle == other.Subtitle ||
                     Subtitle != null &&
                     Subtitle.Equals(other.Subtitle)
                 ) &&
                 (
                     Text == other.Text ||
                     Text != null &&
                     Text.Equals(other.Text)
                 ) &&
                 (
                     Image == other.Image ||
                     Image != null &&
                     Image.Equals(other.Image)
                 ) &&
                 (
                     Media == other.Media ||
                     Media != null &&
                     Media.SequenceEqual(other.Media)
                 ) &&
                 (
                     Buttons == other.Buttons ||
                     Buttons != null &&
                     Buttons.SequenceEqual(other.Buttons)
                 ) &&
                 (
                     Shareable == other.Shareable ||
                     Shareable != null &&
                     Shareable.Equals(other.Shareable)
                 ) &&
                 (
                     Autoloop == other.Autoloop ||
                     Autoloop != null &&
                     Autoloop.Equals(other.Autoloop)
                 ) &&
                 (
                     Autostart == other.Autostart ||
                     Autostart != null &&
                     Autostart.Equals(other.Autostart)
                 ));
        }
コード例 #51
0
ファイル: TurnSystem.cs プロジェクト: human-ramen/human-ramen
 public TurnSystem(Commander commander) : base(Aspect.One(typeof(TurnComponent)))
 {
     _commander = commander;
 }
コード例 #52
0
ファイル: WaterRenderSystem.cs プロジェクト: LutzenH/DProject
        public WaterRenderSystem(GraphicsDevice graphicsDevice) : base(Aspect.All(typeof(TransformComponent), typeof(WaterPlaneComponent)))
        {
            _graphicsDevice = graphicsDevice;

            _vertexBuffer = new VertexBuffer(_graphicsDevice, typeof(VertexPositionTextureColorNormal), 6, BufferUsage.WriteOnly);
        }
コード例 #53
0
 public AnimationSystem()
     : base(Aspect.All(typeof(AnimationComponent), typeof(SpriteComponent)))
 {
 }
コード例 #54
0
        public static Advice GetAdvice(MethodInfo method = null, AdviceExecution execution = (AdviceExecution)0, Aspect aspect = null, ICrosscutting crosscutting = null)
        {
            method       = method ?? GetMethodInfo(returnType: typeof(void), parameterTypes: Type.EmptyTypes);
            crosscutting = crosscutting ?? GetCrosscutting();
            aspect       = aspect ?? GetAspect();

            return(new Advice(aspect, method, execution, crosscutting));
        }
コード例 #55
0
 protected EntityProcessingRenderer(EntityWorld entityWorld, Aspect aspect)
     : base(entityWorld, aspect)
 {
 }
コード例 #56
0
 public ClassSortNode(ClassSort sort)
 {
     this._Term   = sort;
     this._Aspect = sort.Aspect;
 }
コード例 #57
0
 public IntervalProcessingSystem(Aspect aspect, TimeSpan interval) 
     : base(aspect)
 {
     this.Interval = interval;
 }
コード例 #58
0
 public ClassSortNode(Aspect aspect, int ordinal, EixoX.Data.SortDirection direction)
     : this(new ClassSortTerm(aspect, ordinal, direction))
 {
 }
コード例 #59
0
ファイル: EntitySystem.cs プロジェクト: hagish/artemis_CSharp
 /// <summary>Initializes a new instance of the <see cref="EntitySystem"/> class.</summary>
 /// <param name="aspect">The aspect.</param>
 protected EntitySystem(Aspect aspect)
     : this()
 {
     Debug.Assert(aspect != null, "Aspect must not be null.");
     this.Aspect = aspect;
 }
コード例 #60
0
 public HandTargetSystem()
     : base(Aspect.All(typeof(HandComponent), typeof(PositionComponent)))
 {
 }