console-application

Unable to delete some files via System.IO.File in C# console app

两盒软妹~` 提交于 2020-01-06 15:11:32
问题 I am encrypting some text files. It works fine the file is encypted, however on occasion I get this error when attempting to delete the original unencrypted file: System.IO.IOException: The process cannot access the file 'MyFile.TXT' because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.Delete(String path) at FileEncryption.Program.DeleteFile(String sInputFilename) in FileEncryption\Program.cs:line 159 This seems

Using a Console App to Extract a data from sharepoint list

痴心易碎 提交于 2020-01-06 14:38:27
问题 I have been searching for hours about the best way to do this and all I find is massively conflicting information and im at the point of breaking down. I have a sharepoint 2013 site which naturally has a list on. I wish to connect to this list and extract the information into a data table. shouldn't be that hard should it... So options I have tried, I was originally planning on ssis to pull the information and transform it prior to its final destination. There is a great little adapter

C# OpenTK - Linux Console without X11

瘦欲@ 提交于 2020-01-06 13:08:05
问题 I was just wondering if it is possible to render the OpenTK gamewindow in a Linux Console (Raspberry Pi Raspbian) without any X11 Desktop? If it possible, how do you do it? 回答1: Yes, it's experimental since 1.1 or 1.2. Adjust OpenTK.dll.config if some dll could not be found, and maybe you'll have to find correct libinput version ( libinput-0.2.0 is working on my debian) to match api binding in opentk. I'm not fully sure, but I think that it's only working with modern GL (>3.0). Ensure you

How to change Cursor position in Console?

帅比萌擦擦* 提交于 2020-01-06 09:56:31
问题 I wanted to use Console.ReadLine(); in the previous line and make it display like that: HeresomeText>(input) Not like HeresomeText> (input) Is it possible to do? 回答1: use Write method instead of WriteLine Method: Console.Write("HeresomeText> ") in addition you can use SetCursorPosition: Console.SetCursorPosition(int left, int right); 回答2: Absolutely - look at the various members of the System.Console class. In particular, you want the SetCursorPosition method, but if you're writing a "fancy"

Pipe console.writeLine() messages to a text file

感情迁移 提交于 2020-01-06 04:08:27
问题 I wonder what the best approach is in implementing a logger which essentially eats all Console.WriteLine() messages and spits out a text file of all these messages. I know I could use a StringBuilder and populate it with all the messages by doing .AppendLine wherever Console.WriteLine occurs...but I am looking for something more magical than that. Some way using which I don't have to write as many lines of code as Console.WriteLine s in existing code. And in case you missed the tags, this is

C# - How to Properly Indent String Data with Tabs?

纵然是瞬间 提交于 2020-01-06 03:49:06
问题 In my C# Console program I have 4 variables. Their names and types are as follows: int ID bool Status bool Available int Count I would like to be able to print them to the Console, nicely indented as follows: However, when I use the tabs "\t", to format my string, it does not take into account the text width, and all the values are indented waywardly as follows: How do I fix this? I don't want to use any third party libraries, but simply .NET functionality such as String.Format(). 回答1: You

C# fibonacci function returning errors

拈花ヽ惹草 提交于 2020-01-05 03:34:46
问题 I am practising a C# console application, and I am trying to get the function to verify if the number appears in a fibonacci series or not but I'm getting errors. What I did was: class Program { static void Main(string[] args) { System.Console.WriteLine(isFibonacci(20)); } static int isFibonacci(int n) { int[] fib = new int[100]; fib[0] = 1; fib[1] = 1; for (int i = 2; i <= 100; i++) { fib[i] = fib[i - 1] + fib[i - 2]; if (n == fib[i]) { return 1; } } return 0; } } Can anybody tell me what am

Using GUI for console input and outputin java

孤街醉人 提交于 2020-01-04 09:54:34
问题 How would I output console information to a GUI? I have a application that has a GUI up till I have the user move within directories similar to the CLI in linux. So how would I port the output and input from a console into a GUI. Would JPanel be the way to go or something else? 回答1: Technically, if you wanted to, you could use JTextArea to accomplish this. Instead of writing to the console what you'd normally write, such as some information telling the programmer that something was successful

app.config modify value c#

旧街凉风 提交于 2020-01-03 16:59:40
问题 The question is addressed here App.Config change value The accepted answer is string appPath = System.IO.Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly().Location); string configFile = System.IO.Path.Combine(appPath, "App.config"); ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap(); configFileMap.ExeConfigFilename = configFile; System.Configuration.Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel

C# Changing sytem locale

和自甴很熟 提交于 2020-01-03 10:30:27
问题 Need to change the system locale to a different country, I have tried SystemParametersInfo(), GetKeyboardLayout() which didn't help. How would I change the system locale in C# for a console application? 回答1: You can use SetLocalInfo. [DllImport("kernel32.dll")] static extern bool SetLocaleInfo(uint Locale, uint LCType, string lpLCData); 回答2: e.g., Thread.CurrentThread.CurrentCulture = new CultureInfo("es-AR"); // Espanol - Argentina Thread.CurrentThread.CurrentUICulture = new CultureInfo("es