How to customize the console applicaton
下面是如何最大化console和改变其显示的字体颜色的代码,顺便包含了计时代码(帮助做性能分析):
class Program
{
[DllImport("kernel32.dll", ExactSpelling = true)]
private static extern IntPtr GetConsoleWindow();
private static IntPtr ThisConsole = GetConsoleWindow(); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); private const int HIDE = ;
private const int MAXIMIZE = ;
private const int MINIMIZE = ;
private const int RESTORE = ; private const int OldestPhaseNo = ; static void Main(string[] args)
{
// Set maximum console windows size
Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight);
ShowWindow(ThisConsole, MAXIMIZE); // Start the time watch
Stopwatch watch = new Stopwatch();
watch.Start(); // Stop the time wattch
Dictionary<string, string> ssqRecords = GetSsQiuRecords().Result;
watch.Stop(); // Change/Set the console's foregound clodr as green
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(watch.Elapsed.TotalSeconds); // Restart the time calculation to 0
watch.Restart();
SaveLotteryDataToLocalConfig(ssqRecords);
watch.Stop(); Console.WriteLine(watch.Elapsed.TotalSeconds);
// Revert back to the default color
Console.ForegroundColor = ConsoleColor.Gray; // Set the display buffer for console window
Console.SetBufferSize(, );
}
}
How to customize the console applicaton的更多相关文章
- Spring Boot ConfigurationProperties validate
使用@Query可以在自定义的查询方法上使用@Query来指定该方法要执行的查询语句,比如:@Query("select o from UserModel o where o.uuid=?1 ...
- Spring Boot Reference Guide
Spring Boot Reference Guide Authors Phillip Webb, Dave Syer, Josh Long, Stéphane Nicoll, Rob Winch, ...
- bin&sbin 命令作用
最近需要了解sbin与bin的功能,需要整理一下.一下全部为Ubuntu14里面默认安装的.在这里收集一下,转载请注明出处! bin bash shell bunzip2 .bz2文件的解压缩程序. ...
- groovyConsole — the Groovy Swing console
1. Groovy : Groovy Console The Groovy Swing Console allows a user to enter and run Groovy scripts. T ...
- JBPM WEB CONSOLE安装实录
http://www.blogjava.net/paulwong/archive/2009/03/13/259551.html JBPM WEB CONSOLE是一个B/S端的,能管理JBPM的流程和 ...
- C# 控制台程序(Console Application )启动后隐藏
背景 前段时间给项目编写了数据适配器,读取其他系统的数据后推送到MQ上,我们的系统通过订阅MQ的方式来获取.由于其他系统支持C#编程,且为了一时方便,选择了C#的控制台程序. 最近用户在使用中,总是不 ...
- Configuring Your EMS Server or EMS Console Server on Windows/Linux
EMS Configuration Files RAD Studio provides the scripts to render the web-browser console, the EMS s ...
- console.log & front-end jobs
console.log & front-end jobs bind & function let log = console.log; let obj = {}; log(obj); ...
- console的高级使用
1.console.table()用来表格化展示数据. var people = { zqz: { name: 'zhaoqize', age: 'guess?' }, wdx: { name: 'w ...
随机推荐
- Unity-Shader-镜面高光Phong&BlinnPhong-油腻的师姐在哪里
[旧博客转移 - 2016年4月4日 13:13 ] 油腻的师姐: 以前玩过一款很火热的端游<剑灵>,剑灵刚出来的时候,某网页游戏广告视频中有句台词:"我不断的在寻找,有你的世界 ...
- 代码托管SVN到Git迁移(使用小乌龟工具)
1.环境信息 Git Server 华为软件开发云 代码托管 SVN Server 本地SVN服务器 Windows Server2012 R2 本地主机 Win ...
- MFC常见问题以及解决方法(2)_Cstring和string互相转换
MFC默认编码是unicode(自己改成多字符集是不行的),对话框中对字符串的处理都是宽字符,而且添加变量会默认是CString类型,当你代码中想用string但又遇到必须转为CString的情况,就 ...
- async 函数
同步 console.log(1); console.log(2); console.log(3); console.log(4); //异步 ajax 文件读取io操作 console.log(1) ...
- 浅谈Nginx负载均衡原理与实现
1.Nginx能做什么? Nginx可以两件事: -- HTTP请求 经过官方测试Nginx可以承受5万的并发量.可用来做静态资源的图片服务器 --负载均衡,如下解释什么是负载均衡. 2.负载均衡 ...
- (转)log4j(四)——如何控制不同风格的日志信息的输出?
一:测试环境与log4j(一)——为什么要使用log4j?一样,这里不再重述 1 老规矩,先来个栗子,然后再聊聊感受 import org.apache.log4j.*; //by godtrue p ...
- 替换Spring Boot 的EnableCaching注解
SpringBoot 中可使用@Cacheable注解来更方便的使用redis,这个注解是通过拦截器工作的,使用了@Cacheable的方法执行时,执行到CglibAopProxy.java中的 Dy ...
- 【HTML】table元素
1.最简单的table <table> <tr> <th></th> </tr> <tr> <td></td& ...
- 给ubuntu的swap分区增加容量
1.创建一个 Swap 文件. mkdir swap cd swap sudo dd if=/dev/zero of=swapfile bs=1024 count=100000 出现下列提示,上面命令 ...
- 八数码问题+路径寻找问题+bfs(隐式图的判重操作)
Δ路径寻找问题可以归结为隐式图的遍历,它的任务是找到一条凑够初始状态到终止问题的最优路径, 而不是像回溯法那样找到一个符合某些要求的解. 八数码问题就是路径查找问题背景下的经典训练题目. 程序框架 p ...