示例#1
0
        static void Main(string[] args)
        {
            if (args.Length == 0 || (args.Length & 1)==1)
            {
                Usage();
                return;
            }

            runningWatchers = new Thread[args.Length / 2];

            for(int i=0;i<args.Length/2;i++){
                StartAndWatch(args[i*2], args[i*2+1], ref runningWatchers[i]);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            SysTrayContext stContext = new SysTrayContext();
            Application.Run(stContext);
        }
示例#2
0
        static void Main(string[] args)
        {
            if(args.Length <= 1) {
            Usage();
            return;
              }

              // yeah this is lame.
              // miss single file header style libraries,
              // too lazy to figure out how to do chained library for c#
              // will regret probably
              int watchFileDelay = 60;
              int startProgramList = args.Length;
              for(int pArg = 0; pArg < args.Length; pArg++) {

            if(!args[pArg].StartsWith("--")) {
              startProgramList = pArg;
              break;
            } else if(args[pArg].StartsWith("--watch_file=", StringComparison.CurrentCultureIgnoreCase)) {
              _watchFileName = args[pArg].Substring("--watch_file=".Length);
            } else if(args[pArg].StartsWith("--watch_file_seconds=", StringComparison.CurrentCultureIgnoreCase)) {
              string numSeconds = args[pArg].Substring("--watch_file_seconds=".Length);
              _watchFileSeconds = Int32.Parse(numSeconds);
            } else if(args[pArg].StartsWith("--watch_file_delay=", StringComparison.CurrentCultureIgnoreCase)) {
              string numSeconds = args[pArg].Substring("--watch_file_delay=".Length);
              watchFileDelay = Int32.Parse(numSeconds);
            }
              }

              int numPrograms = (args.Length - startProgramList) / 2;

              if(numPrograms <= 0) {
            Usage();
            return;
              }

              _runningWatchers = new Thread[numPrograms];
              _runningProcessNames = new string[numPrograms];

              for(int p = 0; p < numPrograms; p++) {
            int programIndex = startProgramList + (p * 2);
            _runningProcessNames[p] = System.IO.Path.GetFileNameWithoutExtension(args[programIndex]);
            StartAndWatch(args[programIndex], args[programIndex + 1], ref _runningWatchers[p]);
              }

              if(_watchFileName.Length > 2) {
            StartFileWatch(watchFileDelay);
              }

              Application.EnableVisualStyles();
              Application.SetCompatibleTextRenderingDefault(false);
              SysTrayContext stContext = new SysTrayContext();
              Application.Run(stContext);
        }
示例#3
0
        static void Main(string[] args)
        {
            if (args.Length <= 1)
            {
                Usage();
                return;
            }

            // yeah this is lame.
            // miss single file header style libraries,
            // too lazy to figure out how to do chained library for c#
            // will regret probably
            int watchFileDelay   = 60;
            int startProgramList = args.Length;

            for (int pArg = 0; pArg < args.Length; pArg++)
            {
                if (!args[pArg].StartsWith("--"))
                {
                    startProgramList = pArg;
                    break;
                }
                else if (args[pArg].StartsWith("--watch_file=", StringComparison.CurrentCultureIgnoreCase))
                {
                    _watchFileName = args[pArg].Substring("--watch_file=".Length);
                }
                else if (args[pArg].StartsWith("--watch_file_seconds=", StringComparison.CurrentCultureIgnoreCase))
                {
                    string numSeconds = args[pArg].Substring("--watch_file_seconds=".Length);
                    _watchFileSeconds = Int32.Parse(numSeconds);
                }
                else if (args[pArg].StartsWith("--watch_file_delay=", StringComparison.CurrentCultureIgnoreCase))
                {
                    string numSeconds = args[pArg].Substring("--watch_file_delay=".Length);
                    watchFileDelay = Int32.Parse(numSeconds);
                }
            }

            int numPrograms = (args.Length - startProgramList) / 2;

            if (numPrograms <= 0)
            {
                Usage();
                return;
            }

            _runningWatchers     = new Thread[numPrograms];
            _runningProcessNames = new string[numPrograms];

            for (int p = 0; p < numPrograms; p++)
            {
                int programIndex = startProgramList + (p * 2);
                _runningProcessNames[p] = System.IO.Path.GetFileNameWithoutExtension(args[programIndex]);
                StartAndWatch(args[programIndex], args[programIndex + 1], ref _runningWatchers[p]);
            }

            if (_watchFileName.Length > 2)
            {
                StartFileWatch(watchFileDelay);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            SysTrayContext stContext = new SysTrayContext();

            Application.Run(stContext);
        }