public void Lockdown(PrisonRules prisonRules) { if (this.isLocked) { throw new InvalidOperationException("This prison is already locked."); } this.prisonRules = prisonRules; if (prisonRules.CellType != CellType.None) { foreach (Type cellType in cellTypes) { Cell cell = (Cell)cellType.GetConstructor(Type.EmptyTypes).Invoke(null); if (CellEnabled(cell.GetFlag())) { prisonCells.Add(cell); } } } // Create the Windows User this.user = new PrisonUser(this.Tag); this.user.Create(); // Create the JobObject this.jobObject = new JobObject(this.user.Username); this.jobObject.KillProcessesOnJobClose = true; // Lock all cells foreach (Cell cell in this.prisonCells) { cell.Lockdown(this); } this.isLocked = true; }
public void Lockdown(PrisonRules prisonRules) { if (this.isLocked) { throw new InvalidOperationException("This prison is already locked."); } this.prisonRules = prisonRules; if (prisonRules.CellType != CellType.None) { foreach (Type cellType in cellTypes) { Cell cell = (Cell)cellType.GetConstructor(Type.EmptyTypes).Invoke(null); if (CellEnabled(cell.GetFlag())) { prisonCells.Add(cell); } } } // Create the Windows User this.user = new PrisonUser(this.Tag); this.user.Create(); // Create the JobObject this.jobObject = new JobObject(this.user.Username); this.jobObject.KillProcessesOnJobClose = true; // Lock all cells foreach (Cell cell in this.prisonCells) { cell.Lockdown(this); } this.isLocked = true; }