console-application

Setting C# console application location to a secondary screen

倖福魔咒の 提交于 2019-12-23 08:36:20
问题 Overview: I am working on a project which involves a WCF and multiple types of clients. I have created several Test clients and I have a WCF which is hosted in a console app. This results in me having multiple application windows (I currently have 4) when debugging and every time I run them I have to arrange them on multiple screens (I have 2). Question: I wonder is there a way to set a position of Console application to the secondary screen without a need to drag it all the time. 回答1: Move

Vietnamese character in .NET Console Application (UTF-8)

十年热恋 提交于 2019-12-23 08:09:08
问题 I'm trying to write down a UTF-8 string (Vietnamese) into C# Console but no success. I'm running on Windows 7. I tried to use the Encoding class that convert string to char[] to byte[] and then to String, but no help, the string is input directly from the database. Here is some example Tôi tên là Đức, cuộc sống thật vui vẻ tuyệt vời It does not show the special character like Đ or ứ ... instead it show up ? , much worse than with the Encoding class. Does anyone can try this out or know about

Vietnamese character in .NET Console Application (UTF-8)

做~自己de王妃 提交于 2019-12-23 08:08:24
问题 I'm trying to write down a UTF-8 string (Vietnamese) into C# Console but no success. I'm running on Windows 7. I tried to use the Encoding class that convert string to char[] to byte[] and then to String, but no help, the string is input directly from the database. Here is some example Tôi tên là Đức, cuộc sống thật vui vẻ tuyệt vời It does not show the special character like Đ or ứ ... instead it show up ? , much worse than with the Encoding class. Does anyone can try this out or know about

Is is possible to programmatically clear the console history?

前提是你 提交于 2019-12-23 07:59:12
问题 When working with a console application, a history of everything that has been entered at a Console.ReadLine() is stored. When at a console prompt to enter something, pressing the up/down cursor will scroll through this history (and the whole history can be viewed by pressing F7). Using C#, is there are way to either disable this behaviour or clear the history of what has already been entered? To clarify, Console.Clear() does not clear the history, only the screen buffer. I want to clear the

How can I change the icon of a Console App in Visual Studio?

人盡茶涼 提交于 2019-12-23 07:46:31
问题 I am working on C# Console App in VS 2008 and am unable to change the icon file. I changed the icon file in project --> properties --> application tab but still the old icon is displaying with the new build. Checked the below answer from a post to modify the .resx file. But my app has got only one .cs file and the .resx file is empty. Visual Studio, change app icon, how? 回答1: When you change the icon, does your project's Properties window look something like this? Make sure that you recompile

Why is .NET Core handling ReadKey differently on Raspbian?

♀尐吖头ヾ 提交于 2019-12-23 07:36:23
问题 I'm writing a .NET Core console application. I wanted to limit console input to a certain number of maximum characters for each input. I have some code that does this by building a string with Console.ReadKey() instead of Console.ReadLine() Everything worked perfectly testing it on Windows. Then, when I deployed to a Raspberry Pi 3 running Raspbian, I quickly encountered all sorts of problems. I remembered that Linux handles line endings differently from Windows, and it seems backspaces are

Wrap text to the next line when it exceeds a certain length?

社会主义新天地 提交于 2019-12-23 07:09:35
问题 I need to write different paragraphs of text within a certain area. For instance, I have drawn a box to the console that looks like this: /----------------------\ | | | | | | | | \----------------------/ How would I write text within it, but wrap it to the next line if it gets too long? 回答1: Split on last space before your row length? int myLimit = 10; string sentence = "this is a long sentence that needs splitting to fit"; string[] words = sentence.Split(new char[] { ' ' }); IList<string>

Running all files in directory via batch file with appended text on each line

江枫思渺然 提交于 2019-12-23 05:17:59
问题 I'd like to create a batch file that A) Reads all files in the current directory B) Writes all files in the current directory to another batch file C) Appends text to each line (I want to append "/Z /U" (for quiet and norestart respectively) What I have so far: BATCH FILE @echo on @setlocal enableextensions @cd /d "%~dp0" dir /b > installALLTHETHINGS.bat echo /Z /U >> installALLTHETHINGS.bat The output of the batch file is here: OUTPUT exe1.exe bat1.bat installme.msi bat2.bat bat3.bat file

Base Class to handle behavior, customize features, etc in Console Application?

此生再无相见时 提交于 2019-12-23 04:29:49
问题 I have a Console Application like that: public enum TypeMessage : int { Log, Success, Warning, Alert } class Program { static void Main(string[] args) { //do stuff WriteMessage("Sucess .... etc", TypeMessage.Success); } static void WriteMessage(string message, TypeMessage typeMessage = TypeMessage.Log) { switch (typeMessage) { case TypeMessage.Success: Console.ForegroundColor = ConsoleColor.Green; break; case TypeMessage.Warning: Console.ForegroundColor = ConsoleColor.Yellow; break; case

Visual Studio 2010 crashes after pasting simple code?

删除回忆录丶 提交于 2019-12-23 04:21:39
问题 Start by creating a new console application (VB.NET). Paste the following code in Sub Main : Dim AAAAAAAAAAA = BBBBBBB Put the cursor before Sub Main and press Delete key on the keyboard. VS crashes: If the number of A s or B s is less - it won't crash. Same or more - it will. Why? Also, can anyone else reproduce it? I am able to reproduce 100% of the time, on three different workstations, one is Windows 7 x64, another is Windows Server 2012, and also my home PC (Windows 7 x64), where I am