NullReturns GetAnObject(ObjectEnum type, bool hasChildren = false) { if (type == ObjectEnum.NullObject) { return(null); } if (!hasChildren) { return new NullReturns() { Name = "Hello with no children" } } ; else { return new NullReturns() { Name = "Hello from Family", Children = new NullReturns[] { new NullReturns() { Name = "Child1" } } } }; }
private Dictionary <Type, ConstructorInfo> CreateConstructorDictionary() { Dictionary <Type, ConstructorInfo> dict = new Dictionary <Type, ConstructorInfo>(); ConstructorInfo[] constructors = _enumType.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic); foreach (ConstructorInfo constructor in constructors) { ParameterInfo[] constructorParams = constructor.GetParameters(); if (constructorParams.Length != 1) { continue; } Type paramType = constructorParams[0].ParameterType; if (ObjectEnum.IsSupportedSerializationType(paramType)) { dict.Add(paramType, constructor); } } if (dict.Count == 0) { throw new NotSupportedException($"The {nameof(ObjectEnum)} type '{_enumType.FullName}' doesn't have any " + $"suitable constructors for deserialization."); } return(dict); }
public void ObjeIslemler(ObjectEnum objectEnum, ObjectIslem objectIslem, object obje, int iliskiliObjeId, GridControl gridControl) { switch (objectEnum) { } }
/* * private BlockBase[,] LoadGrid(Texture2D source, int x, int y) { * BlockBase[,] blocks = new BlockBase[50,30]; * for (int dx = 0; dx < 50; dx++) * { * for (int dy = 0; dy < 30; dy++) * { * Color32 pixel = source.GetPixel(x*50+dx, y*30+dy); * blocks[dx,dy] = CreateBlockBase(pixel); * } * } * return blocks; * }*/ private bool CreateBlockBase(Color32 pixel, int x, int y, bool themeBool) { BlockEnum block = (BlockEnum)pixel.r; if ((int)block == 255) { block = BlockEnum.Air; } switch (block) { case (BlockEnum.Air): if (!themeBool) { _level.ChangeThemeint((pixel.g / 10)); if (!(SceneManager.GetActiveScene().name == "Editor")) { AudioScript.Instance.ChangeAudioClip((pixel.g / 10) + 2); } themeBool = true; } return(themeBool); case (BlockEnum.Powerup): block.NewBlock(Powerup[pixel.g]).SpawnTiles(x % 50, y % 30, _level.GridManagers[Mathf.FloorToInt(x / 50), Mathf.FloorToInt(y / 30)], ColorPicker.neutral); return(themeBool); case (BlockEnum.Object): ObjectEnum objet = (ObjectEnum)pixel.g; switch (objet) { case (ObjectEnum.Tapis): block.NewBlock(Tapis[((pixel.b == 180) ? 0 : 1)]).SpawnTiles(x % 50, y % 30, _level.GridManagers[Mathf.FloorToInt(x / 50), Mathf.FloorToInt(y / 30)], ColorPicker.neutral); return(themeBool); case (ObjectEnum.Jumper): block.NewBlock(Bumper[((pixel.b == 180) ? 0 : 1)]).SpawnTiles(x % 50, y % 30, _level.GridManagers[Mathf.FloorToInt(x / 50), Mathf.FloorToInt(y / 30)], ColorPicker.neutral); return(themeBool); case (ObjectEnum.Monsters): block.NewBlock(Monsters[pixel.b]).SpawnTiles(x % 50, y % 30, _level.GridManagers[Mathf.FloorToInt(x / 50), Mathf.FloorToInt(y / 30)], ColorPicker.neutral); return(themeBool); case (ObjectEnum.KeyBlock): block.NewBlock(KeyBlock[((pixel.b == 100) ? 1 : 0)]).SpawnTiles(x % 50, y % 30, _level.GridManagers[Mathf.FloorToInt(x / 50), Mathf.FloorToInt(y / 30)], ColorPicker.neutral); return(themeBool); default: block.NewBlock(Object[(int)objet]).SpawnTiles(x % 50, y % 30, _level.GridManagers[Mathf.FloorToInt(x / 50), Mathf.FloorToInt(y / 30)], ColorPicker.neutral); return(themeBool); } default: block.NewBlock(Block[(int)block]).SpawnTiles(x % 50, y % 30, _level.GridManagers[Mathf.FloorToInt(x / 50), Mathf.FloorToInt(y / 30)], ColorPicker.neutral); return(themeBool); } }
/// <summary> /// Thread that calls in regular intervals into registered remoted server-side /// Objects. /// /// @comment The Thread is started at Class instantiation and can be stopped by /// calling the StopKeepAlive method. /// /// @comment The interval can be configured with the ClientSetting /// 'ServerObjectKeepAliveIntervalInSeconds'. /// /// </summary> /// <returns>void</returns> public void KeepAliveThread() { IDictionaryEnumerator ObjectEnum; // Check whether this Thread should still execute while (UKeepRemotedObjectsAlive) { try { ObjectEnum = UKeepAliveObjects.GetEnumerator(); try { if (Monitor.TryEnter(UKeepAliveObjects.SyncRoot, 10000)) { // Iterate over all Objects in the SortedList and keep them alive while (ObjectEnum.MoveNext()) { try { ((IKeepAlive)ObjectEnum.Value).KeepAlive(); } catch (Exception) { } } } } finally { Monitor.Exit(UKeepAliveObjects.SyncRoot); } } catch (System.Runtime.Remoting.RemotingException Exp) { // string DebugInfo = StrConnectionUnavailableCause + Exp.ToString(); // MessageBox.Show(AppCoreResourcestrings.StrConnectionBroken + DebugInfo, AppCoreResourcestrings.StrConnectionBrokenTitle, // MessageBoxButtons.OK, MessageBoxIcon.Error); TLogging.Log("RemotingException in TEnsureKeepAlive.KeepAliveThread: " + Exp.ToString(), TLoggingType.ToLogfile); } catch (System.Net.Sockets.SocketException Exp) { // string DebugInfo = StrConnectionUnavailableCause + Exp.ToString() + // "\r\n\r\nSocketException.ErrorCode: " + Exp.ErrorCode.ToString(); // MessageBox.Show(AppCoreResourcestrings.StrConnectionClosed + DebugInfo, AppCoreResourcestrings.StrConnectionClosedTitle, // MessageBoxButtons.OK, MessageBoxIcon.Error); TLogging.Log("SocketException in TEnsureKeepAlive.KeepAliveThread: " + Exp.ToString(), TLoggingType.ToLogfile); } catch (Exception Exp) { TLogging.Log("Exception in TEnsureKeepAlive.KeepAliveThread: " + Exp.ToString(), TLoggingType.ToLogfile); } // Sleep for some time. After that, this function is called again automatically. Thread.Sleep(TClientSettings.ServerObjectKeepAliveIntervalInSeconds * 1000); } // Thread stops here and doesn't get called again automatically. }
public CreationRequestAction(BitBuffer buffer) { _objectType = (ObjectEnum)buffer.readInt(0, Enum.GetValues(typeof(ObjectEnum)).Length); float x = buffer.readFloat(-31.0f, 31.0f, 0.1f); float y = buffer.readFloat(0.0f, 3.0f, 0.1f); float z = buffer.readFloat(-31.0f, 31.0f, 0.1f); _creationPosition = new Vector3(x, y, z); }
/// <summary> /// Constructor to create a memory object /// </summary> /// <param name="_type">Type for object</param> /// <param name="_start">Start point (or upper left point for ellipses/circles)</param> /// <param name="_end">End point (or lower right point for ellipses/circles)</param> /// <param name="_color">Color to paint object</param> /// <param name="_size">Size of pen to paint object</param> /// <param name="_filled">Ellipse/Rectangle is filled or not</param> public MemoryObject(ObjectEnum _type, Point _start, Point _end, Color _color, int _size, bool _filled = false) { // Assign values to properties from constructor parameters. type = _type; start = _start; end = _end; color = _color; size = _size; filled = _filled; }
public void CopyEnum() { var source = new ObjectEnum { Id = 1, MyEnum = MyEnum.Two }; var result = source.CopyPropertiesToNew <ObjectEnum>(); Assert.AreEqual(source.MyEnum, result.MyEnum); }
public CreationAction(BitBuffer payload) { _objectType = (ObjectEnum)payload.readInt(0, Enum.GetValues(typeof(ObjectEnum)).Length); float x = payload.readFloat(-31.0f, 31.0f, 0.1f); float y = payload.readFloat(0.0f, 3.0f, 0.1f); float z = payload.readFloat(-31.0f, 31.0f, 0.1f); _creationPosition = new Vector3(x, y, z); _objectId = payload.readInt(0, Int32.MaxValue); }
public void WithValidParams_CopyPropertiesToNewObject() { var source = new ObjectEnum { Id = 1, MyEnum = MyEnum.Two, }; var result = source.CopyPropertiesToNew <ObjectEnum>(); Assert.AreEqual(source.MyEnum, result.MyEnum); }
public void ProcessCreationRequest(int clientId, Vector3 creationPosition, ObjectEnum objectType) { Debug.Log("Creation request received from client " + clientId + " position " + creationPosition); if (objectType.Equals(ObjectEnum.Ball)) { Ball newBall = _objectFactory.CreateBall(creationPosition, clientId); _eventManager.BroadcastEventAction(new CreationAction(newBall.Position, newBall.ObjectId, ObjectEnum.Ball)); _eventManager.SendEventAction(new AssignPlayerAction(newBall.ObjectId), clientId); BallController ballController = Instantiate(ballPrefab).GetComponent <BallController>(); ballController.SetBall(newBall); _balls.Add(ballController); } }
public void ProcessCreationRequest(int clientId, Vector3 creationPosition, ObjectEnum objectType) { Debug.Log("Creation request received from client " + clientId + " " + objectType + " at " + creationPosition); if (objectType.Equals(ObjectEnum.Player)) { int objectId = _objectIdManager.GetNext(); PlayerController playerController = Instantiate(PlayerPrefab).GetComponent <PlayerController>(); playerController.InitializeServer(objectId, clientId, creationPosition, HealthWatcher); _objects.Add(playerController); _eventManager.BroadcastEventAction(new CreationAction(creationPosition, objectId, objectType)); _eventManager.SendEventAction(new AssignPlayerAction(objectId), clientId); } }
public void ProcessObjectCreation(int objectId, Vector3 creationPosition, ObjectEnum objectType, int clientId) { Debug.Log("Creation action received from server."); if (objectType.Equals(ObjectEnum.Ball)) { Ball newBall = new Ball(clientId, objectId, creationPosition); BallController ballController = Instantiate(ballPrefab).GetComponent <BallController>(); ballController.SetBall(newBall); if (newBall.ObjectId.Equals(_playerObjectId)) { Camera.GetComponent <CameraController>().SetPlayer(ballController.gameObject); } _balls.Add(ballController); } }
/// <summary> /// Creates a new instance of the <see cref="ObjectEnum"/>-type this factory is for. /// If there is no suitable constructor for the type <paramref name="valueType"/>, a /// <see cref="NotSupportedException"/> will be thrown. /// <para> /// Use this method if the type of <paramref name="value"/> is already known /// (and you're sure about it). /// </para> /// </summary> /// <param name="value">The value used for instantiating the <see cref="ObjectEnum"/>.</param> /// <param name="valueType">The <see cref="Type"/> of <paramref name="value"/>.</param> public ObjectEnum Create(object value, Type valueType) { if (_constructorCache.TryGetValue(valueType, out ConstructorInfo constructor)) { return((ObjectEnum)constructor.Invoke(new[] { value })); } if (ObjectEnum.IsSupportedSerializationType(valueType)) { throw new NotSupportedException($"The object enum '{_enumType.FullName}' doesn't have a constructor which takes a single " + $"argument of type '{valueType.FullName}'."); } else { throw new NotSupportedException($"The type '{valueType}' isn't supported for serialization within {nameof(ObjectEnum)}."); } }
public Object(string s) { var sArr = s.Split('\''); suffixes = new List <Suffix>(); try { word = (ObjectEnum)Enum.Parse(typeof(ObjectEnum), sArr[0]); foreach (string suffix in sArr.Skip(1)) { suffixes.Add((Suffix)Enum.Parse(typeof(Suffix), suffix)); } } catch { word = ObjectEnum.Fizzle; } }
private void ProcessObjectCreation(int objectId, Vector3 creationPosition, ObjectEnum objectType, int clientId) { Debug.Log("Creation action received from server."); switch (objectType) { case ObjectEnum.Player: PlayerController playerController = Instantiate(PlayerPrefab).GetComponent <PlayerController>(); bool isPlayer = objectId.Equals(_playerObjectId); playerController.InitializeClient(objectId, clientId, creationPosition, Prediction && isPlayer); _objects.Add(playerController); if (isPlayer) { Camera.GetComponent <CameraController>().SetPlayer(playerController.gameObject); } break; case ObjectEnum.Projectile: ProjectileController projectileController = Instantiate(ProjectilePrefab).GetComponent <ProjectileController>(); projectileController.InitializeClient(objectId, clientId, creationPosition + new Vector3(1, 1, 1)); _objects.Add(projectileController); break; } }
public static void insertErrorTable(Context ctx, UpdatePrtableinEnum status, ObjectEnum Obstatus, string id = null) { ICommonService service = KEEPER.K3._3D.Contracts.ServiceFactory.GetService <ICommonService>(ctx); service.insertErrorTable(ctx, status, Obstatus, id); }
/// <summary> /// Initializes a new instance of the <see cref="IFPInt"/> class. /// </summary> /// <param name="ifpoffset">The ifpoffset.</param> /// <param name="iType">Type of the i.</param> /// <param name="ifpvisible">if set to <c>true</c> [ifpvisible].</param> /// <param name="ifpname">The ifpname.</param> /// <param name="iIndex">Index of the i.</param> /// <param name="entlineNumber">The entline number.</param> /// <param name="entparent">The entparent.</param> /// <param name="entPrevSibling">The ent prev sibling.</param> /// <remarks></remarks> public IFPInt( int ifpoffset, ObjectEnum iType, bool ifpvisible, string ifpname, Index iIndex, int entlineNumber, int entparent, int entPrevSibling) { this.siblingPrevious = entPrevSibling; this.parent = entparent; this.lineNumber = entlineNumber; this.entIndex = iIndex; this.ObjectType = iType; this.offset = ifpoffset; this.visible = ifpvisible; this.name = ifpname; }
public void ObjeIslemler2(ObjectEnum objectEnum, ObjectIslem objectIslem, object obje, int iliskiliObjeId, GridControl gridControl) { switch (objectEnum) { case ObjectEnum.Marka: var brand = (DataRowView)obje; PRODUCT_BRANDS productBrand; BindingSource bi = new BindingSource(); switch (objectIslem) { case ObjectIslem.Ekle: /* productBrand = new PRODUCT_BRANDS * { * BRAND_NAME = (string) brand["Marka"] * }; * _dbproductContext.PRODUCT_BRANDS.Add(productBrand); */ _dbproductContext.SaveChanges(); break; case ObjectIslem.Guncelle: int id = (int)brand["Id"]; productBrand = _dbproductContext.PRODUCT_BRANDS.FirstOrDefault(b => b.BRAND_ID == id); productBrand.BRAND_NAME = brand["Marka"].ToString(); _dbproductContext.Entry(productBrand).State = System.Data.Entity.EntityState.Modified; _dbproductContext.SaveChanges(); break; case ObjectIslem.Listele: _dbproductContext.PRODUCT_BRANDS.Load(); // This line of code is generated by Data Source Configuration Wizard bi.DataSource = _dbproductContext.PRODUCT_BRANDS.Local.ToBindingList(); gridControl.DataSource = bi; /* List<MyGridView> objeList = (from pbs in _dbproductContext.PRODUCT_BRANDS * select new MyGridView() * { * Id= pbs.BRAND_ID,Deger = pbs.BRAND_NAME, * kolonAdi = ObjectEnum.Marka.ToString() * } * ).ToList(); * * ds = new DataSet(); * ds.Tables.Add(GetDataSource(objeList)); * gridControl.DataSource = ds.Tables[0];*/ break; } break; case ObjectEnum.Model: var model = (DataRowView)obje; PRODUCT_BRANDS_MODEL productBrandsModel; switch (objectIslem) { case ObjectIslem.Ekle: productBrandsModel = new PRODUCT_BRANDS_MODEL { BRAND_ID = iliskiliObjeId, MODEL_NAME = (string)model[objectEnum.ToString()] }; _dbproductContext.PRODUCT_BRANDS_MODEL.Add(productBrandsModel); _dbproductContext.SaveChanges(); break; case ObjectIslem.Guncelle: int id = (int)model["Id"]; productBrandsModel = _dbproductContext.PRODUCT_BRANDS_MODEL.FirstOrDefault(b => b.MODEL_ID == id); productBrandsModel.MODEL_NAME = model[objectEnum.ToString()].ToString(); _dbproductContext.Entry(productBrandsModel).State = System.Data.Entity.EntityState.Modified; _dbproductContext.SaveChanges(); break; case ObjectIslem.Listele: _dbproductContext.PRODUCT_BRANDS.Load(); // This line of code is generated by Data Source Configuration Wizard gridControl.DataSource = _dbproductContext.PRODUCT_BRANDS.Local.ToBindingList(); List <MyGridView> objeList = (from pbs in _dbproductContext.PRODUCT_BRANDS_MODEL select new MyGridView() { // Id = pbs.BRAND_ID, Id = pbs.MODEL_ID, Deger = pbs.MODEL_NAME, kolonAdi = objectEnum.ToString() } ).ToList(); ds = new DataSet(); ds.Tables.Add(GetDataSource(objeList)); gridControl.DataSource = ds.Tables[0]; break; } break; case ObjectEnum.Birim: var birim = (Birim)obje; SETUP_UNIT setupUnit; switch (objectIslem) { case ObjectIslem.Ekle: setupUnit = new SETUP_UNIT { UNIT_ID = birim.BirimId, UNIT = birim.BirimAd }; _dbproductContext.SETUP_UNIT.Add(setupUnit); _dbproductContext.SaveChanges(); break; case ObjectIslem.Guncelle: setupUnit = _dbproductContext.SETUP_UNIT.FirstOrDefault(b => b.UNIT_ID == birim.BirimId); setupUnit.UNIT = birim.BirimAd; _dbproductContext.Entry(setupUnit).State = System.Data.Entity.EntityState.Modified; _dbproductContext.SaveChanges(); break; case ObjectIslem.Listele: List <Birim> objeList = (from pbs in _dbproductContext.SETUP_UNIT select new Birim() { BirimId = pbs.UNIT_ID, BirimAd = pbs.UNIT } ).ToList(); var bindingSource = new BindingSource(objeList, null); gridControl.DataSource = bindingSource; break; } break; case ObjectEnum.UrunKategori: var productCat_ = (UrunKategori)obje; PRODUCT_CAT productCat; switch (objectIslem) { case ObjectIslem.Ekle: productCat = new PRODUCT_CAT { PRODUCT_CATID = productCat_.KategoriId, PRODUCT_CAT1 = productCat_.Kategori, HIERARCHY = productCat_.KategoriKodu }; _dbproductContext.PRODUCT_CAT.Add(productCat); _dbproductContext.SaveChanges(); break; case ObjectIslem.Guncelle: productCat = _dbproductContext.PRODUCT_CAT.FirstOrDefault(b => b.PRODUCT_CATID == productCat_.KategoriId); productCat.PRODUCT_CAT1 = productCat_.Kategori; productCat_.Hiyerarsi = productCat_.Hiyerarsi; _dbproductContext.Entry(productCat).State = System.Data.Entity.EntityState.Modified; _dbproductContext.SaveChanges(); break; case ObjectIslem.Listele: List <UrunKategori> objeList = (from pbs in _dbproductContext.PRODUCT_CAT select new UrunKategori() { KategoriId = pbs.PRODUCT_CATID, Kategori = pbs.PRODUCT_CAT1, KategoriKodu = pbs.HIERARCHY } ).ToList(); var bindingSource = new BindingSource(objeList, null); gridControl.DataSource = bindingSource; break; } break; } }
public void ComboDoldur(ObjectEnum objectEnum, object obje) { }
public void Add(ObjectEnum Item) { this._Objects.Add(Item); }
public void SetObjectEnum(ObjectEnum enumValue) { m_ObjectEnum = enumValue; }
public void Remove(ObjectEnum Item) { this._Objects.Remove(Item); }
public CreationAction(Vector3 creationPosition, int objectId, ObjectEnum objectType) { _creationPosition = creationPosition; _objectId = objectId; _objectType = objectType; }
public override void Update(GameTime gameTime) { if (KeyMouseReader.KeyPressed(Keys.P)) { ClickCounter++; switch (ClickCounter % 7) { case 0: SelectedObject = ObjectEnum.Platform; break; case 1: SelectedObject = ObjectEnum.VerticalPlatform; break; case 2: SelectedObject = ObjectEnum.HorizontalPlatform; break; case 3: SelectedObject = ObjectEnum.SpikePlatform; break; case 4: SelectedObject = ObjectEnum.CloudPlatform; break; case 5: SelectedObject = ObjectEnum.IcePlatform; break; case 6: SelectedObject = ObjectEnum.FadingPlatform; break; default: throw new ArgumentOutOfRangeException(); } } if (KeyMouseReader.KeyPressed(Keys.U)) { SelectedObject = ObjectEnum.Player; } if (KeyMouseReader.KeyPressed(Keys.G)) { SelectedObject = ObjectEnum.Goal; } if (Keyboard.GetState().IsKeyDown(Keys.E)) { SelectedObject = ObjectEnum.Enemy; } if (Keyboard.GetState().IsKeyDown(Keys.R)) { SelectedObject = ObjectEnum.WalkingEnemy; } if (Keyboard.GetState().IsKeyDown(Keys.C)) { SelectedObject = ObjectEnum.None; } if (Keyboard.GetState().IsKeyDown(Keys.Q)) { SelectedObject = ObjectEnum.UnlimitedPower; } if (Keyboard.GetState().IsKeyDown(Keys.W)) { SelectedObject = ObjectEnum.SlowWorld; } if (Keyboard.GetState().IsKeyDown(Keys.H)) { SelectedObject = ObjectEnum.HpGain; } if (KeyMouseReader.KeyPressed(Keys.S)) { SaveToFile(); } if (KeyMouseReader.KeyPressed(Keys.L)) { ReadFromFile(); } if (KeyMouseReader.KeyDown(Keys.Right)) { CamPos.X += 1; CamPos.Y += 0; } else if (KeyMouseReader.KeyDown(Keys.Left)) { CamPos.X += -1; CamPos.Y += 0; } if (KeyMouseReader.KeyDown(Keys.Up)) { CamPos.X += 0; CamPos.Y += -1; } else if (KeyMouseReader.KeyDown(Keys.Down)) { CamPos.X += 0; CamPos.Y += 1; } Cam.SetPos(CamPos); MousePosition = KeyMouseReader.MousePosition; var transform = Matrix.Invert(Cam.GetTransform()); Vector2.Transform(ref MousePosition, ref transform, out MousePosition); PlacePosition = MousePosition; if (Objects.Count > 0 && SelectedObject != ObjectEnum.Player) { var closestObj = Objects[0]; foreach (var obj in Objects) { if (Vector2.Distance(obj.GetCenter(), MousePosition) < Vector2.Distance(closestObj.GetCenter(), MousePosition)) { closestObj = obj; } } if (Vector2.Distance(closestObj.GetCenter(), MousePosition) < 25) { PlacePosition = closestObj.GetCenter().X - MousePosition.X < 0 ? new Vector2(closestObj.Dest.Right, closestObj.Dest.Top) : new Vector2(closestObj.Dest.Left - closestObj.Dest.Width, closestObj.Dest.Top); } } if (KeyMouseReader.LeftClick()) { switch (SelectedObject) { case ObjectEnum.Platform: Objects.Add(new Platform(PlacePosition, TextureManager.PlatformSpritesheet)); break; case ObjectEnum.VerticalPlatform: Objects.Add(new VerticalPlatform(PlacePosition, TextureManager.PlatformSpritesheet)); break; case ObjectEnum.HorizontalPlatform: Objects.Add(new HorizontalPlatform(PlacePosition, TextureManager.PlatformSpritesheet)); break; case ObjectEnum.SpikePlatform: Objects.Add(new SpikePlatform(PlacePosition, TextureManager.PlatformSpritesheet)); break; case ObjectEnum.CloudPlatform: Objects.Add(new CloudPlatform(PlacePosition, TextureManager.PlatformSpritesheet)); break; case ObjectEnum.IcePlatform: Objects.Add(new IcePlatform(PlacePosition, TextureManager.PlatformSpritesheet)); break; case ObjectEnum.FadingPlatform: Objects.Add(new FadingPlatform(PlacePosition, TextureManager.PlatformSpritesheet)); break; case ObjectEnum.Player: Objects.Add(new Player(PlacePosition, TextureManager.NogardAbilitySpritesheet)); break; case ObjectEnum.Enemy: Objects.Add(new BaseEnemy(MousePosition, TextureManager.EnemySpritesheet)); break; case ObjectEnum.WalkingEnemy: Objects.Add(new StandardEnemy(MousePosition, TextureManager.EnemySpritesheet)); break; case ObjectEnum.FlyingEnemy: Objects.Add(new FlyingEnemy(MousePosition, TextureManager.EnemySpritesheet)); break; case ObjectEnum.Goal: Objects.Add(new Goal(PlacePosition, TextureManager.PlatformSpritesheet)); break; case ObjectEnum.None: Objects.RemoveAll(item => Vector2.Distance(item.GetCenter(), MousePosition) < 25); break; case ObjectEnum.UnlimitedPower: Objects.Add(new UnlimitedPowerObject(PlacePosition, TextureManager.UnlimitedPowerTex)); break; case ObjectEnum.SlowWorld: Objects.Add(new SlowWorldPowerObject(PlacePosition, TextureManager.SlowWorldTex)); break; case ObjectEnum.HpGain: Objects.Add(new HealthGain(PlacePosition, TextureManager.HpGainTex)); break; default: throw new ArgumentOutOfRangeException(); } } }
public ErrorStatus DeleteObject( int handleInput, ObjectEnum usedObject, out Handle handleOutput) { _LSAPR_OBJECT_ATTRIBUTES[] objectAttributesForDelete = new _LSAPR_OBJECT_ATTRIBUTES[1]; _RPC_UNICODE_STRING[] SecretName = new _RPC_UNICODE_STRING[1]; IntPtr? deleteHandle = IntPtr.Zero; IntPtr? PolicyHandle2 = IntPtr.Zero; IntPtr? deletedHandle = IntPtr.Zero; Hashtable htCheckHandle = new Hashtable(); if (TurstDomainFlag && usedObject == ObjectEnum.TrustDomainObject) { ////Check if Interdomain Trust Account exist and is valid bool isInterdomainTrustAccountExist = !CheckInterdomainTrustAccount(); uintMethodStatus = lsadClientStack.LsarDeleteObject(ref validTrustHandle); handleOutput = (IntPtr.Zero == validTrustHandle) ? Handle.Null : Handle.Invalid; TurstDomainFlag = false; ////Check if interdomain trust account is deleted along with the trusted domain if (isInterdomainTrustAccountExist) { #region MS-LSAD_R1062 // Add the comment information including the location information. TestClassBase.BaseTestSite.Log.Add(LogEntryKind.Comment, "Verify MS-LSAD_R1062"); // Verify requirement 1062 TestClassBase.BaseTestSite.CaptureRequirement( "MS-LSAD", 1062, @"If the object being deleted is a trusted domain, then the server MUST also check whether an interdomain trust account with name ""<Trusted Domain NetBIOS Name>$"" exists."); #endregion //// The server must delete that account along with the trusted domain, so check the accounts exists //// or not We expect the trusted domain is not existed #region MS-LSAD_R1063 // Add the comment information including the location information. TestClassBase.BaseTestSite.Log.Add(LogEntryKind.Comment, "Verify MS-LSAD_R1063"); // Verify requirement 1063 TestClassBase.BaseTestSite.CaptureRequirement( "MS-LSAD", 1063, @"If an interdomain trust account with name ""<Trusted Domain NetBIOS Name>$""] exists, the server MUST delete that account along with the trusted domain."); #endregion } } else { if (secretFlag && usedObject == ObjectEnum.SecretObject) { objectAttributesForDelete[0].RootDirectory = null; IntPtr?tempSecretHandle = IntPtr.Zero; IntPtr?tempSecretHandle2 = IntPtr.Zero; IntPtr?objDeletHandle = IntPtr.Zero; if (stSecretInformation.UIntSecretHandleAccessCount != handleInput) { utilities.nameOfSecretObject(ResOfNameChecked.Valid, ref SecretName); lsadClientStack.LsarOpenPolicy( utilities.ConversionfromStringtoushortArray("name"), objectAttributesForDelete[0], ACCESS_MASK.POLICY_CREATE_SECRET, out PolicyHandle2); lsadClientStack.LsarOpenSecret( PolicyHandle2.Value, SecretName[0], ACCESS_MASK.DELETE, out tempSecretHandle2); if (tempSecretHandle2 != IntPtr.Zero) { lsadClientStack.LsarDeleteObject(ref tempSecretHandle2); } lsadClientStack.LsarCreateSecret( PolicyHandle2.Value, SecretName[0], ACCESS_MASK.DELETE, out tempSecretHandle); lsadClientStack.LsarOpenSecret( PolicyHandle2.Value, SecretName[0], ACCESS_MASK.DELETE, out tempSecretHandle2); lsadClientStack.LsarDeleteObject(ref tempSecretHandle); deletedHandle = tempSecretHandle; objDeletHandle = tempSecretHandle2; } else if ((uintAccessMask & ACCESS_MASK.DELETE) != ACCESS_MASK.DELETE) { objDeletHandle = objSecretHandle; } else if (stPolicyInformation.PHandle == handleInput) { objDeletHandle = PolicyHandle; } else { objDeletHandle = objSecretHandle; } uintMethodStatus = lsadClientStack.LsarDeleteObject(ref objDeletHandle); deletedHandle = objDeletHandle; handleOutput = (0 == uintMethodStatus) ? Handle.Null : Handle.Invalid; } else { uintDesrAccess = ACCESS_MASK.MAXIMUM_ALLOWED; objAccountSid[0].Revision = 0x01; uintMethodStatus = lsadClientStack.LsarOpenPolicy( serverName, objectAttributesForDelete[0], uintDesrAccess, out objPolicyHandle); if (stPolicyInformation.PHandle == handleInput) { uintMethodStatus = lsadClientStack.LsarOpenPolicy( serverName, objectAttributesForDelete[0], uintDesrAccess, out objPolicyHandle); deleteHandle = objPolicyHandle; uintMethodStatus = lsadClientStack.LsarDeleteObject(ref objPolicyHandle); deletedHandle = objPolicyHandle; } else if ((stPolicyInformation.PHandle + 1 != handleInput) || ((htAccHandle.Count == 0) && (checkTrustHandle == false))) { #region Passing InvalidHandle uintMethodStatus = lsadClientStack.LsarOpenAccount( objPolicyHandle.Value, objAccountSid[0], uintDesrAccess, out deleteHandle); if (uintMethodStatus != 0) { uintMethodStatus = lsadClientStack.LsarCreateAccount( objPolicyHandle.Value, objAccountSid[0], uintDesrAccess, out deleteHandle); } uintMethodStatus = lsadClientStack.LsarOpenAccount( objPolicyHandle.Value, objAccountSid[0], uintDesrAccess, out objAccountHandle); uintMethodStatus = lsadClientStack.LsarDeleteObject(ref deleteHandle); #endregion Passing InvalidHandle deleteHandle = objAccountHandle; uintMethodStatus = lsadClientStack.LsarDeleteObject(ref objAccountHandle); deletedHandle = objAccountHandle; } else { if (uintOpenAccAccess != 0) { objAccountSid[0].Revision = 0x01; uintDesrAccess = ACCESS_MASK.MAXIMUM_ALLOWED; } else { uintDesrAccess = ACCESS_MASK.NONE; htCheckHandle.Add("DeleteHandle", 0); } lsadClientStack.LsarOpenAccount( objPolicyHandle.Value, objAccountSid[0], uintDesrAccess, out objAccountHandle); deleteHandle = validAccountHandle; if (uintOpenAccAccess != 0) { uintMethodStatus = lsadClientStack.LsarDeleteObject(ref deleteHandle); } else { if ((checkTrustHandle == true) && (htAccHandle.Count == 0)) { deleteHandle = validTrustHandle; uintMethodStatus = lsadClientStack.LsarDeleteObject(ref deleteHandle); } else { uintMethodStatus = lsadClientStack.LsarDeleteObject(ref objAccountHandle); deletedHandle = objAccountHandle; } } } handleOutput = (IntPtr.Zero == deleteHandle) ? Handle.Null : Handle.Invalid; } if (secretFlag && usedObject == ObjectEnum.SecretObject) { if (stSecretInformation.UIntSecretHandleAccessCount != handleInput) { #region MS-LSAD_R844 TestClassBase.BaseTestSite.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.InvalidHandle, (uint)uintMethodStatus, "MS-LSAD", 844, @"The server MUST make all subsequent requests to the deleted object fail with STATUS_INVALID_HANDLE, even if the requests come in through other open handles."); #endregion } else if ((uintAccessMask & ACCESS_MASK.DELETE) != ACCESS_MASK.DELETE) { #region MS-LSAD_R843 TestClassBase.BaseTestSite.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.AccessDenied, (uint)uintMethodStatus, "MS-LSAD", 843, @"The handle in LsarDeleteObject MUST have been opened for DELETE access, and the server MUST fail the request with STATUS_ACCESS_DENIED otherwise."); #endregion } else if (stPolicyInformation.PHandle == handleInput) { #region MS-LSAD_R842 TestClassBase.BaseTestSite.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.InvalidParameter, (uint)uintMethodStatus, "MS-LSAD", 842, @"Policy objects cannot be deleted. Attempts to delete policy objects MUST fail with STATUS_INVALID_PARAMETER."); #endregion } else { #region MS-LSAD_R840 TestClassBase.BaseTestSite.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.Success, (uint)uintMethodStatus, "MS-LSAD", 840, @"LsarDeleteObject MUST return STATUS_SUCCESS if the request was successfully completed."); #endregion #region MS-LSAD_R845 TestClassBase.BaseTestSite.CaptureRequirementIfIsTrue( (((uint)uintMethodStatus == (uint)ErrorStatus.Success) && deletedHandle == IntPtr.Zero), "MS-LSAD", 845, @"The deleted ObjectHandle of LsarDeleteObject MUST be automatically closed by the server; the caller need not close it."); #endregion } if (objSecretHandle != IntPtr.Zero) { objectAttributesForDelete[0].RootDirectory = null; utilities.nameOfSecretObject(ResOfNameChecked.Valid, ref SecretName); lsadClientStack.LsarOpenPolicy2( "name", objectAttributesForDelete[0], ACCESS_MASK.DELETE | ACCESS_MASK.POLICY_CREATE_SECRET, out PolicyHandle2); lsadClientStack.LsarCreateSecret( PolicyHandle2.Value, SecretName[0], ACCESS_MASK.DELETE, out objSecretHandle); lsadClientStack.LsarOpenSecret( PolicyHandle2.Value, SecretName[0], ACCESS_MASK.DELETE, out objSecretHandle); lsadClientStack.LsarDeleteObject(ref objSecretHandle); } secretFlag = false; } else { if (stPolicyInformation.PHandle == handleInput) { #region MS-LSAD_R842 TestClassBase.BaseTestSite.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.InvalidParameter, (uint)uintMethodStatus, "MS-LSAD", 842, @"Policy objects cannot be deleted. Attempts to delete policy objects MUST fail with STATUS_INVALID_PARAMETER."); #endregion } else if ((stPolicyInformation.PHandle + 1 != handleInput) || ((htAccHandle.Count == 0) && (checkTrustHandle == false))) { #region MS-LSAD_R841 TestClassBase.BaseTestSite.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.InvalidHandle, (uint)uintMethodStatus, "MS-LSAD", 841, @"If the ObjectHandle of LsarDeleteObject is not a valid context handle to an object, the server MUST return STATUS_INVALID_HANDLE."); #endregion #region MS-LSAD_R844 TestClassBase.BaseTestSite.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.InvalidHandle, (uint)uintMethodStatus, "MS-LSAD", 844, @"The server MUST make all subsequent requests to the deleted object fail with STATUS_INVALID_HANDLE, even if the requests come in through other open handles."); #endregion } else if (((uintAccess & ACCESS_MASK.DELETE) != ACCESS_MASK.DELETE) && ((uintOpenAccAccess & ACCESS_MASK.DELETE) != ACCESS_MASK.DELETE) && (htAccHandle.Count != 0)) { #region MS-LSAD_R843 TestClassBase.BaseTestSite.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.AccessDenied, (uint)uintMethodStatus, "MS-LSAD", 843, @"The handle in LsarDeleteObject MUST have been opened for DELETE access, and the server MUST fail the request with STATUS_ACCESS_DENIED otherwise."); #endregion } else { NtStatus checkDeleteHandle = lsadClientStack.LsarOpenAccount( objPolicyHandle.Value, objAccountSid[0], uintAccessMask, out objAccountHandle); if (checkDeleteHandle == (NtStatus)0xC0000034) { #region MS-LSAD_R840 TestClassBase.BaseTestSite.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.Success, (uint)uintMethodStatus, "MS-LSAD", 840, @"LsarDeleteObject MUST return STATUS_SUCCESS if the request was successfully completed."); #endregion #region MS-LSAD_R845 TestClassBase.BaseTestSite.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.Success, (uint)uintMethodStatus, "MS-LSAD", 845, @"The deleted ObjectHandle of LsarDeleteObject MUST be automatically closed by the server; the caller need not close it."); #endregion #region MS-LSAD_R224 TestClassBase.BaseTestSite.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.Success, (uint)uintMethodStatus, "MS-LSAD", 224, @"Deleting an object to which the caller has an open handle (by calling LsarDeleteObject), if successful, MUST also close the handle."); #endregion } } if (htAccHandle.Count != 0) { utilities.DeleteExistAccount(); htAccHandle.Remove("AccHandle"); } utilities.CreateExistAccount(uintOpenAccAccess); if (htAddAccRight.Count != 0) { htAddAccRight.Remove("htAddAccRight"); } } } return((ErrorStatus)uintMethodStatus); }
public CreationRequestAction(Vector3 creationPosition, ObjectEnum objectType) { _creationPosition = creationPosition; _objectType = objectType; }
public static void updateTableStatus(Context ctx, UpdatePrtableinEnum status, ObjectEnum Obstatus, long[] ids = null, List <UpdatePrtableEntity> uyList = null) { ICommonService service = KEEPER.K3._3D.Contracts.ServiceFactory.GetService <ICommonService>(ctx); service.updateTableStatus(ctx, status, Obstatus, ids, uyList); }
public void ObjeIslemler(ObjectEnum objectEnum, ObjectIslem objectIslem, object obje, int iliskiliObjeId, GridControl gridControl) { switch (objectEnum) { case ObjectEnum.Marka: var brand = (DataRowView)obje; PRODUCT_BRANDS productBrand; switch (objectIslem) { case ObjectIslem.Ekle: productBrand = new PRODUCT_BRANDS { BRAND_NAME = (string)brand["Marka"] }; _repositoryBrand.Add(productBrand); _uow.SaveChanges(); break; case ObjectIslem.Guncelle: int id = (int)brand["Id"]; productBrand = _repositoryBrand.Get(b => b.BRAND_ID == id); // _dbproductContext.PRODUCT_BRANDS.FirstOrDefault(b => b.BRAND_ID ==id ); productBrand.BRAND_NAME = brand["Marka"].ToString(); _repositoryBrand.Update(productBrand); _uow.SaveChanges(); break; case ObjectIslem.Listele: List <MyGridView> objeList = (from pbs in _repositoryBrand.GetAll() select new MyGridView() { Id = pbs.BRAND_ID, Deger = pbs.BRAND_NAME, kolonAdi = ObjectEnum.Marka.ToString() } ).ToList(); ds = new DataSet(); ds.Tables.Add(GetDataSource(objeList, ObjectEnum.Marka.ToString())); gridControl.DataSource = ds.Tables[0]; break; } break; case ObjectEnum.Model: var model = (DataRowView)obje; PRODUCT_BRANDS_MODEL productBrandsModel; switch (objectIslem) { case ObjectIslem.Ekle: productBrandsModel = new PRODUCT_BRANDS_MODEL { BRAND_ID = iliskiliObjeId, MODEL_NAME = (string)model[objectEnum.ToString()] }; _repositoryModel.Add(productBrandsModel); _uow.SaveChanges(); break; case ObjectIslem.Guncelle: int id = (int)model["Id"]; productBrandsModel = _repositoryModel.Get(b => b.MODEL_ID == id); productBrandsModel.MODEL_NAME = model[objectEnum.ToString()].ToString(); _repositoryModel.Update(productBrandsModel); _uow.SaveChanges(); break; case ObjectIslem.Listele: List <MyGridView> objeList = (from pbs in _repositoryModel.GetAllList() select new MyGridView() { // Id = pbs.BRAND_ID, Id = pbs.MODEL_ID, Deger = pbs.MODEL_NAME, kolonAdi = objectEnum.ToString() } ).ToList(); ds = new DataSet(); ds.Tables.Add(GetDataSource(objeList, objectEnum.ToString())); gridControl.DataSource = ds.Tables[0]; break; } break; case ObjectEnum.Birim: var birim = (DataRowView)obje; SETUP_UNIT setupUnit; switch (objectIslem) { case ObjectIslem.Ekle: setupUnit = new SETUP_UNIT { UNIT = (string)birim[objectEnum.ToString()] }; _repositoryUnit.Add(setupUnit); _uow.SaveChanges(); break; case ObjectIslem.Guncelle: int id = (int)birim["Id"]; setupUnit = _repositoryUnit.Get(b => b.UNIT_ID == id); setupUnit.UNIT = birim[objectEnum.ToString()].ToString(); _repositoryUnit.Update(setupUnit); _uow.SaveChanges(); break; case ObjectIslem.Listele: List <MyGridView> objeList = (from pbs in _repositoryUnit.GetAllList() select new MyGridView() { Id = pbs.UNIT_ID, Deger = pbs.UNIT, kolonAdi = objectEnum.ToString() } ).ToList(); ds = new DataSet(); ds.Tables.Add(GetDataSource(objeList, objectEnum.ToString())); gridControl.DataSource = ds.Tables[0]; break; } break; case ObjectEnum.UrunKategori: var productCat_ = (DataRowView)obje; PRODUCT_CAT productCat; switch (objectIslem) { case ObjectIslem.Ekle: productCat = new PRODUCT_CAT { PRODUCT_CAT1 = (string)productCat_[objectEnum.ToString()], HIERARCHY = "" }; _repositoryPCat.Add(productCat); _uow.SaveChanges(); break; case ObjectIslem.Guncelle: int id = (int)productCat_["Id"]; productCat = _repositoryPCat.Get(b => b.PRODUCT_CATID == id); productCat.PRODUCT_CAT1 = productCat_[objectEnum.ToString()].ToString(); productCat.HIERARCHY = ""; _repositoryPCat.Update(productCat); _uow.SaveChanges(); break; case ObjectIslem.Listele: List <MyGridView> objeList = (from pbs in _repositoryPCat.GetAllList() select new MyGridView() { Id = pbs.PRODUCT_CATID, Deger = pbs.PRODUCT_CAT1, kolonAdi = objectEnum.ToString() } ).ToList(); ds = new DataSet(); ds.Tables.Add(GetDataSource(objeList, objectEnum.ToString())); gridControl.DataSource = ds.Tables[0]; break; } break; } }
public void SetObjectEnum(ObjectEnum enumValue) { m_ProcessWorker.ExecuteWait(SetObjectEnum, enumValue, defaultTimeOut); }
public void WithNullSource_ThrowsArgumentNullException() { ObjectEnum source = null; Assert.Throws <ArgumentNullException>(() => source.CopyPropertiesToNew <ObjectEnum>()); }