// Convert this object into a string. public override String ToString() { StringBuilder builder = new StringBuilder(); builder.Append("[PrinterSettings "); builder.Append(PrinterName); builder.Append(" Copies="); builder.Append(Copies.ToString()); builder.Append(" Collate="); builder.Append(Collate.ToString()); builder.Append(" Duplex="); builder.Append(Duplex.ToString()); builder.Append(" FromPage="); builder.Append(FromPage.ToString()); builder.Append(" LandscapeAngle="); builder.Append(LandscapeAngle.ToString()); builder.Append(" MaximumCopies="); builder.Append(MaximumCopies.ToString()); builder.Append(" OutputPort="); builder.Append(ToolkitPrinter.OutputPort.ToString()); builder.Append(" ToPage="); builder.Append(ToPage.ToString()); builder.Append(']'); return(builder.ToString()); }
public ActionResult Create() { var pageModel = new ToPage(); var itemList = this.itemCollection.Find(_ => true).ToList(); pageModel.itemModel.itemFlags = new List <Item.ItemFlags>(); var itemFlagValues = Enum.GetValues(typeof(Item.ItemFlags)).Cast <Item.ItemFlags>(); pageModel.itemModel.itemFlags.AddRange(itemFlagValues); pageModel.itemModel.damageType = new List <Item.DamageType>(); var damageTypeValues = Enum.GetValues(typeof(Item.DamageType)).Cast <Item.DamageType>(); pageModel.itemModel.damageType.AddRange(damageTypeValues); pageModel.itemSelect = itemList; return(this.View(pageModel)); }
public ActionResult Create(ToPage RoomData) { var newRoom = new Room(); newRoom.region = RoomData.roomModel.region; newRoom.area = RoomData.roomModel.area; newRoom.areaId = RoomData.roomModel.areaId; newRoom.title = RoomData.roomModel.title; newRoom.description = RoomData.roomModel.description; Room.Terrain terrain; Enum.TryParse(RoomData.roomModel.terrain.ToString(), out terrain); newRoom.terrain = terrain; newRoom.keywords = new List <RoomObject>(); newRoom.keywords = RoomData.roomModel.keywords; newRoom.exits = new List <Exit>(); if (RoomData.roomModel.exits != null) { foreach (var exit in RoomData.roomModel.exits) { newRoom.exits.Add(exit); } } newRoom.items = new List <Item>(); if (RoomData.roomModel.items != null) { foreach (var item in RoomData.roomModel.items) { newRoom.items.Add(item); } } newRoom.mobs = new List <Player>(); if (RoomData.roomModel.mobs != null) { foreach (var mob in RoomData.roomModel.mobs) { var addMob = new Player(); addMob.Name = mob.Name; addMob.Gender = mob.Gender; addMob.Race = mob.Race; addMob.Description = mob.Description; addMob.SelectedClass = mob.SelectedClass; addMob.Strength = mob.Strength; addMob.Dexterity = mob.Dexterity; addMob.Constitution = mob.Constitution; addMob.Intelligence = mob.Intelligence; addMob.Wisdom = mob.Wisdom; addMob.Charisma = mob.Charisma; addMob.Level = mob.Level; addMob.AlignmentScore = mob.AlignmentScore; addMob.HitPoints = mob.HitPoints; addMob.MaxHitPoints = mob.HitPoints; addMob.ManaPoints = mob.ManaPoints; addMob.MaxManaPoints = mob.ManaPoints; addMob.MovePoints = mob.MovePoints; addMob.MaxMovePoints = mob.MovePoints; addMob.Status = mob.Status; addMob.Gold = mob.Gold; addMob.Silver = mob.Silver; addMob.Copper = mob.Copper; addMob.Inventory = mob.Inventory; newRoom.mobs.Add(addMob); } } newRoom.corpses = new List <Player>(); if (RoomData.roomModel.corpses != null) { foreach (var corpse in RoomData.roomModel.corpses) { var addCorpse = new Player(); addCorpse.Name = corpse.Name; addCorpse.Gender = corpse.Gender; addCorpse.Race = corpse.Race; addCorpse.Description = corpse.Description; addCorpse.SelectedClass = corpse.SelectedClass; addCorpse.Strength = corpse.Strength; addCorpse.Dexterity = corpse.Dexterity; addCorpse.Constitution = corpse.Constitution; addCorpse.Intelligence = corpse.Intelligence; addCorpse.Wisdom = corpse.Wisdom; addCorpse.Charisma = corpse.Charisma; addCorpse.Level = corpse.Level; addCorpse.AlignmentScore = corpse.AlignmentScore; addCorpse.HitPoints = 0; addCorpse.MaxHitPoints = 0; addCorpse.ManaPoints = corpse.ManaPoints; addCorpse.MaxManaPoints = corpse.ManaPoints; addCorpse.MovePoints = corpse.MovePoints; addCorpse.MaxMovePoints = corpse.MovePoints; addCorpse.Status = corpse.Status; addCorpse.Gold = corpse.Gold; addCorpse.Silver = corpse.Silver; addCorpse.Copper = corpse.Copper; addCorpse.Inventory = corpse.Inventory; newRoom.corpses.Add(addCorpse); } } try { this.roomCollection.InsertOne(newRoom); return(RedirectToAction("Index")); } catch { } return(View()); }