Processing
 

C# Mono Console.ReadLine quitting

21/04/2013 07:28#1

Georgi-it

Member

Joined at: 10 months ago

Post: 2

Thank: 0

Thanked: 0

I am building an application with MONO (C#) on linux mint 14 but i have some issues. I have enabled external console in the options and while debugging it's working quite well but after deploying ( openning the .exe in debug folder) the application quits immediately after the Console.ReadLine(); Any ideas guys ?

public static void InitializeUI()          {             Console.WriteLine("On the bottom line enter the command \"START\" followed by a space and a number representing on how many hours to check for new posts. You can always stop the execution with Ctrl+C \r\n \r\nExample : START 6");             ParseCMD();             Console.ReadLine ();         }         private static void ParseCMD()         {             string cmd = Console.ReadLine();             string[] commands = cmd.Trim().Split(new string[] {" "},StringSplitOptions.RemoveEmptyEntries);             int delay = 0;             if (commands[0].ToLower() == "start" && int.TryParse(commands[1],out delay))             {                 MainLogic.StartLogic(delay);             }             else             {                 Console.WriteLine("Wrong command");                 ParseCMD();             }         } 

quits after the

string cmd = Console.ReadLine(); 
16/08/2016 14:38Top#2

Joined at: 9 months ago

Post: 2

Thank: 0

Thanked: 0

    public static void Main(string[] args)     {         Console.WriteLine("On the bottom line enter the command \"START\" followed by a space and a number representing on how many hours to check for new posts. You can always stop the execution with Ctrl+C \r\n \r\nExample : START 6");           if(!ParseCMD(readKeey()))         {             ParseCMD(readKeey());         }      }private static string readKeey()     {         ConsoleKeyInfo cki;         Console.TreatControlCAsInput = true;          string temp="";         do         {             cki = Console.ReadKey();             temp=temp+cki.KeyChar;          } while (cki.Key != ConsoleKey.Enter);         return temp;     }      private static bool ParseCMD(string text)     {         try{             string cmd = text;             string[] commands = cmd.Trim().Split(new string[] {" "},StringSplitOptions.RemoveEmptyEntries);             int delay = 0;             if (commands[0].ToLower() == "start" && int.TryParse(commands[1],out delay))             {                 Console.WriteLine("Right command you enter:" + commands[0] + commands[1]);                 return true;             }             else             {                 Console.WriteLine("Wrong command");                  return false;             }         }         catch(Exception ex)         {             Console.WriteLine("ex.Message:"+ex.Message);             return false;         }     } }} 

I guess it is nothing about Mono, could you please try Console.ReadKey() instead.

Similar articles

Non-interactive method for dpkg-reconfigure tzdata

5 years ago - Reply: 3 - Views: 140

monit is not able to read mongod.lock

2 years ago - Reply: 3 - Views: 138

Ubuntu: hadoop command not found

2 years ago - Reply: 4 - Views: 244

C# Mono Console.ReadLine quitting

4 years ago - Reply: 1 - Views: 87

linking jsoncpp on Ubuntu

2 years ago - Reply: 1 - Views: 5

Build artifacts over ssh jenkins - PHP

2 years ago - Reply: 1 - Views: 37

Can't load Metasploit after installation

2 years ago - Reply: 5 - Views: 212

Selenium FirefoxDriver in Headless get error

2 years ago - Reply: 1 - Views: 96

Unable to start MongoDB. ERROR: addr already in use

2 years ago - Reply: 2 - Views: 118

ZSH Agnoster Theme showing machine name

2 years ago - Reply: 4 - Views: 248

Unable to start firefox browser with jenkins user

2 years ago - Reply: 2 - Views: 110

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re