コード例 #1
0
		}   // TestFormatItemCounters


		private static void ListAllErrors ( List<FormatStringError> plstAllErrors )
		{
			const int ORDINAL_FROM_SUBSCRIPT = ArrayInfo.INDEX_FROM_ORDINAL;
			const int POS_LABEL = ArrayInfo.ARRAY_FIRST_ELEMENT;
			const int POS_VALUE = ArrayInfo.ARRAY_SECOND_ELEMENT;
			const char DELIMITER = FormatStringError.LABEL_VALUE_DELIMITER;

			ReportDetail.DetailFormat = "{3}    {0} = {1}";

			int intErrorCount = plstAllErrors.Count;

			for ( int intI = ArrayInfo.ARRAY_FIRST_ELEMENT ;
					  intI < intErrorCount ;
					  intI++ )
			{
				FormatStringError fse = plstAllErrors [ intI ];
				string [ ] astrErrorDetails = fse.Split ( );
				int intNDetails = astrErrorDetails.Length;						// Save a trip into the collection.
				ReportDetails rptDtlsColl = new ReportDetails ( intNDetails );

				string [ ] astrErrorSummaryFirst = new string [ ]
                { 
                    string.Format (
                        Properties.Resources.MSG_FORMAT_ERROR_DETAILS ,			// Format template string
                        FormatItem.XofY (										// Format Item 0
                            intI + ORDINAL_FROM_SUBSCRIPT ,						//		X = Item Number
                            intErrorCount ) )									//		Y = Item Count
                };  // string [ ] astrErrorSummaryFirst

				//  ------------------------------------------------------------
				//  Maybe there is a better way to accompish this. Nevertheless,
				//  this method works for generating a completely blank string
				//  of a length that must be determined at runtime.
				//  ------------------------------------------------------------

				string [ ] astrErrorSummaryAllOthers = new string [ ]
                {
                    string.Empty.PadRight ( astrErrorSummaryFirst [ ArrayInfo.ARRAY_FIRST_ELEMENT ].Length )
                };  // string [ ] astrErrorSummaryAllOthers

				for ( int intJ = ArrayInfo.ARRAY_FIRST_ELEMENT ; intJ < intNDetails ; intJ++ )
				{
					string [ ] astrLabelAndValue = astrErrorDetails [ intJ ].Split ( DELIMITER );
					rptDtlsColl.Add (
						new ReportDetail (
							astrLabelAndValue [ POS_LABEL ].Trim ( ) ,								// Label (Format Item = 0)
							astrLabelAndValue [ POS_VALUE ].Trim ( ) ,								// Value (Format Item = 1) as String
							( ReportDetail.ItemDisplayOrder ) ArrayInfo.OrdinalFromIndex ( intJ ) ,	// Item Number (Format Item = 2) - The arithmetic operation casts it to int (signed), so it must be forcibly cast back to unsigned int.
							null ,																	// Individual Format String (Null = Use Default from static property)
							( intJ == ArrayInfo.ARRAY_FIRST_ELEMENT )								// Additional Details - Condition
								? astrErrorSummaryFirst												//		Value if Condition is True
								: astrErrorSummaryAllOthers ) );									//		Value if Condition is False
				}   // for ( uint uintJ = ArrayInfo.ARRAY_FIRST_ELEMENT ; uintJ < intNDetails ; uintJ++ )

				rptDtlsColl.ListAllItems ( );
			}   // for ( int intI = ArrayInfo.ARRAY_FIRST_ELEMENT ; intI < intErrorCount ; intI++ )
		}   // ListAllErrors