Files

76 lines
1.9 KiB
C#

using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace AGVSystem
{
// Token: 0x0200001B RID: 27
internal static class Program
{
// Token: 0x0600017E RID: 382
[DllImport("User32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
// Token: 0x0600017F RID: 383
[DllImport("User32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
// Token: 0x06000180 RID: 384 RVA: 0x0003E230 File Offset: 0x0003C430
[STAThread]
private static void Main()
{
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Process process = Program.RunningInstance();
mainfrm.init2();
bool flag = process == null;
if (flag)
{
Application.Run(new mainfrm());
}
else
{
Program.HandleRunningInstance(process);
}
}
catch (Exception ex)
{
}
}
// Token: 0x06000181 RID: 385 RVA: 0x0003E290 File Offset: 0x0003C490
public static Process RunningInstance()
{
Process currentProcess = Process.GetCurrentProcess();
Process[] processesByName = Process.GetProcessesByName(currentProcess.ProcessName);
foreach (Process process in processesByName)
{
bool flag = process.Id != currentProcess.Id;
if (flag)
{
bool flag2 = Assembly.GetExecutingAssembly().Location.Replace("/", "\\") == currentProcess.MainModule.FileName;
if (flag2)
{
return process;
}
}
}
return null;
}
// Token: 0x06000182 RID: 386 RVA: 0x0003E31F File Offset: 0x0003C51F
public static void HandleRunningInstance(Process instance)
{
Program.ShowWindowAsync(instance.MainWindowHandle, 3);
Program.SetForegroundWindow(instance.MainWindowHandle);
}
// Token: 0x040004CE RID: 1230
private const int WS_SHOWNORMAL = 3;
}
}