console-application

InvalidOperationException: The Undo operation encountered a context that is different from what was applied in the corresponding Set operation

半城伤御伤魂 提交于 2019-12-07 04:03:47
问题 I got the following exception: Exception Type: System.InvalidOperationException Exception Message: The Undo operation encountered a context that is different from what was applied in the corresponding Set operation. The possible cause is that a context was Set on the thread and not reverted(undone). Exception Stack: at System.Threading.SynchronizationContextSwitcher.Undo() at System.Threading.ExecutionContextSwitcher.Undo() at System.Threading.ExecutionContext.runFinallyCode(Object userData,

How do I set the position of the mouse cursor from a Console app in C#?

自作多情 提交于 2019-12-07 03:38:43
问题 I've found many articles on how to set the mouse position in a C# windows forms project - I want to do this in a console application. How can I set the absolute mouse position from a C# windows console application? Thanks! Hint: it's not Console.setCursorPosition, that only sets the position of the text cursor in the console. 回答1: Inside your console application, add a reference to System.Windows.Forms.dll and use the other techniques you've read about. The choice of console vs windows exe

Starting a console application from asp.net using authenticated user credentials

烂漫一生 提交于 2019-12-07 02:47:20
I have the following asynchronous controller actions which allows me to start a console application on a remote server. My issue is with regards to the permissions and authentication. I have tried the following, which in my understanding allows the app.Start(valuationDate) to run as the impersonated user . The reason for this is that the console application needs to access network resources and the user of this web app will have the required access rights. (As a side note, the console app runs as a scheduled task without error) The issue I suspect is that the console app is still run under the

Interactive console programming for c/c++?

≡放荡痞女 提交于 2019-12-07 01:19:52
问题 So I've written a small program which takes in commands by the users, and then displays the output (after connecting to a server). It's an interactive console of sorts. However, after using the mongodb and redis command-line clients (which work interactively on the console/terminal), it seems that there must be a library somewhere which provides functionalities such as recording user inputs, accepting up/down keypresses to browse through command history, as well as tab completion framework

How do I get file paths of items dropped onto a console application window?

北城余情 提交于 2019-12-06 23:47:22
问题 I'd like to be able to let users drag and drop files onto my console app's window so they are not forced to drag'n'drop files onto the app's icon (or link, or even worse write a command line in console). How do I get the list of paths of files I drop onto my app's window? 回答1: You can just listen for the keyboard. When dragging a file onto a console window the window gets keyboard events as if the file name was entered directly. That's how you can drop a file on a cmd or PowerShell window and

Entity Framework References go missing between debug and release build

吃可爱长大的小学妹 提交于 2019-12-06 23:04:34
问题 There must be something that I don't understand in the difference between debug builds and release builds and its use of references. I'm using Entity Framework 6 to connect to a database that has previously been set up. I am able to successfully build and run the project while it is in Debug mode. If I change it to release mode I instantly get build errors indicating that the namespaces and types that were just there can no longer be found. I checked and as far as I can tell they both target

How to escape path containing spaces

一个人想着一个人 提交于 2019-12-06 21:54:41
问题 To pass a path with spaces to .NET console application you should escape it. Probably not escape but surround with double quotes: myapp.exe --path C:\Program Files\MyApp` becomes new string[] { "--path", "C:\Program", "Files\MyApp" } but myapp.exe --path "C:\Program Files\MyApp" becomes new string[] { "--path", "C:\Program Files\MyApp" } and it works fine and you can parse that easily. I want to extend the set of parameters given with an addition one and start a new process with the resulting

c++ set console text color to RGB value

好久不见. 提交于 2019-12-06 20:56:33
I want to set the text color of the console to a RGB color. I created a function to get the ColorTable of the console and change the colors in it, but it doesn't work. I don't know how to set the text color to a value from the color table so I just change the whole color table, but it doesn't do anything. void setColor(int r, int g, int b) { COLORREF cr; cr = RGB(r, g, b); PCONSOLE_SCREEN_BUFFER_INFOEX ci; CONSOLE_SCREEN_BUFFER_INFOEX cir; ci = &cir; HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); GetConsoleScreenBufferInfoEx(hConsole , ci); cout <<hex<< ci->ColorTable[2]; for(int i=0;i<16

ASP.NET Authorization from Console Application & Timeout

我的梦境 提交于 2019-12-06 17:07:47
问题 For what its worth, I managed to get a console application to authenticate itself with an existing ASP.NET web application. It just mimics the login page by making a post request to the login page containing the viewstate information (just as if a browser had made the request). It then catches the cookie sent back in response in a CookieContainer. The application then goes on to make multiple requests to the same page (which requires authorization). The page does some work and writes out a

how can I embed an assembly into a console application without ILMerge?

怎甘沉沦 提交于 2019-12-06 16:56:57
There are a lot of posts on here about this, I'm using this code from another SO post and placing a delegate assignation in my Main() method. None of the other posts have directly answered my question. I've got my third party assembly embedded as a resource but when I fire up the app: I'm getting a TypeInitializationException with an inner of FileNotFoundException. It's trying to find the assembly on the file system and failing. it's never getting to the Main method, where the event handler for AssemblyResolve is assigned I have two assembly refs that are embedded in my Resources.resx, one is