예제 #1
0
        static void Main(string[] args)
        {
            try
            {
                if (args.Length != 4)
                {
                    Log("Please pass four and only four parameters to BenDownloader...", true);
                    return;
                }

                BenRunner br = new BenRunner(args[0], args[1], args[2], args[3]);
                br.TransferAllFiles();
            }
            catch (Exception ex)
            {
                Log("Ben Downloader failed. Message: " + ex, true);
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            int setting = s_openMicConfigurationFile.Settings["systemSettings"]["BenRunnerInstanceCount"]?.ValueAsInt32() ?? 0;

            if (setting > 0)
            {
                s_lock = new Semaphore(setting, setting, "BenRunner");
            }

            try
            {
                if (args.Length != 2)
                {
                    Console.WriteLine("Please pass two and only two parameters...");
                    return;
                }

                if (s_lock?.WaitOne(5000 * 60) ?? true)
                {
                    using (BenRunner br = new BenRunner(int.Parse(args[0]), int.Parse(args[1])))
                    {
                        AppDomain.CurrentDomain.ProcessExit += (sender, arg) => br.Dispose();

                        if (!br.XferAllFiles())
                        {
                            throw new Exception("BEN Downloader failed...");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log("Ben Downloader failed. Message: " + ex);
            }
            finally
            {
                s_lock?.Release();
            }
        }