/// <summary> /// Adds the parameter set name to the parameter set map and returns the /// index. If the parameter set name was already in the map, the index to /// the existing parameter set name is returned. /// </summary> /// /// <param name="parameterSetName"> /// The name of the parameter set to add. /// </param> /// /// <returns> /// The index of the parameter set name. If the name didn't already exist the /// name gets added and the new index is returned. If the name already exists /// the index of the existing name is returned. /// </returns> /// /// <remarks> /// The nextAvailableParameterSetIndex is incremented if the parameter set name /// is added. /// </remarks> /// /// <exception cref="ParsingMetadataException"> /// If more than uint.MaxValue parameter-sets are defined for the command. /// </exception> private int AddParameterSetToMap(string parameterSetName) { int index = -1; if (!String.IsNullOrEmpty(parameterSetName)) { index = _parameterSetMap.IndexOf(parameterSetName); // A parameter set name should only be added once if (index == -1) { if (_nextAvailableParameterSetIndex == uint.MaxValue) { // Don't let the parameter set index overflow ParsingMetadataException parsingException = new ParsingMetadataException( "ParsingTooManyParameterSets", null, Metadata.ParsingTooManyParameterSets); throw parsingException; } _parameterSetMap.Add(parameterSetName); index = _parameterSetMap.IndexOf(parameterSetName); Diagnostics.Assert( index == _nextAvailableParameterSetIndex, "AddParameterSetToMap should always add the parameter set name to the map at the nextAvailableParameterSetIndex"); _nextAvailableParameterSetIndex++; } } return(index); } // AddParameterSetToMap
private int AddParameterSetToMap(string parameterSetName) { int index = -1; if (!string.IsNullOrEmpty(parameterSetName)) { index = this.parameterSetMap.IndexOf(parameterSetName); if (index != -1) { return(index); } if (this.nextAvailableParameterSetIndex == int.MaxValue) { ParsingMetadataException exception = new ParsingMetadataException("ParsingTooManyParameterSets", null, Metadata.ParsingTooManyParameterSets, new object[0]); throw exception; } this.parameterSetMap.Add(parameterSetName); index = this.parameterSetMap.IndexOf(parameterSetName); this.nextAvailableParameterSetIndex++; } return(index); }
private int AddParameterSetToMap(string parameterSetName, CompiledCommandParameter parameter) { int num = -1; if (!string.IsNullOrEmpty(parameterSetName)) { num = this.parameterSetMap.IndexOf(parameterSetName); if (num == -1) { if (this.nextAvailableParameterSetIndex == uint.MaxValue) { ParsingMetadataException metadataException = new ParsingMetadataException("ParsingTooManyParameterSets", (Exception)null, "Metadata", "ParsingTooManyParameterSets", new object[0]); MergedCommandParameterMetadata.tracer.TraceException((Exception)metadataException); throw metadataException; } this.parameterSetMap.Add(parameterSetName); num = this.parameterSetMap.IndexOf(parameterSetName); ++this.nextAvailableParameterSetIndex; } MergedCommandParameterMetadata.tracer.WriteLine("ParameterSet: {0} Added At: {1}", (object)parameterSetName, (object)num); } return(num); }
private int AddParameterSetToMap(string parameterSetName) { int index = -1; if (!string.IsNullOrEmpty(parameterSetName)) { index = this.parameterSetMap.IndexOf(parameterSetName); if (index != -1) { return index; } if (this.nextAvailableParameterSetIndex == int.MaxValue) { ParsingMetadataException exception = new ParsingMetadataException("ParsingTooManyParameterSets", null, Metadata.ParsingTooManyParameterSets, new object[0]); throw exception; } this.parameterSetMap.Add(parameterSetName); index = this.parameterSetMap.IndexOf(parameterSetName); this.nextAvailableParameterSetIndex++; } return index; }
/// <summary> /// Adds the parameter set name to the parameter set map and returns the /// index. If the parameter set name was already in the map, the index to /// the existing parameter set name is returned. /// </summary> /// /// <param name="parameterSetName"> /// The name of the parameter set to add. /// </param> /// /// <returns> /// The index of the parameter set name. If the name didn't already exist the /// name gets added and the new index is returned. If the name already exists /// the index of the existing name is returned. /// </returns> /// /// <remarks> /// The nextAvailableParameterSetIndex is incremented if the parameter set name /// is added. /// </remarks> /// /// <exception cref="ParsingMetadataException"> /// If more than uint.MaxValue parameter-sets are defined for the command. /// </exception> private int AddParameterSetToMap(string parameterSetName) { int index = -1; if (!String.IsNullOrEmpty(parameterSetName)) { index = _parameterSetMap.IndexOf(parameterSetName); // A parameter set name should only be added once if (index == -1) { if (_nextAvailableParameterSetIndex == uint.MaxValue) { // Don't let the parameter set index overflow ParsingMetadataException parsingException = new ParsingMetadataException( "ParsingTooManyParameterSets", null, Metadata.ParsingTooManyParameterSets); throw parsingException; } _parameterSetMap.Add(parameterSetName); index = _parameterSetMap.IndexOf(parameterSetName); Diagnostics.Assert( index == _nextAvailableParameterSetIndex, "AddParameterSetToMap should always add the parameter set name to the map at the nextAvailableParameterSetIndex"); _nextAvailableParameterSetIndex++; } } return index; } // AddParameterSetToMap