コード例 #1
0
		internal static void ASCII_Table_Gen ( )
		{
			Console.WriteLine (
				Properties.Resources.IDS_ASCII_TABLE_PREAMBLE ,					// Print this message above both tables.
				Environment.NewLine );                                          // Format Item 0 = Embedded Newline

			Console.WriteLine (
				Properties.Resources.IDS_ASCII_TABLE_CHARACTER_PROPERTIES ,		// Print this message above the first table.
				Environment.NewLine );                                          // Format Item 0 = Embedded Newline
			string strDetailFormatTemplate = Properties.Resources.IDS_ASCII_CHARACTER_INFO;

			for ( int intCharacterIndex = ARRAY_FIRST_ELEMENT ;
				      intCharacterIndex <= byte.MaxValue ;
					  intCharacterIndex++ )
			{
				Console.WriteLine (
					strDetailFormatTemplate ,                                   // Format control string
					intCharacterIndex ,                                         // Format Item 0: Character index {0}
					ASCIICharacterDisplayInfo.DisplayCharacterInfo (            // Format Item 1: : {1}
						( char ) intCharacterIndex ) );                         // Cast the integer to its char equivalent.
			}   // for ( int intCharacterIndex = ARRAY_FIRST_ELEMENT ; intCharacterIndex <= byte.MaxValue ; intCharacterIndex++ )

			Console.WriteLine (
				Properties.Resources.IDS_ASCII_TABLE_ENUMERATION ,              // Print this message between the two tables.
				Environment.NewLine );                                          // Format Item 0 = Embedded Newline

			ASCII_Character_Display_Table asciiShowMan = ASCII_Character_Display_Table.GetTheSingleInstance ( );
			strDetailFormatTemplate = Properties.Resources.IDS_ASCII_TABLE_ITEM;

			foreach ( ASCIICharacterDisplayInfo asciiInfo in asciiShowMan.AllASCIICharacters )
			{
				Console.WriteLine (
					strDetailFormatTemplate ,                                   // Format control string, read above the loop
					new object [ ]
					{
						asciiInfo.CodeAsDecimal ,								// Format Item 0 = Decimal code of character
						asciiInfo.CodeAsHexadecimal ,							// Format Item 1 = Hexadecimal representation of character code
						asciiInfo.DisplayText ,									// Format Item 2 = Character as displayed, or substitute for characters that won't print anything usable
						string.IsNullOrEmpty ( asciiInfo.Comment )				// Format Item 3 = Comment, if present, else nothing			
							? string.Empty										//		Since there is no comment, show nothing.
							: string.Concat (									//		Comments get wrapped in parentheses, and separated by a space.
								" (" ,											//		Leading space and left parenthesis
								asciiInfo.Comment ,								//		Comment from XML document
								")" )											//		Right parenthesis
					} );
			}   // foreach ( ASCIICharacterDisplayInfo asciiInfo in asciiShowMan.AllASCIICharacters )
		}	// ASCII_Table_Gen
