Esempio n. 1
0
        private static int Main(string[] args)
        {
            Console.Title = "UDPLauncher_Silent";
            IntPtr hWnd = FindWindow(null, "UDPLauncher_Silent");

            if (hWnd != IntPtr.Zero)
            {
                ShowWindow(hWnd, 0);
            }
            TextWriter writer = new StreamWriter(Environment.CurrentDirectory + @"\log.txt");

            writer.WriteLine("------   UDPLauncher Version 1.0   ------");
            writer.WriteLine("Listening on port: " + Settings.Default.PortToListenTo);
            writer.WriteLine("Launching Program: " + Settings.Default.ProgramToLaunch + "\n");
            writer.Close();
            UDPLaunch launch = new UDPLaunch();

            if (((Settings.Default.PortToListenTo != 0) && (Settings.Default.PortToListenTo <= 0xffff)) && ((Settings.Default.ProgramToLaunch != null) && (Settings.Default.ProgramToLaunch != "")))
            {
                if (!Settings.Default.UseXBMCEvent)
                {
                    launch.UDPListener(Settings.Default.PortToListenTo, Settings.Default.ProgramToLaunch, Settings.Default.ExitIfOpen);
                }
                else
                {
                    launch.UDPListener(Settings.Default.PortToListenTo, Settings.Default.ProgramToLaunch, Settings.Default.ExitIfOpen, Settings.Default.UseXBMCEvent, Settings.Default.XBMCEvent, Settings.Default.XBMC_Server, Settings.Default.XBMC_Port, Settings.Default.XBMC_Username, Settings.Default.XBMC_Password);
                }
            }
            else
            {
                writer.WriteLine("You specified uncorrect settings. I have to terminate, I cannot figure out what you want...terminating");
                launch.IntermiddetError = true;
            }
            if (launch.IntermiddetError)
            {
                return(10);
            }
            return(0);
        }
Esempio n. 2
0
 private static int Main(string[] args)
 {
     Console.Title = "UDPLauncher_Silent";
     IntPtr hWnd = FindWindow(null, "UDPLauncher_Silent");
     if (hWnd != IntPtr.Zero)
     {
         ShowWindow(hWnd, 0);
     }
     TextWriter writer = new StreamWriter(Environment.CurrentDirectory + @"\log.txt");
     writer.WriteLine("------   UDPLauncher Version 1.0   ------");
     writer.WriteLine("Listening on port: " + Settings.Default.PortToListenTo);
     writer.WriteLine("Launching Program: " + Settings.Default.ProgramToLaunch + "\n");
     writer.Close();
     UDPLaunch launch = new UDPLaunch();
     if (((Settings.Default.PortToListenTo != 0) && (Settings.Default.PortToListenTo <= 0xffff)) && ((Settings.Default.ProgramToLaunch != null) && (Settings.Default.ProgramToLaunch != "")))
     {
         if (!Settings.Default.UseXBMCEvent)
         {
             launch.UDPListener(Settings.Default.PortToListenTo, Settings.Default.ProgramToLaunch, Settings.Default.ExitIfOpen);
         }
         else
         {
             launch.UDPListener(Settings.Default.PortToListenTo, Settings.Default.ProgramToLaunch, Settings.Default.ExitIfOpen, Settings.Default.UseXBMCEvent, Settings.Default.XBMCEvent, Settings.Default.XBMC_Server, Settings.Default.XBMC_Port, Settings.Default.XBMC_Username, Settings.Default.XBMC_Password);
         }
     }
     else
     {
         writer.WriteLine("You specified uncorrect settings. I have to terminate, I cannot figure out what you want...terminating");
         launch.IntermiddetError = true;
     }
     if (launch.IntermiddetError)
     {
         return 10;
     }
     return 0;
 }