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 ...
随机推荐
- [BZOJ2783/JLOI2012]树 树上倍增
Problem 树 题目大意 给出一棵树,求这个树上的路径的数量,要求路径上的点权和等于s且路径的上每个点深度不同. Solution 这个题目可以用不少方法做. 首先,路径上每个节点的深度不同决定了 ...
- Hihocoder 1325 平衡树·Treap(平衡树,Treap)
Hihocoder 1325 平衡树·Treap(平衡树,Treap) Description 小Ho:小Hi,我发现我们以前讲过的两个数据结构特别相似. 小Hi:你说的是哪两个啊? 小Ho:就是二叉 ...
- IScroll那些事——内容不足时下拉刷新
之前项目中的列表是采用的IScroll,但是在使用IScroll有一个问题就是:当内容不足全屏的时候,是木有办法往下拉的,这样就达不到刷新的目的了.[这是本人工作中遇到的,具体例子具体分析,这里只作一 ...
- laravel+vue组合的项目中引入ueditor(打包成组件形式)
前言:最近写东西需要用到ueditor,并且需要是在vue组件中引入. (本博客默认你已经配置了laravel+vue的项目环境,如果还没有配置好的的小伙伴,可以看看我的另一篇博客,链接: http: ...
- Linux常用命令及shell技巧
这里列出一些个人在工作中常使用的各种linux命令,每一个不详细讲参数,只写经常用的参数.希望快速获得在linux命令行工作的能力的朋友可以看看.本人一直觉的,不使用linux 图形界面,以xshel ...
- Linux基础(七)
一.nfs服务 nfs(Network File System)即网络文件系统,它允许网络中的计算机之间通过TCP/IP网络共享资源.常用于Linux系统之间的文件共享. nfs在文件传送过程中依赖r ...
- Java 9 揭秘(14. HTTP/2 Client API)
Tips 做一个终身学习的人. 在此章中,主要介绍以下内容: 什么是HTTP/2 Client API 如何创建HTTP客户端 如何使HTTP请求 如何接收HTTP响应 如何创建WebSocket的e ...
- [补] windows C socket编程——大物实验预约
注 : 心血来潮,想着把这两年没能记录下来的经历,写一波回忆杀.诚然,有些经历十分复杂繁琐,希望能耐下性子,写出好文章来,可惜一时不能全想起来这两年来的种种,就想起来什么便写什么吧. 时间估摸着是大一 ...
- DL4NLP——词表示模型(三)word2vec(CBOW/Skip-gram)的加速:Hierarchical Softmax与Negative Sampling
上篇博文提到,原始的CBOW / Skip-gram模型虽然去掉了NPLM中的隐藏层从而减少了耗时,但由于输出层仍然是softmax(),所以实际上依然“impractical”.所以接下来就介绍一下 ...
- (转载)Windows 上搭建Apache FtpServer
因工作需要,最近经常接触到FTP,今天我来介绍一个开源的FTP服务器,那就是Apache FTPServer,Apache FTPServer是一个100%纯Java的FTP服务器. 它的设计是基于现 ...