// Token: 0x06000003 RID: 3 RVA: 0x000029DC File Offset: 0x00000BDC
        private static void Main(string[] args)
        {
            bool flag = args.Length == 1;

            if (flag)
            {
                bool flag2 = args[0] == "smmonitor_ping";
                if (flag2)
                {
                    Console.WriteLine("SM Automation running");
                }
            }
            else
            {
                AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs args1)
                {
                    Console.Error.WriteLine("Unhandled exception: " + args1.ExceptionObject);
                    Environment.Exit(1);
                };
                using (SingleProgramInstance singleProgramInstance = new SingleProgramInstance("x5k6yz"))
                {
                    bool isSingleInstance = singleProgramInstance.IsSingleInstance;
                    if (isSingleInstance)
                    {
                        SMAutomation smautomation = new SMAutomation();
                        smautomation.writeToLog("Starting SM Automation");
                        try
                        {
                            SMAutomation.readConfigFile();
                        }
                        catch (Exception ex)
                        {
                            smautomation.writeToLog("Exiting Main");
                            smautomation.writeToLog(ex.StackTrace);
                        }
                        finally
                        {
                            smautomation.writeToLog("Exiting Finally Main");
                        }
                        SMAutomation.stDt = DateTime.Now;
                        smautomation.checkLandingZoneForFiles();
                    }
                    else
                    {
                        singleProgramInstance.RaiseOtherProcess();
                    }
                }
            }
        }
예제 #2
0
        // Token: 0x06000024 RID: 36 RVA: 0x000051D0 File Offset: 0x000033D0
        public void RaiseOtherProcess()
        {
            Process currentProcess = Process.GetCurrentProcess();
            string  name           = Assembly.GetExecutingAssembly().GetName().Name;

            foreach (Process process in Process.GetProcessesByName(name))
            {
                bool flag = currentProcess.Id != process.Id;
                if (flag)
                {
                    IntPtr mainWindowHandle = process.MainWindowHandle;
                    bool   flag2            = SingleProgramInstance.IsIconic(mainWindowHandle);
                    if (flag2)
                    {
                        SingleProgramInstance.ShowWindowAsync(mainWindowHandle, 9);
                    }
                    SingleProgramInstance.SetForegroundWindow(mainWindowHandle);
                    break;
                }
            }
        }