private DALNewNUBE.EntityType EntityType(string Type) { DALNewNUBE.EntityType et = EntityTypeList.Where(x => x.Entity == Type).FirstOrDefault(); if (et == null) { et = new DALNewNUBE.EntityType(); dbNew.EntityTypes.Add(et); EntityTypeList.Add(et); et.Entity = Type; } return(et); }
private int EntityTypeId(string Type) { DAL.EntityType et = EntityTypeList.Where(x => x.Entity == Type).FirstOrDefault(); if (et == null) { et = new DAL.EntityType(); DB.EntityTypes.Add(et); EntityTypeList.Add(et); et.Entity = Type; DB.SaveChanges(); } return(et.Id); }
public override void Load(System.IO.BinaryReader r, uint id) { base.Load(r, id); LoadCategory = r.ReadString(); int length = r.ReadInt32(); for (int i = 0; i < length; i++) { EntityTypeList.Add(Type.GetType(r.ReadString())); } length = r.ReadInt32(); for (int i = 0; i < length; i++) { ExcludedEntityTypeList.Add(Type.GetType(r.ReadString())); } }
public void RefreshEntities(Document doc) { if (doc == null) { return; } EntityTypeList.BeginUpdate(); var selEnt = EntityTypeList.SelectedItem as GameDataObject; EntityTypeList.Items.Clear(); var sel = selEnt == null ? null : selEnt.Name; var def = doc.Game.DefaultPointEntity; GameDataObject reselect = null, redef = null; foreach (var gdo in doc.GameData.Classes.Where(x => x.ClassType == ClassType.Point).OrderBy(x => x.Name.ToLowerInvariant())) { EntityTypeList.Items.Add(gdo); if (String.Equals(sel, gdo.Name, StringComparison.OrdinalIgnoreCase)) { reselect = gdo; } if (String.Equals(def, gdo.Name, StringComparison.OrdinalIgnoreCase)) { redef = gdo; } } if (reselect == null && redef == null) { redef = doc.GameData.Classes .Where(x => x.ClassType == ClassType.Point) .OrderBy(x => x.Name.StartsWith("info_player_start") ? 0 : 1) .FirstOrDefault(); } EntityTypeList.SelectedItem = reselect ?? redef; EntityTypeList.EndUpdate(); }