예제 #1
0
		internal static ConsoleControl.CONSOLE_FONT_INFO_EX GetConsoleFontInfo(SafeFileHandle consoleHandle)
		{
			ConsoleControl.CONSOLE_FONT_INFO_EX cONSOLEFONTINFOEX = new ConsoleControl.CONSOLE_FONT_INFO_EX();
			cONSOLEFONTINFOEX.cbSize = Marshal.SizeOf(cONSOLEFONTINFOEX);
			bool currentConsoleFontEx = ConsoleControl.NativeMethods.GetCurrentConsoleFontEx(consoleHandle.DangerousGetHandle(), false, ref cONSOLEFONTINFOEX);
			if (currentConsoleFontEx)
			{
				return cONSOLEFONTINFOEX;
			}
			else
			{
				int lastWin32Error = Marshal.GetLastWin32Error();
				HostException hostException = ConsoleControl.CreateHostException(lastWin32Error, "GetConsoleFontInfo", ErrorCategory.ResourceUnavailable, ConsoleControlStrings.GetConsoleFontInfoExceptionTemplate);
				throw hostException;
			}
		}
예제 #2
0
		internal static void UpdateLocaleSpecificFont()
		{
			bool flag;
			int num = 0x1b5;
			int num1 = 0x3a8;
			int num2 = 0x3b6;
			int consoleCP = ConsoleControl.NativeMethods.GetConsoleCP();
			SafeFileHandle activeScreenBufferHandle = ConsoleControl.GetActiveScreenBufferHandle();
			ConsoleControl.CONSOLE_FONT_INFO_EX consoleFontInfo = ConsoleControl.GetConsoleFontInfo(activeScreenBufferHandle);
			if (consoleCP == num || consoleCP == num1 || consoleCP == num2)
			{
				flag = true;
			}
			else
			{
				flag = false;
			}
			bool flag1 = flag;
			if (!flag1 && consoleFontInfo.cbSize == 84 && consoleFontInfo.FontFace.Equals("Lucida Console", StringComparison.OrdinalIgnoreCase) && consoleFontInfo.FontFamily == 54 && consoleFontInfo.FontHeight == 12 && consoleFontInfo.FontWidth == 7 && consoleFontInfo.FontWeight == 0x190)
			{
				ConsoleControl.CONSOLE_FONT_INFO_EX cONSOLEFONTINFOEX = new ConsoleControl.CONSOLE_FONT_INFO_EX();
				cONSOLEFONTINFOEX.cbSize = Marshal.SizeOf(cONSOLEFONTINFOEX);
				cONSOLEFONTINFOEX.FontFace = "Terminal";
				cONSOLEFONTINFOEX.FontFamily = 48;
				cONSOLEFONTINFOEX.FontHeight = 12;
				cONSOLEFONTINFOEX.FontWidth = 8;
				cONSOLEFONTINFOEX.FontWeight = 0x190;
				cONSOLEFONTINFOEX.nFont = 6;
				bool flag2 = ConsoleControl.NativeMethods.SetCurrentConsoleFontEx(activeScreenBufferHandle.DangerousGetHandle(), false, ref cONSOLEFONTINFOEX);
				if (!flag2)
				{
					int lastWin32Error = Marshal.GetLastWin32Error();
					HostException hostException = ConsoleControl.CreateHostException(lastWin32Error, "SetConsoleFontInfo", ErrorCategory.ResourceUnavailable, ConsoleControlStrings.SetConsoleFontInfoExceptionTemplate);
					throw hostException;
				}
			}
		}