private void handleDynamicObjects(IDynamicObject dynamicObject) { addInterface <IGameStart>(dynamicObject); addInterface <IGamePause>(dynamicObject); addInterface <IGameRestart>(dynamicObject); addInterface <IGameResume>(dynamicObject); }
public override void Store(IDynamicObject storage, IResourceWrapper wrapper) { storage.Set("botEngine", BotEngine.ToString()); storage.Set("botKey", BotKey); storage.Set("masterProcessId", MasterProcessId); storage.Set("chatProcessIdentity", ChatProcessIdentity); }
public void HandleDynamicCollision(string collisionDirection, IDynamicObject dynamicObjectState) { if (Mario.Instance.PlayableObjectState.ToString() != "SuperMario.MarioStates.DeadMario") { PlayableObjectStateTransitionMachine.DynamicStateChange(collisionDirection, PlayableObjectState.ToString(), dynamicObjectState); } }
private void MainForm_Load(object sender, System.EventArgs e) { init(); // 运动路径定位点 point = new GeometryFactory().CreatePoint(gviVertexAttribute.gviVertexAttributeZ); //point.SpatialCRS = new CRSFactory().CreateFromWKT(wkt) as ISpatialCRS; // 加载运动路径 dynamicObject = this.axRenderControl1.ObjectManager.CreateDynamicObject(rootId); //dynamicObject.CrsWKT = wkt; // 画出运动路径 line = new GeometryFactory().CreateGeometry(gviGeometryType.gviGeometryPolyline, gviVertexAttribute.gviVertexAttributeZ) as IPolyline; //line.SpatialCRS = new CRSFactory().CreateFromWKT(wkt) as ISpatialCRS; LoadDynamicObjectAndLineFromFile(); LoadSkinMeshAndViewshed(); this.cbFlyMode.SelectedIndex = 0; // 获取设置参数 cbAutoRepeat.Checked = dynamicObject.AutoRepeat; numTurnSpeed.Value = (decimal)dynamicObject.TurnSpeed; comboxMotionStyle.SelectedIndex = getIndexFromEnum(dynamicObject.MotionStyle); numAspectRatio.Value = (decimal)tv.AspectRatio; numFarClip.Value = (decimal)tv.FarClip; numFieldOfView.Value = (decimal)tv.FieldOfView; { this.helpProvider1.SetShowHelp(this.axRenderControl1, true); this.helpProvider1.SetHelpString(this.axRenderControl1, ""); this.helpProvider1.HelpNamespace = "DynamicViewshed.html"; } }
private void DynamicObjectAction(IDynamicObject obj) { // get the AutoResetEvent associated with the object id ares.TryGetValue(obj.Id, out AutoResetEvent are); // put the task to sleep until the main thread calls the Set() method. are.WaitOne(); //As long as the object is alive while (obj.State != State.Dead) { obj.Action(); //at the end of the action go to sleep obj.CalculateSleep(); // if the object is not sleeping // at the end of the day we inceremnt the number of finished tasks of the day. Interlocked.Increment(ref finishedTasksOfTheDay); // we call Set() with the AutoResetEvent variable associated with the main thread mainThreadARE.Set(); // we are withing for the main thread to call Set() at the next day. are.WaitOne(); } // after the object died we remove the key-value pair associated with it Interlocked.Increment(ref finishedTasksOfTheDay); mainThreadARE.Set(); ares.TryRemove(obj.Id, out _); }
public override void Fight(IDynamicObject other) { // a local Action for the winner and the loser void act(IDynamicObject winner, IDynamicObject loser) { // add 2 to the strength of the winner winner.AddStrength(2); // the loser is now depressed loser.SetState(State.Depressed); ProducerConsumer.Produce(String.Format("Object number {0} won agains object number {1}", winner.Id, loser.Id)); } /// the winner of the fight is the object with more strength. if the strengths of objects are the same /// than there is no winner if (Strength > other.Strength || other.DeBuff == DeBuff.Cocoon) { act(this, other); } else if (other.Strength > Strength) { act(other, this); } }
public bool TryImportScriptFromFile(FileEntry scriptPath, IDynamicObject scriptObject, ScriptFlags flags, out object result, TemplateContext context = null) { if (scriptPath == null) { throw new ArgumentNullException(nameof(scriptPath)); } if (scriptObject == null) { throw new ArgumentNullException(nameof(scriptObject)); } result = null; var scriptExist = scriptPath.Exists; if ((flags & ScriptFlags.Expect) != 0) { if (!scriptExist) { Site.Error($"Config file [{scriptPath}] does not exist"); return(false); } } if (scriptExist) { var configAsText = scriptPath.ReadAllText(); return(TryImportScript(configAsText, scriptPath.Path, scriptObject, flags, out result, context)); } return(true); }
public override void Store(IDynamicObject storage, IResourceWrapper wrapper) { storage.Set("chatId", CorrelationId.Value); storage.Set("bookmarkId", BookmarkId); storage.Set("botEngine", BotEngine.ToString()); storage.Set("botKey", BotKey); }
private void LoadPeople(IDynamicObject dynamicObject) { if (skinMesh == null) { // 构造ModelPoint mp = geoFac.CreateGeometry(gviGeometryType.gviGeometryModelPoint, gviVertexAttribute.gviVertexAttributeZ) as IModelPoint; string modelName = (strMediaPath + @"\x\Character\QiYeYuanGong.X"); mp.ModelName = modelName; mp.SpatialCRS = dataset_Road.SpatialReference; // 设置位置 IMatrix matrix = new Matrix(); matrix.MakeIdentity(); IPoint startPoint = null; double speed = 0.0; dynamicObject.GetWaypoint2(0, out startPoint, out speed); matrix.SetTranslate(startPoint.Position); mp.FromMatrix(matrix); mp.SelfScale(5, 5, 5); // 创建骨骼动画 skinMesh = this.axRenderControl1.ObjectManager.CreateSkinnedMesh(mp, rootId); if (skinMesh == null) { MessageBox.Show("骨骼动画创建失败!"); return; } skinMesh.Loop = true; skinMesh.Play(); skinMesh.MaxVisibleDistance = 10000; skinMesh.ViewingDistance = 100; // 绑定到运动路径 IMotionable m = skinMesh as IMotionable; pos.Set(0, 0, 0); m.Bind2(dynamicObject, pos, 0, 0, 0); } }
/// <summary> /// Creates a new instance of <see cref="SqlParameter"/> and initializes its properties. /// </summary> /// <param name="source"> /// The source object. /// </param> /// <returns> /// The <see cref="SqlParameter"/>. /// </returns> public SqlParameter CreateParameter(IDynamicObject source) { if (source == null) throw new ArgumentNullException("source"); int? stateId; var infoClass = source as IInfoClass; if (infoClass != null) { var property = infoClass.GetPropertyByName(Constants.CurrentStateIdColumnName); if (property == null) throw new ArgumentException(@"Info class is not supported.", "source"); stateId = (int?)infoClass.GetValueByPropertyName(property.Name); if (stateId == 0) stateId = null; } else { stateId = (int?)source.GetValueByPropertyName(Constants.CurrentStateColumnName); } return new SqlParameter(ParameterName, SqlDbType.Int) { Value = (object)stateId ?? DBNull.Value }; }
private void TryCreateObject() { // get a random position on the board int x, y; switch (randomOption) { case RandomOption.RealTime: x = MyRandom.Next(0, info.Length); y = MyRandom.Next(0, info.Hight); break; default: x = rnd.Next(0, info.Length); y = rnd.Next(0, info.Hight); break; } //try to create an object at position (x,y) IDynamicObject obj = board.TryCreate(x, y); if (obj != null) { /// if an object was created, add a new enrty in the dictinory and create /// a new task for the dynamic object AutoResetEvent are = new AutoResetEvent(false); ares.TryAdd(obj.Id, are); Task.Factory.StartNew(() => DynamicObjectAction(obj), TaskCreationOptions.LongRunning); are.Set(); } }
private void LoadCar(IDynamicObject dynamicObject) { if (renderModelPoint == null) { // 构造ModelPoint mp = geoFac.CreateGeometry(gviGeometryType.gviGeometryModelPoint, gviVertexAttribute.gviVertexAttributeZ) as IModelPoint; string modelName = (strMediaPath + @"\osg\Vehicles\Car\TCJ006.osg"); mp.ModelName = modelName; mp.SpatialCRS = dataset_Road.SpatialReference; // 设置位置 IMatrix matrix = new Matrix(); matrix.MakeIdentity(); IPoint startPoint = null; double speed = 0.0; dynamicObject.GetWaypoint2(0, out startPoint, out speed); matrix.SetTranslate(startPoint.Position); mp.FromMatrix(matrix); mp.SelfScale(0.05, 0.05, 0.05); // 创建骨骼动画 renderModelPoint = this.axRenderControl1.ObjectManager.CreateRenderModelPoint(mp, null, rootId); renderModelPoint.MaxVisibleDistance = 10000; renderModelPoint.ViewingDistance = 200; // 绑定到运动路径 IMotionable m = renderModelPoint as IMotionable; pos.Set(0, 0, 0); m.Bind2(dynamicObject, pos, 90, 0, 0); } }
public override void Restore(IDynamicObject store, IResourceWrapper wrapper) { IsWaiting = store.Get <Boolean>("isWaiting"); BookmarkId = store.Get <Guid>("bookmarkId"); BotEngine = store.Get <BotEngine>("botEngine"); BotKey = store.Get <String>("botKey"); }
private void axRenderControl1_Load(object sender, EventArgs e) { init(); // 运动路径定位点 point = new GeometryFactory().CreatePoint(gviVertexAttribute.gviVertexAttributeZ); //point.SpatialCRS = new CRSFactory().CreateFromWKT(wkt) as ISpatialCRS; // 加载运动路径 dynamicObject = this.axRenderControl1.ObjectManager.CreateDynamicObject(rootId); //dynamicObject.CrsWKT = wkt; // 画出运动路径 line = new GeometryFactory().CreateGeometry(gviGeometryType.gviGeometryPolyline, gviVertexAttribute.gviVertexAttributeZ) as IPolyline; //line.SpatialCRS = new CRSFactory().CreateFromWKT(wkt) as ISpatialCRS; LoadDynamicObjectAndLineFromFile(); LoadPlane(); LoadTableLabel(); this.axRenderControl1.Camera.FlyToObject(this.skinMeshPlane.Guid, gviActionCode.gviActionFollowCockpit); this.cbFlyMode.SelectedIndex = 6; // 获取设置参数 cbAutoRepeat.Checked = dynamicObject.AutoRepeat; numTurnSpeed.Value = (decimal)dynamicObject.TurnSpeed; comboxMotionStyle.SelectedIndex = getIndexFromEnum(dynamicObject.MotionStyle); { this.helpProvider1.SetShowHelp(this.axRenderControl1, true); this.helpProvider1.SetHelpString(this.axRenderControl1, ""); this.helpProvider1.HelpNamespace = "DynamicObject.html"; } }
/// <summary> /// Creates a new instance of <see cref="SqlParameter"/> and initializes its properties. /// </summary> /// <param name="source"> /// The source object. /// </param> /// <returns> /// The <see cref="SqlParameter"/>. /// </returns> public SqlParameter CreateParameter(IDynamicObject source) { if (source == null) throw new ArgumentNullException("source"); int? itemId; var infoClass = source as IInfoClass; if (infoClass != null) { var property = infoClass.GetPropertyByName(_fieldName + "Id"); if (property == null) throw new ArgumentException(@"Info class is not supported.", "source"); itemId = (int?)infoClass.GetValueByPropertyName(property.Name); if (itemId == 0) itemId = null; } else { itemId = (int?)source.GetValueByPropertyName(_fieldName); } return new SqlParameter(_parameterName, SqlDbType.Int) { Value = (object)itemId ?? DBNull.Value }; }
public StandardRule <T> GetRule <T>(CodeContext callerContext, DynamicAction action, object[] args) { Contract.RequiresNotNull(action, "action"); //Debug.Assert(action.Kind != ActionKind.GetMember || ((GetMemberAction)action).Name != SymbolTable.StringToId("x")); StandardRule <T> rule = _ruleCache.FindRule <T>(callerContext, action, args); if (rule != null) { return(rule); } NoteRuleCreation(action, args); IDynamicObject ndo = args[0] as IDynamicObject; if (ndo != null) { rule = ndo.GetRule <T>(action, callerContext, args); Debug.Assert(rule == null || rule.Target != null && rule.Test != null); } rule = rule ?? MakeRule <T>(callerContext, action, args); Debug.Assert(rule != null && rule.Target != null && rule.Test != null); #if DEBUG AstWriter.Dump(rule); #endif return(rule); }
/// <summary> /// Create a new dynamic object of given type. /// </summary> /// <typeparam name="T">The type of dynamic object to return.</typeparam> /// <param name="entity">An instance of the class that extends DynamicObject.</param> /// <param name="model">The model of the object in string format.</param> /// <param name="rotation">The rotation to spawn the object at(degrees).</param> /// <param name="isDynamic">(Optional): Set object dynamic or not.</param> /// <param name="frozen">(Optional): Set object frozen.</param> /// <param name="lodDistance">(Optional): Set LOD distance.</param> /// <param name="lightColor">(Optional): set light color.</param> /// <param name="onFire">(Optional): set object on fire(DOESN'T WORK PROPERLY YET!)</param> /// <param name="textureVariation">(Optional): Set object texture variation.</param> /// <param name="visible">(Optional): Set object visibility.</param> /// <returns>Newly created dynamic object of given type.</returns> public static T CreateDynamicObject <T>( IDynamicObject entity, string model, Vector3 rotation, bool?isDynamic = null, bool?frozen = null, uint?lodDistance = null, Rgb lightColor = null, bool?onFire = null, TextureVariation?textureVariation = null, bool?visible = null ) { return(CreateDynamicObject <T>(entity, Alt.Hash(model), rotation, isDynamic, frozen, lodDistance, lightColor, onFire, textureVariation, visible)); }
public override void Store(IDynamicObject storage, IResourceWrapper wrapper) { storage.Set("chatId", CorrelationId.Value); storage.Set("botEngine", BotEngine.ToString()); storage.Set("botKey", BotKey); storage.Set("message", DynamicObjectConverters.From(Message)); }
/// <summary> /// Creates a delegate with a given signature that could be used to invoke this object from non-dynamic code (w/o code context). /// A stub is created that makes appropriate conversions/boxing and calls the object. /// The stub should be executed within a context of this object's language. /// </summary> /// <returns>The delegate or a <c>null</c> reference if the object is not callable.</returns> public static Delegate GetDelegate(object callableObject, Type delegateType) { Contract.RequiresNotNull(delegateType, "delegateType"); Delegate result = callableObject as Delegate; if (result != null) { if (!delegateType.IsAssignableFrom(result.GetType())) { throw RuntimeHelpers.SimpleTypeError(String.Format("Cannot cast {0} to {1}.", result.GetType(), delegateType)); } return(result); } #if FULL IDynamicObject dynamicObject = callableObject as IDynamicObject; if (dynamicObject != null) { MethodInfo invoke; if (!typeof(Delegate).IsAssignableFrom(delegateType) || (invoke = delegateType.GetMethod("Invoke")) == null) { throw RuntimeHelpers.SimpleTypeError("A specific delegate type is required."); } // using IDynamicObject.LanguageContext for now, we need todo better Debug.Assert(dynamicObject.LanguageContext != null, "Invalid implementation"); ParameterInfo[] parameters = invoke.GetParameters(); dynamicObject.LanguageContext.CheckCallable(dynamicObject, parameters.Length); DelegateSignatureInfo signatureInfo = new DelegateSignatureInfo( dynamicObject.LanguageContext.Binder, invoke.ReturnType, parameters ); DelegateInfo delegateInfo = _dynamicDelegateCache.GetOrCreateValue(signatureInfo, delegate() { // creation code return(signatureInfo.GenerateDelegateStub()); }); result = delegateInfo.CreateDelegate(delegateType, dynamicObject); if (result != null) { return(result); } } #endif throw RuntimeHelpers.SimpleTypeError("Object is not callable."); }
public void Test_TryMove_Both_Should_Fail() { IInfo info = A.Fake <IInfo>(); IRandomTest rnd = A.Fake <IRandomTest>(); IProducerConsumerMessages <string> producerConsumer = A.Fake <IProducerConsumerMessages <string> >(); int length = 4; int hight = 4; int[] values = new int[50]; ITile[,] tiles = new ITile[length, hight]; for (int i = 0; i < length; i++) { for (int j = 0; j < hight; j++) { ITile tile = A.Fake <ITile>(); tiles[i, j] = tile; tile.DynamicObject = null; ReaderWriterLockSlim readerWriterLock = new ReaderWriterLockSlim(); A.CallTo(() => tile.Lock).ReturnsLazily(() => readerWriterLock); } } var positions = new List <(int, int)> { (0, 0), (1, 1) }; foreach (var t in positions) { int x = t.Item1; int y = t.Item2; IDynamicObject fakeObj = A.Fake <IDynamicObject>(); A.CallTo(() => fakeObj.X).ReturnsLazily(() => x); A.CallTo(() => fakeObj.Y).ReturnsLazily(() => y); A.CallTo(() => tiles[x, y].DynamicObject).ReturnsLazily(() => fakeObj); A.CallTo(() => tiles[x, y].StaticObject).Returns(null); } A.CallTo(() => info.Length).Returns(length); A.CallTo(() => info.Hight).Returns(hight); IBoard board = new Board(); board.TestBoard(tiles, info, rnd, producerConsumer); //act bool ans1 = false, ans2 = false; Thread t1 = new Thread(() => ans1 = board.TryToMove(tiles[0, 0].DynamicObject.X, tiles[0, 0].DynamicObject.Y, 1, 1)); Thread t2 = new Thread(() => ans2 = board.TryToMove(tiles[1, 1].DynamicObject.X, tiles[1, 1].DynamicObject.Y, 0, 0)); t1.Start(); t2.Start(); t1.Join(); t2.Join(); //Assert, both sould fail Assert.AreEqual(false, ans1); Assert.AreEqual(false, ans2); }
public void HandleDynamicCollision(string collisionDirection, IDynamicObject dynamicObject) { // The state of blocks should not change at all unless the dynamic object is Mario. if (!Mario.Instance.InCoinRoom && dynamicObject.ToString() == "SuperMario.Mario" && collisionDirection == "Bottom") { blockStateTransitionMachine.DynamicStateChange(collisionDirection, this, dynamicObject); } }
public void FieldNonExisting() { IDynamicObject dyn = _json; Assert.That(dyn.IsObject); Assert.That(dyn.TryGetValue("someValue", out var value, out var type), Is.False); }
public void Test_UpdateStatusAll() { IInfo info = A.Fake <IInfo>(); IRandomTest rnd = A.Fake <IRandomTest>(); IBoard board = A.Fake <IBoard>(); int[] values = new int[50]; ITile[,] tiles = new ITile[3, 3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { ITile tile = A.Fake <ITile>(); tiles[i, j] = tile; } } var positions = new List <(int, int)> { (0, 0), (1, 0), (2, 1) }; var objects = new List <IDynamicObject>(); foreach (var t in positions) { int x = t.Item1; int y = t.Item2; IDynamicObject fakeObj = A.Fake <IDynamicObject>(); A.CallTo(() => fakeObj.X).ReturnsLazily(() => x); A.CallTo(() => fakeObj.Y).ReturnsLazily(() => y); A.CallTo(() => fakeObj.Strength).Returns(2); objects.Add(fakeObj); } var obj = A.Fake <IDynamicObject>(); int strength = 1; A.CallTo(() => obj.Strength).ReturnsLazily(() => strength); A.CallTo(() => obj.X).Returns(2); A.CallTo(() => obj.Y).Returns(2); A.CallTo(() => obj.AddStrength(-1)).Invokes(() => strength--); objects.Add(obj); A.CallTo(() => info.Length).Returns(3); A.CallTo(() => info.Hight).Returns(3); A.CallTo(() => info.ObjectStrengthDecay).Returns(1); A.CallTo(() => board.GetAlive()).Returns(objects); var gameLogic = new GameLogic(); gameLogic.GameLogicTest(info, board, rnd); gameLogic.UpdateAlive(); A.CallTo(() => obj.SetState(State.Dead)).MustHaveHappened(); }
private void ResetDynamicObj() { if (traceDynamicObj != null) { traceDynamicObj.Stop(); traceDynamicObj.ClearWaypoints(); traceDynamicObj = null; } }
/// <summary> /// Gets the filter. /// </summary> /// <param name="source">The source.</param> /// <returns>The column filter.</returns> /// <exception cref="System.InvalidOperationException"></exception> public ColumnFilter GetFilter(IDynamicObject source) { var value = _valueCalculator.GetValue(source, _field.MappingKey); if (value == null) throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Key field \"{0}\" is null.", _field.Name)); return new ColumnFilter(_property.Name, value); }
/// <summary> /// Create a new dynamic object of given type. /// </summary> /// <typeparam name="T">The type of dynamic object to return.</typeparam> /// <param name="entity">An instance of the class that extends DynamicObject.</param> /// <param name="model">The model of the object in hash format.</param> /// <param name="rotation">The rotation to spawn the object at(degrees).</param> /// <param name="dimension">The dimension to spawn the object in.</param> /// <param name="isDynamic">(Optional): Set object dynamic or not.</param> /// <param name="frozen">(Optional): Set object frozen.</param> /// <param name="lodDistance">(Optional): Set LOD distance.</param> /// <param name="lightColor">(Optional): set light color.</param> /// <param name="onFire">(Optional): set object on fire(DOESN'T WORK PROPERLY YET!)</param> /// <param name="textureVariation">(Optional): Set object texture variation.</param> /// <param name="visible">(Optional): Set object visibility.</param> /// <returns>Newly created dynamic object of given type.</returns> public static T CreateDynamicObject <T>( IDynamicObject entity, uint model, Vector3 rotation, bool?isDynamic = null, bool?frozen = null, uint?lodDistance = null, Rgb lightColor = null, bool?onFire = null, TextureVariation?textureVariation = null, bool?visible = null ) { if (!(entity is T)) { Console.WriteLine($"[OBJECT-STREAMER] Given object is of type { entity.GetType() } but type { typeof(T) } was expected."); return(default);
public void Restore(IDynamicObject store, IResourceWrapper wrapper) { var settings = new JsonSerializerSettings(); settings.Converters.Add(new StringEnumConverter()); settings.Converters.Add(new InterfaceMapConverter <Keyboard, IKeyboard>()); settings.Converters.Add(new InterfaceMapConverter <Button, IButton>()); Message = JsonConvert.DeserializeObject <OutgoingMessage>(store.ToJson(), settings); }
/// <summary> /// Gets the collection of items referenced by this field. /// </summary> /// <param name="item"> /// The source item. /// </param> /// <returns> /// The collection of items. /// </returns> public IEnumerable<IDynamicObject> GetItems(IDynamicObject item) { if (item == null) throw new ArgumentNullException("item"); var sampleList = (ISampleList)item.GetValueByPropertyName(Property.Name); return sampleList != null ? sampleList.Cast<IDynamicObject>() : Enumerable.Empty<IDynamicObject>(); }
public void AddDynamicObject(IDynamicObject dynamicObject) { dynamicObject.ParentSimulation = this; if (dynamicObject.Name == string.Empty) { _name = dynamicObject.GetType().ToString() + DynamicObjects.Count.ToString() ?? "0"; } DynamicObjects.Add(dynamicObject); }
public void printLabel(IDynamicObject dynamicObject) { onResizeWindow(); if(dynamicObject.getDisplayed().Equals(TextDisplayed.None)) return; GUI.Label(objectTitleRectangle,"["+dynamicObject.getItem().getDescription().dName+"]\n",titleStyle); GUI.Label(objectCaptionRectangle, dynamicObject.getItem().getDescription().dCaption, captionStyle); }
public void BoolValue() { IDynamicObject dyn = (JsonObject)true; Assert.That(dyn.IsValue); Assert.That(dyn.TryGetValue(out var value, out var type), Is.True); Assert.That(value, Is.EqualTo(true)); Assert.That(type, Is.EqualTo(typeof(bool))); }
public void IntValue() { IDynamicObject dyn = (JsonObject)123; Assert.That(dyn.IsValue); Assert.That(dyn.TryGetValue(out var value, out var type), Is.True); Assert.That(value, Is.EqualTo(123)); Assert.That(type, Is.EqualTo(typeof(int))); }
public override void Restore(IDynamicObject store, IResourceWrapper wrapper) { BotEngine = store.Get <BotEngine>("botEngine"); BotKey = store.Get <String>("botKey"); ChatId = store.Get <Guid>("chatId"); var m = new StorableOutgoingMessage(); m.Restore(store.GetDynamicObject("message"), wrapper); Message = m; }
public void DynamicStateChange(String collisionDirection, Item item, IDynamicObject dynamicObject) { IPlayableObject playableObject = dynamicObject as IPlayableObject; if (dynamicObject.ToString() == "SuperMario.Mario") { new ItemIsConsumedCommand(playableObject, item).Execute(); } else if (dynamicObject.ToString() == "SuperMario.Block" || dynamicObject.ToString() == "SuperMario.Pipe") { // Stars are supposed to ignore collisions with blocks bool starBlockCollision = false; if (dynamicObject.ToString() == "SuperMario.Block") { Block block = dynamicObject as Block; if (block.BlockState.ToString() != "SuperMario.BlockStates.MetalBlock" && item.ItemState.ToString() == "SuperMario.ItemStates.Star") { starBlockCollision = true; } if (block.IsMoving) { item.Velocity = new Vector2(-item.Velocity.X, item.Velocity.Y); } } if (!starBlockCollision) { if (collisionDirection == GameValues.CollisionDirectionTop) { new GenericDynamicGroundCollisionCommand(item, dynamicObject).Execute(); } else if (collisionDirection == GameValues.CollisionDirectionBottom || item.CollisionRectangle.Center.Y < dynamicObject.CollisionRectangle.Top) { if (item.ItemState.ToString() == "SuperMario.ItemStates.Star") { item.Velocity = new Vector2(item.Velocity.X, Vector2.Zero.Y); item.InAir = false; } new GenericDynamicBottomCollisionCommand(item, dynamicObject).Execute(); } else if (collisionDirection == GameValues.CollisionDirectionLeft || collisionDirection == GameValues.CollisionDirectionRight) { new GenericSideCollisionCommand(item).Execute(); } } } }
public void DynamicStateChange(String collisionDirection, Item item, IDynamicObject dynamicObject) { IPlayableObject playableObject = dynamicObject as IPlayableObject; if (dynamicObject.ToString() == "SuperMario.Mario") { new ItemIsConsumedCommand(playableObject, item).Execute(); } else if (dynamicObject.ToString() == "SuperMario.Block" || dynamicObject.ToString() == "SuperMario.Pipe") { // Stars are supposed to ignore collisions with blocks bool starBlockCollision = false; if (dynamicObject.ToString() == "SuperMario.Block") { Block block = dynamicObject as Block; if (block.BlockState.ToString() != "SuperMario.BlockStates.MetalBlock" && item.ItemState.ToString() == "SuperMario.ItemStates.Star") { starBlockCollision = true; } if (block.IsMoving) { item.Velocity = new Vector2(-item.Velocity.X, item.Velocity.Y); } } if (!starBlockCollision) { if (collisionDirection == GameValues.CollisionDirectionTop) { new GenericDynamicGroundCollisionCommand(item, dynamicObject).Execute(); } else if (collisionDirection == GameValues.CollisionDirectionBottom || item.CollisionRectangle.Center.Y < dynamicObject.CollisionRectangle.Top) { if (item.ItemState.ToString() == "SuperMario.ItemStates.Star") { item.Velocity = new Vector2(item.Velocity.X, Vector2.Zero.Y); item.InAir = false; } new GenericDynamicBottomCollisionCommand(item, dynamicObject).Execute(); } else if (collisionDirection == GameValues.CollisionDirectionLeft || collisionDirection == GameValues.CollisionDirectionRight) { new GenericSideCollisionCommand(item).Execute(); } } } }
public bool TryImportScript(string scriptText, UPath scriptPath, IDynamicObject scriptObject, ScriptFlags flags, out object result, TemplateContext context = null) { if (scriptText == null) { throw new ArgumentNullException(nameof(scriptText)); } if (scriptPath == null) { throw new ArgumentNullException(nameof(scriptPath)); } if (scriptObject == null) { throw new ArgumentNullException(nameof(scriptObject)); } result = null; context = context ?? new TemplateContext(Builtins); var scriptResult = ParseScript(scriptText, scriptPath.FullName, ScriptMode.ScriptOnly); if (!scriptResult.HasErrors) { if ((flags & ScriptFlags.AllowSiteFunctions) != 0) { context.PushGlobal(SiteFunctions); } context.PushGlobal((ScriptObject)scriptObject); context.PushSourceFile(scriptPath.FullName); context.EnableOutput = false; context.TemplateLoader = (flags & ScriptFlags.AllowSiteFunctions) != 0 ? unauthorizedTemplateLoader : new TemplateLoaderFromIncludes(Site); try { result = scriptResult.Template.Evaluate(context); } catch (ScriptRuntimeException exception) { LogException(exception); return(false); } finally { context.PopSourceFile(); context.PopGlobal(); if ((flags & ScriptFlags.AllowSiteFunctions) != 0) { context.PopGlobal(); } } return(true); } return(false); }
/// <summary> /// Creates a new instance of <see cref="SqlParameter"/> and initializes its properties. /// </summary> /// <param name="source"> /// The source object. /// </param> /// <returns> /// The <see cref="SqlParameter"/>. /// </returns> public SqlParameter CreateParameter(IDynamicObject source) { if (source == null) throw new ArgumentNullException("source"); if (!(source is IEditableRoot)) throw new ArgumentException( string.Format(CultureInfo.InvariantCulture, "Editable root source expected. Actual type: {0}.", source.GetType().AssemblyQualifiedName), "source"); var crList = (IList)source.GetValueByPropertyName(_fieldName); var idList = crList != null ? crList.OfType<IDynamicObject>().Select(x => x.Id) : Enumerable.Empty<int>(); return new SqlParameter(_parameterName, SqlDbType.Xml) { Value = ConvertToXml(idList) }; }
private static object GetFieldValue(IDynamicObject source, string fieldName) { if (source == null) throw new ArgumentNullException("source"); var property = source.GetPropertyByName(fieldName); if (property == null) throw new ArgumentException( string.Format( CultureInfo.InvariantCulture, "Could not find the property '{0}' in type '{1}'.", fieldName, source.GetType().AssemblyQualifiedName), "fieldName"); return source.GetValueByPropertyName(fieldName); }
/// <summary> /// Updates the specified source. /// </summary> /// <param name="source">The source.</param> /// <param name="destination">The destination.</param> public void Update(IDynamicObject source, IEditableRoot destination) { var currentState = ESyncTypeConverter.Convert<string>(_valueCalculator.GetValue(source, _field.MappingKey)); if (currentState == null) return; var supportStates = destination as ISupportStates; if (supportStates == null) return; var state = supportStates.StateManager.States.FirstOrDefault( s => string.Compare(s.Name, currentState, StringComparison.OrdinalIgnoreCase) == 0); if (state != null) supportStates.CurrentState = state.Id; }
/// <summary> /// Gets the source property information. /// </summary> /// <param name="obj">The object.</param> /// <param name="referencePropertyName">Name of the reference property.</param> /// <returns>PropertyInfo.</returns> public PropertyInfo GetSourcePropertyInfo(IDynamicObject obj, string referencePropertyName) { var prop = obj.GetPropertyByName(referencePropertyName); if (prop == null || prop.Name == Constants.IdColumnName) return prop; var refAttr = prop.GetCustomAttributes(typeof(ReferenceDisplayFieldAttribute), false).FirstOrDefault() as ReferenceDisplayFieldAttribute; if (refAttr == null) return null; var sourceType = TheDynamicTypeManager.GetEditableRootType(refAttr.DefinedIn); if (sourceType == null) return null; var sourceProp = sourceType.GetPropertyByName(refAttr.SystemName); if (sourceProp == null) return null; var sourceAttrs = sourceProp.GetCustomAttributes(false); var isFinal = !sourceAttrs.Any(a => a is CrossRefFieldAttribute || a is ReverseCrossRefFieldAttribute); if (isFinal) { return sourceProp; } var crAttr = sourceAttrs.FirstOrDefault(a => a is CrossRefFieldAttribute) as CrossRefFieldAttribute; if (crAttr != null) { return GetSourcePropertyInfo(crAttr.ReferenceTableName, crAttr.RefFieldName); } var reverseCrAttr = sourceAttrs.FirstOrDefault(a => a is ReverseCrossRefFieldAttribute) as ReverseCrossRefFieldAttribute; if (reverseCrAttr != null) { return GetSourcePropertyInfo(reverseCrAttr.ReferenceTableName, reverseCrAttr.CrossReferenceFieldName); } return null; }
public void DynamicStateChange(String location, Fireball fireball, IDynamicObject dynamicObject) { if (dynamicObject.ToString() == "SuperMario.Block") { if (location == GameValues.CollisionDirectionTop || location == GameValues.CollisionDirectionBottom) { new GenericTopOrBottomCollisionCommand(fireball).Execute(); } else { fireball.IsAlive = false; } } else if (dynamicObject.ToString() != "SuperMario.Mario") { fireball.IsAlive = false; } }
/// <summary> /// формирует список свойств из статов /// </summary> /// <param name="dynamicObject"></param> /// <param name="list"></param> private void checkStates(IDynamicObject dynamicObject, ref List<PropertyItem> list) { if (dynamicObject == null) return; IChangedStatesType changedStates = dynamicObject as IChangedStatesType; if (changedStates == null) return; PlayerStates states = changedStates.getStates(); if (states == null) return; // общие статы if (states.maxHealth != 0f) list.Add(create(DictionaryPlayer.States.K_HEALTH,states.maxHealth, true)); if (states.maxEnergy != 0f) list.Add(create(DictionaryPlayer.States.K_ENERGY,states.maxEnergy, true)); if (states.maxMana != 0f) list.Add(create(DictionaryPlayer.States.K_MANA, states.maxMana, true)); if (states.health != 0f) list.Add(create(DictionaryPlayer.States.K_HEALTH_REST,states.health, true)); if (states.mana != 0f) list.Add(create(DictionaryPlayer.States.K_MANA_REST,states.mana, true)); if (states.energy != 0f) list.Add(create(DictionaryPlayer.States.K_ENERGY_REST,states.energy, true)); }
/// <summary> /// Gets the multi cross reference value. /// </summary> /// <param name="item">The item.</param> /// <param name="prop">The property.</param> /// <param name="isHtml">if set to <c>true</c> [is HTML].</param> /// <returns>System.String.</returns> private static string GetMultiCrossRefValue(IDynamicObject item, PropertyInfo prop, bool isHtml) { if (item is IEditableRoot) { var crList = item.GetValueByPropertyName(prop.Name) as IEnumerable; if (crList == null) return string.Empty; var crValues = crList.OfType<ICrossRefItemInfo>().Select(crItem => crItem.ToString()).ToList(); return Encode(string.Join(", ", crValues), isHtml); } return Encode(item.GetValueByPropertyName(prop.Name), isHtml); }
/// <summary> /// Gets the multi reverse cross reference value. /// </summary> /// <param name="item">The item.</param> /// <param name="prop">The property.</param> /// <param name="isHtml">if set to <c>true</c> [is HTML].</param> /// <returns>System.String.</returns> private static string GetMultiReverseCrossRefValue(IDynamicObject item, PropertyInfo prop, bool isHtml) { if (item is IEditableRoot) { var rcrList = item.GetValueByPropertyName(prop.Name) as IEnumerable; if (rcrList == null) return string.Empty; var itemValues = rcrList.OfType<IReverseCrossReferenceItem>().Select(x => x.ToString()); return Encode(string.Join(", ", itemValues), isHtml); } return Encode(item.GetValueByPropertyName(prop.Name), isHtml); }
/// <summary> /// Gets the single cross reference value. /// </summary> /// <param name="item">The item.</param> /// <param name="prop">The property.</param> /// <param name="isHtml">if set to <c>true</c> [is HTML].</param> /// <returns>System.String.</returns> private string GetSingleCrossRefValue(IDynamicObject item, PropertyInfo prop, bool isHtml) { var editableRoot = item as IEditableRoot; if (editableRoot != null) { var crId = editableRoot.GetValueByPropertyName(prop.Name) as int?; if (!crId.HasValue) return string.Empty; var ancestor = editableRoot.GetAncestor(prop); if (ancestor == null) return string.Empty; var crItem = DynamicTypeManager.GetCrossReferenceItem(ancestor.ProcessName, prop.Name, crId.Value); if (crItem == null) return string.Empty; return Encode(crItem.ToString(), isHtml); } var value = item.GetValueByPropertyName(prop.Name); return value != null ? Encode(value.ToString(), isHtml) : string.Empty; }
/// <summary> /// Gets the date time field value. /// </summary> /// <param name="item">The item.</param> /// <param name="property">The property.</param> /// <param name="formatAttribute">The format attribute.</param> /// <param name="isHtml">if set to <c>true</c> [is HTML].</param> /// <returns>System.String.</returns> private static string GetDateTimeFieldValue(IDynamicObject item, PropertyInfo property, DateTimeFormatAttribute formatAttribute, bool isHtml) { var value = (DateTime?)item.GetValueByPropertyName(property.Name); if (value == null) return string.Empty; var dtFormat = (DateTimeFormat)Enum.Parse(typeof(DateTimeFormat), formatAttribute.Value, true); switch (dtFormat) { case DateTimeFormat.Date: return Encode(value.Value.ToString(CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture), isHtml); case DateTimeFormat.Time: return Encode(value.Value.ToString(CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern, CultureInfo.InvariantCulture), isHtml); default: return Encode( value.Value.ToString( CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern + " " + CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern, CultureInfo.InvariantCulture), isHtml); } }
/// <summary> /// Gets the reverse single cross reference value. /// </summary> /// <param name="item">The item.</param> /// <param name="prop">The property.</param> /// <param name="isHtml">if set to <c>true</c> [is HTML].</param> /// <returns>System.String.</returns> private static string GetReverseSingleCrossRefValue(IDynamicObject item, PropertyInfo prop, bool isHtml) { if (item is IEditableRoot) { var rcrItem = item.GetValueByPropertyName(prop.Name); if (rcrItem == null) return string.Empty; return Encode(rcrItem.ToString(), isHtml); } var value = item.GetValueByPropertyName(prop.Name); return value != null ? Encode(value.ToString(), isHtml) : string.Empty; }
private IEnumerable<IDynamicObject> GetSingleReverseCrossReferenceItems(IDynamicObject item) { var rcrItem = (IReverseCrossReferenceItem)item.GetValueByPropertyName(Property.Name); if (rcrItem == null) return Enumerable.Empty<IDynamicObject>(); var criteria = new DetailCriteria(rcrItem.Id) { AllowLazyLoading = true }; var editableRoot = DynamicTypeManager.GetEditableRoot<IEditableRoot>(ElementProcessName, criteria); if (editableRoot == null || editableRoot.Id <= 0) return Enumerable.Empty<IDynamicObject>(); return Enumerable.Repeat(editableRoot, 1); }
private static string GetRichTextFieldValue(IDynamicObject item, PropertyInfo prop, bool isHtml) { var richText = item.GetValueByPropertyName(prop.Name); var converter = new HtmlToText(); var plainText = converter.ConvertHtml(richText); return Encode(plainText, isHtml); }
/// <summary> /// Gets the value. /// </summary> /// <param name="item">The item.</param> /// <param name="prop">The property.</param> /// <param name="isHtml">if set to <c>true</c> [is HTML].</param> /// <returns>System.String.</returns> private string GetValue(IDynamicObject item, PropertyInfo prop, bool isHtml) { if (!item.CanReadPropertyByName(prop.Name)) return Encode(Constants.BlockedContent, isHtml); if (prop.Name == Constants.PaperclipsColumnName) return GetPaperclips(item, isHtml); var crossRefAttr = (CrossRefFieldAttribute) prop.GetCustomAttributes(typeof (CrossRefFieldAttribute), false).FirstOrDefault(); if (crossRefAttr != null) { if (crossRefAttr.AllowMultiple) return GetMultiCrossRefValue(item, prop, isHtml); return GetSingleCrossRefValue(item, prop, isHtml); } var reverseCrossRefAttr = (ReverseCrossRefFieldAttribute) prop.GetCustomAttributes(typeof (ReverseCrossRefFieldAttribute), false).FirstOrDefault(); if (reverseCrossRefAttr != null) { if (reverseCrossRefAttr.DisplayMultiple) return GetMultiReverseCrossRefValue(item, prop, isHtml); return GetReverseSingleCrossRefValue(item, prop, isHtml); } var dateTimeAttr = (DateTimeFormatAttribute) prop.GetCustomAttributes(typeof(DateTimeFormatAttribute), false).FirstOrDefault(); if (dateTimeAttr != null) return GetDateTimeFieldValue(item, prop, dateTimeAttr, isHtml); var numericAttr = (NumericAttribute) prop.GetCustomAttributes(typeof(NumericAttribute), false).FirstOrDefault(); if (numericAttr != null) return GetNumericFieldValue(item, prop, numericAttr, isHtml); var richTextAttr = prop.GetCustomAttributes(typeof(RichTextAttribute), false).FirstOrDefault(); if (richTextAttr != null) return GetRichTextFieldValue(item, prop, isHtml); var fileAttribute = prop.GetCustomAttribute<FileProcessAttribute>(); if (fileAttribute != null) return GetFileValue(item, prop, isHtml); return GetGenericFieldValue(item, prop, isHtml); }
/// <summary> /// Gets the generic field value. /// </summary> /// <param name="item">The item.</param> /// <param name="property">The property.</param> /// <param name="isHtml">if set to <c>true</c> [is HTML].</param> /// <returns>System.String.</returns> private string GetGenericFieldValue(IDynamicObject item, PropertyInfo property, bool isHtml) { var value = item.GetValueByPropertyName(property.Name); return Encode(value == null ? "<not defined>" : string.Format(CultureInfo.InvariantCulture, "{0}", value), isHtml); }
/// <summary> /// Gets the paperclips. /// </summary> /// <param name="item">The item.</param> /// <param name="isHtml">if set to <c>true</c> [is HTML].</param> /// <returns>System.String.</returns> private static string GetPaperclips(IDynamicObject item, bool isHtml) { var hasPaperclips = item as IHasPaperclips; if (hasPaperclips == null) { var value = (string)item.GetValueByPropertyName(Constants.PaperclipsColumnName) ?? string.Empty; return isHtml ? HtmlEncode(value) : value; } var result = new StringBuilder(); foreach (var paperclip in hasPaperclips.Paperclips.OfType<IPaperclip>()) { if (result.Length > 0) result.Append(", "); if (isHtml) { result.AppendFormat(CultureInfo.InvariantCulture, "<a href=\"{0}\" target=\"_blank\">{1}</a>", paperclip.CurrentURI, HtmlEncode(paperclip.Name)); } else { result.Append(paperclip.Name); } } return result.ToString(); }
private string GetFileValue(IDynamicObject item, PropertyInfo property, bool isHtml) { var fileUrl = string.Empty; string displayName; if (item is IEditableRoot) { var file = item.GetValueByPropertyName(property.Name) as IFileProcess; if (file == null) return string.Empty; var fileName = file.FileName; if (!string.IsNullOrEmpty(fileName)) fileUrl = FileHelper.GetFullNavigateUrl(fileName); displayName = file.OriginalFileName; if (string.IsNullOrEmpty(displayName)) displayName = fileName; } else { displayName = item.GetValueByPropertyName(property.Name); fileUrl = item.GetValueByPropertyName(property.Name + Constants.Url); } if (string.IsNullOrEmpty(fileUrl)) { return string.Empty; } if (isHtml) { return !string.IsNullOrEmpty(fileUrl) ? string.Format(CultureInfo.InvariantCulture, "<a href=\"{0}\" target=\"_blank\">{1}</a>", fileUrl, HtmlEncode(displayName)) : HtmlEncode(displayName); } return displayName; }
/// <summary> /// Replaces the fields with values. /// </summary> /// <param name="templ">The templ.</param> /// <param name="item">The item.</param> /// <param name="isHtml">if set to <c>true</c> [is HTML].</param> /// <returns>System.String.</returns> public string ReplaceFieldsWithValues(string templ, IDynamicObject item, bool isHtml = false) { return ReplaceRegex.Replace( templ, match => { var prop = item.GetPropertyByName(match.Groups[1].Value); return prop == null ? match.Value : GetValue(item, prop, isHtml); }); }
/// <summary> /// Updates the specified source. /// </summary> /// <param name="source">The source.</param> /// <param name="destination">The destination.</param> public void Update(IDynamicObject source, IEditableRoot destination) { var filterList = new List<ColumnFilter>(); foreach (var filterBuilder in _filterBuilders) { ColumnFilter filter; if (!filterBuilder.TryGetFilter(source, out filter)) return; filterList.Add(filter); } var itemIds = RuntimeDatabase.FindItems(_referencedProcess, filterList); if (itemIds.Count <= 0) return; if (_allowMultiple) { var crList = (ICrossRefItemList)destination.GetValueByPropertyName(_property.Name); if (crList == null) return; foreach (var id in itemIds.Where(id => !crList.Contains(id))) { crList.Assign(id); } } else { destination.SetValueByPropertyName(_property.Name, itemIds[0]); } }
private IEnumerable<IDynamicObject> GetMultiReverseCrossReferenceItems(IDynamicObject item) { var rcrItems = (ICollection)item.GetValueByPropertyName(Property.Name); if (rcrItems == null) return Enumerable.Empty<IDynamicObject>(); var result = new List<IDynamicObject>(); foreach (IReverseCrossReferenceItem rcrItem in rcrItems) { var criteria = new DetailCriteria(rcrItem.Id) { AllowLazyLoading = true }; var editableItem = DynamicTypeManager.GetEditableRoot<IEditableRoot>(ElementProcessName, criteria); if (editableItem != null && editableItem.Id > 0) result.Add(editableItem); } return result; }
/// <summary> /// Gets the due date. /// </summary> /// <param name="actionDefinition">The action definition.</param> /// <param name="item">The item.</param> /// <returns>DateTime.</returns> public DateTime GetDueDate(IActionDefinition actionDefinition, IDynamicObject item) { var actionDef = actionDefinition as IAssignmentActionDefinition; if (actionDef == null) { return DateTime.MinValue; } if (item == null) { return DateTime.MinValue; } if (string.IsNullOrEmpty(actionDef.DueDateFieldName)) { return DateTime.MinValue; } var date = item.GetValueByPropertyName(actionDef.DueDateFieldName) as DateTime?; return date ?? DateTime.MinValue; }
/// <summary> /// Gets the numeric field value. /// </summary> /// <param name="item">The item.</param> /// <param name="property">The property.</param> /// <param name="formatAttribute">The format attribute.</param> /// <param name="isHtml">if set to <c>true</c> [is HTML].</param> /// <returns>System.String.</returns> private static string GetNumericFieldValue(IDynamicObject item, PropertyInfo property, NumericAttribute formatAttribute, bool isHtml) { var value = (decimal?)item.GetValueByPropertyName(property.Name); if (value == null) return string.Empty; switch (formatAttribute.NumericType) { case NumericTypes.Currency: return Encode(string.Format(CultureInfo.InvariantCulture, "${0}", value), isHtml); case NumericTypes.Percentage: return Encode(string.Format(CultureInfo.InvariantCulture, "{0}%", value), isHtml); default: return Encode(Convert.ToString(value, CultureInfo.InvariantCulture), isHtml); } }
/// <summary> /// Creates the action item information. /// </summary> /// <param name="actionItem">The action item.</param> /// <param name="item">The item.</param> /// <returns>ActionItemInfo.</returns> public ActionItemInfo CreateActionItemInfo(IActionItemInfo actionItem, IDynamicObject item) { if (item == null) return null; var actionManager = DynamicTypeManager.GetActionManager(actionItem.Process); var actionDefinition = actionManager.ActionDefinitions.FirstOrDefault(ad => string.Compare(ad.Guid.ToString(), actionItem.ActionGuid, StringComparison.OrdinalIgnoreCase) == 0); if (actionDefinition == null) return null; var isNotification = false; var assignmentActionDefinition = actionDefinition as IAssignmentActionDefinition; if (assignmentActionDefinition != null) isNotification = assignmentActionDefinition.IsNotification; if (assignmentActionDefinition != null && !assignmentActionDefinition.IsNotification) { if (!actionDefinition.CanExecute(item, null)) return null; } var subject = actionDefinition.GetSubject(item); var message = actionDefinition.GetMessageForDashboard(item); var dueDate = GetDueDate(actionDefinition, item); var actionType = GetActionType(actionDefinition); return new ActionItemInfo( actionItem.Id, actionItem.Process, actionItem.ActionGuid, actionItem.ItemId ?? 0, actionDefinition.Name, subject, message, actionType, actionDefinition.GroupName, dueDate, actionItem.IsActionNew ?? true, isNotification); }
/// <summary> /// Gets the collection of items referenced by this field. /// </summary> /// <param name="item"> /// The source item. /// </param> /// <returns> /// The collection of items. /// </returns> public IEnumerable<IDynamicObject> GetItems(IDynamicObject item) { if (item == null) throw new ArgumentNullException("item"); return _displayMultiple ? GetMultiReverseCrossReferenceItems(item) : GetSingleReverseCrossReferenceItems(item); }