コード例 #2
0
		internal static void ASCII_Table_Gen ( )
		{
			StreamWriter swAsciiTableLists = null;

			try
			{
				swAsciiTableLists = GetAsciiTableListFileHandle ( );

				Console.WriteLine (
					Properties.Resources.IDS_ASCII_TABLE_PREAMBLE ,             // Print this message above both tables.
					Environment.NewLine );                                      // Format Item 0 = Embedded Newline
				swAsciiTableLists.WriteLine (
					Properties.Resources.IDS_ASCII_TABLE_PREAMBLE ,             // Print this message above both tables.
					Environment.NewLine );                                      // Format Item 0 = Embedded Newline

				Console.WriteLine (
					Properties.Resources.IDS_ASCII_TABLE_CHARACTER_PROPERTIES , // Print this message above the first table.
					Environment.NewLine );                                      // Format Item 0 = Embedded Newline
				swAsciiTableLists.WriteLine (
					Properties.Resources.IDS_ASCII_TABLE_CHARACTER_PROPERTIES , // Print this message above the first table.
					Environment.NewLine );                                      // Format Item 0 = Embedded Newline

				string strDetailFormatTemplate = Properties.Resources.IDS_ASCII_CHARACTER_INFO;
				string strDisplayInfoTemplate = Properties.Resources.MSG_ASCII_TABLE_DETAIL;

				try
				{
					ASCII_Character_Display_Table aSCII_Character_Display_Table = ASCII_Character_Display_Table.GetTheSingleInstance ( );

					for ( int intJ = ArrayInfo.ARRAY_FIRST_ELEMENT ;
							  intJ < aSCII_Character_Display_Table.AllASCIICharacters.Length ;
							  intJ++ )
					{
						ASCIICharacterDisplayInfo displayInfo = aSCII_Character_Display_Table.AllASCIICharacters [ intJ ];
						Console.WriteLine (
							strDisplayInfoTemplate ,							// Format Control String
							intJ ,                                              // Format Item 0: Character {0:-3}: Numerical
							displayInfo.CodeAsDecimal ,                         // Format Item 1: Numerical Value = {1,3} (
							displayInfo.CodeAsHexadecimal ,                     // Format Item 2: ({2} hex),
							displayInfo.DisplayText ,                           // Format Item 3: Display Value = {3}
							displayInfo.HTMLName );                             // Format Item 4: HTML Entity = {4}
						swAsciiTableLists.WriteLine (
							strDisplayInfoTemplate ,                            // Format Control String
							intJ ,                                              // Format Item 0: Character {0:-3}: Numerical
							displayInfo.CodeAsDecimal ,                         // Format Item 1: Numerical Value = {1,3} (
							displayInfo.CodeAsHexadecimal ,                     // Format Item 2: ({2} hex),
							displayInfo.DisplayText ,                           // Format Item 3: Display Value = {3}
							displayInfo.HTMLName );                             // Format Item 4: HTML Entity = {4}
					}   // for ( int intJ = ArrayInfo.ARRAY_FIRST_ELEMENT ; intJ < aSCII_Character_Display_Table.AllASCIICharacters.Length ; intJ++ )
				}
				catch ( Exception exAll )
				{
					Program.s_smTheApp.AppExceptionLogger.ReportException ( exAll );
				}

				Console.WriteLine (
					Properties.Resources.IDS_ASCII_TABLE_ENUMERATION ,          // Print this message between the two tables.
					Environment.NewLine );                                      // Format Item 0 = Embedded Newline
				swAsciiTableLists.WriteLine (
					Properties.Resources.IDS_ASCII_TABLE_ENUMERATION ,          // Print this message between the two tables.
					Environment.NewLine );                                      // Format Item 0 = Embedded Newline

				ASCII_Character_Display_Table asciiShowMan = ASCII_Character_Display_Table.GetTheSingleInstance ( );
				strDetailFormatTemplate = Properties.Resources.IDS_ASCII_TABLE_ITEM;

				foreach ( ASCIICharacterDisplayInfo asciiInfo
						  in asciiShowMan.AllASCIICharacters )
				{
					Console.WriteLine (
						strDetailFormatTemplate ,                               // Format control string, read above the loop
						new object [ ]
						{
							asciiInfo.CodeAsDecimal ,							// Format Item 0: Character {0} (
							asciiInfo.CodeAsHexadecimal ,						// Format Item 1: ({1}): Display
							asciiInfo.URLEncoding ,								// Format Item 2: URL Encoding = {2}
							asciiInfo.DisplayText ,								// Format Item 3: Display Value = {3}
							string.IsNullOrEmpty ( asciiInfo.Comment )			// Format Item 4: Comment, if present, else nothing
								? string.Empty									//		Since there is no comment, show nothing.
								: string.Concat (								//		Comments get wrapped in parentheses and separated by a space.
									SpecialCharacters.SPACE_CHAR ,				//		Leading space 
									SpecialCharacters.PARENTHESIS_LEFT ,		//      and left parenthesis
									asciiInfo.Comment ,							//		Comment from document
									SpecialCharacters.PARENTHESIS_RIGHT )       //		Right parenthesis
						} );
					swAsciiTableLists.WriteLine (
						strDetailFormatTemplate ,                               // Format control string, read above the loop
						new object [ ]
						{
							asciiInfo.CodeAsDecimal ,							// Format Item 0: Character {0} (
							asciiInfo.CodeAsHexadecimal ,						// Format Item 1: ({1}): Display
							asciiInfo.URLEncoding ,								// Format Item 2: URL Encoding = {2}
							asciiInfo.DisplayText ,								// Format Item 3: Display Value = {3}
							string.IsNullOrEmpty ( asciiInfo.Comment )			// Format Item 4: Comment, if present, else nothing
								? string.Empty									//		Since there is no comment, show nothing.
								: string.Concat (								//		Comments get wrapped in parentheses and separated by a space.
									SpecialCharacters.SPACE_CHAR ,				//		Leading space 
									SpecialCharacters.PARENTHESIS_LEFT ,		//      and left parenthesis
									asciiInfo.Comment ,							//		Comment from document
									SpecialCharacters.PARENTHESIS_RIGHT )       //		Right parenthesis
						} );
				}   // foreach ( ASCIICharacterDisplayInfo asciiInfo in asciiShowMan.AllASCIICharacters )

				swAsciiTableLists.Close ( );
				swAsciiTableLists.Dispose ( );
				swAsciiTableLists = null;
			}
			catch ( Exception exAll )
			{
				Program.s_smTheApp.AppExceptionLogger.ReportException ( exAll );
			}
        }   // ASCII_Table_Gen