/// <summary> /// Finishes building the current region. /// </summary> /// <exception cref="System.InvalidOperationException"> /// Cannot end a region if nothing is active /// or /// Cannot end a region while a permutation is still active /// </exception> public void EndRegion() { if (_currentRegion == null) throw new InvalidOperationException("Cannot end a region if nothing is active"); if (_currentPermutation != null) throw new InvalidOperationException("Cannot end a region while a permutation is still active"); _model.Regions.Add(_currentRegion); _currentRegion = null; }
/// <summary> /// Begins building a new model region. /// </summary> /// <param name="name">The name stringID.</param> /// <exception cref="System.InvalidOperationException">Cannot begin a new region while another is active</exception> public void BeginRegion(StringId name) { if (_currentRegion != null) throw new InvalidOperationException("Cannot begin a new region while another is active"); _currentRegion = new RenderModel.Region { Name = name, Permutations = new List<RenderModel.Region.Permutation>(), }; }