static void Main(String[] args) { if (args.Length == 4) { Thread thd = new Thread(new ThreadStart(delegate { while (true) { if (ChangeIcon) { IntPtr pt = Process.GetCurrentProcess().MainWindowHandle; if (pt.ToInt64() != 0) { NativeMethods.SetClassLong(pt, -14, Resources.AppIcon.Handle.ToInt64()); ChangeIcon = false; } } Int32 tmp = NativeMethods.GetAsyncKeyState(0x1b) & 0xf; if (tmp != 0) Process.GetCurrentProcess().Kill(); Thread.Sleep(16); } })); thd.IsBackground = true; thd.Start(); // Retrieve parameters String DLLPath = args[0]; String DumpPath = args[1]; String Operation = args[2]; Int32 Renderer = Convert.ToInt32(args[3]); GSDXWrapper wrap = new GSDXWrapper(); wrap.Load(DLLPath); if (Operation == "GSReplay") { ChangeIcon = true; if (Renderer != -1) wrap.GSReplayDump(Renderer + " " + DumpPath); else wrap.GSReplayDump(DumpPath); } else wrap.GSConfig(); wrap.Unload(); } else { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); frmMain = new GSDumpGUI(); Application.Run(frmMain); } }
static void Main(String[] args) { if (args.Length == 5) { // do this first, else racy mess ;) wrap = new GSDXWrapper(); var port = Convert.ToInt32(args[4]); try { Client = new TCPLibrary.MessageBased.Core.BaseMessageClient(); Client.OnMessageReceived += new TCPLibrary.MessageBased.Core.BaseMessageClient.MessageReceivedHandler(Client_OnMessageReceived); Client.Connect("localhost", port); } catch (Exception) { Client = null; } Thread thd = new Thread(new ThreadStart(delegate { while (true) { IntPtr pt = Process.GetCurrentProcess().MainWindowHandle; if (ChangeIcon) { if (pt.ToInt64() != 0) { NativeMethods.SetClassLong(pt, -14, Resources.AppIcon.Handle.ToInt64()); ChangeIcon = false; } } Int32 tmp = NativeMethods.GetAsyncKeyState(0x1b) & 0xf; if (tmp != 0) { Process.GetCurrentProcess().Kill(); } Thread.Sleep(16); } })); thd.IsBackground = true; thd.Start(); // Retrieve parameters String DLLPath = args[0]; String DumpPath = args[1]; String Operation = args[2]; Int32 Renderer = Convert.ToInt32(args[3]); wrap.Load(DLLPath); Directory.SetCurrentDirectory(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory + "GSDumpGSDXConfigs\\")); if (Operation == "GSReplay") { dump = GSDump.LoadDump(DumpPath); if (Client != null) { SendStatistics(); SendDumpSize(); } wrap.Run(dump, Renderer); ChangeIcon = true; } else { wrap.GSConfig(); } wrap.Unload(); if (GSDXWrapper.DumpTooOld) { if (Client != null) { TCPMessage msg = new TCPMessage(); msg.MessageType = MessageType.StateOld; Client.Send(msg); } } if (Client != null) { Client.Disconnect(); } } else { Clients = new List <TCPLibrary.MessageBased.Core.BaseMessageClientS>(); Server = new TCPLibrary.MessageBased.Core.BaseMessageServer(); Server.OnClientMessageReceived += new BaseMessageServer.MessageReceivedHandler(Server_OnClientMessageReceived); Server.OnClientAfterConnect += new TCPLibrary.Core.Server.ConnectedHandler(Server_OnClientAfterConnect); Server.OnClientAfterDisconnected += new TCPLibrary.Core.Server.DisconnectedHandler(Server_OnClientAfterDisconnected); Server.Enabled = true; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); frmMain = new GSDumpGUI(); Application.Run(frmMain); Server.Enabled = false; } }
static void Main(String[] args) { if (args.Length == 5) { hMainIcon = Resources.AppIcon.Handle; // do this first, else racy mess ;) wrap = new GSDXWrapper(); var port = Convert.ToInt32(args[4]); try { Client = new TCPLibrary.MessageBased.Core.BaseMessageClient(); Client.OnMessageReceived += new TCPLibrary.MessageBased.Core.BaseMessageClient.MessageReceivedHandler(Client_OnMessageReceived); Client.Connect("localhost", port); } catch (Exception) { Client = null; } // Retrieve parameters String DLLPath = args[0]; String DumpPath = args[1]; String Operation = args[2]; Int32 Renderer = Convert.ToInt32(args[3]); wrap.Load(DLLPath); Directory.SetCurrentDirectory(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory + "GSDumpGSDXConfigs\\")); if (Operation == "GSReplay") { dump = GSDump.LoadDump(DumpPath); if (Client != null) { SendStatistics(); SendDumpSize(); } wrap.Run(dump, Renderer); } else { wrap.GSConfig(); } wrap.Unload(); if (GSDXWrapper.DumpTooOld) { if (Client != null) { TCPMessage msg = new TCPMessage(); msg.MessageType = MessageType.StateOld; Client.Send(msg); } } if (Client != null) { Client.Disconnect(); } } else { Clients = new List <TCPLibrary.MessageBased.Core.BaseMessageClientS>(); Server = new TCPLibrary.MessageBased.Core.BaseMessageServer(); Server.OnClientMessageReceived += new BaseMessageServer.MessageReceivedHandler(Server_OnClientMessageReceived); Server.OnClientAfterConnect += new TCPLibrary.Core.Server.ConnectedHandler(Server_OnClientAfterConnect); Server.OnClientAfterDisconnected += new TCPLibrary.Core.Server.DisconnectedHandler(Server_OnClientAfterDisconnected); Server.Enabled = true; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); using (frmMain = new GSDumpGUI()) { Application.Run(frmMain); } Server.Enabled = false; } }
static void Main(String[] args) { if (args.Length == 4) { // do this first, else racy mess ;) wrap = new GSDXWrapper(); try { Client = new TCPLibrary.MessageBased.Core.BaseMessageClient(); Client.OnMessageReceived += new TCPLibrary.MessageBased.Core.BaseMessageClient.MessageReceivedHandler(Client_OnMessageReceived); Client.Connect("localhost", 9999); } catch (Exception) { Client = null; } Thread thd = new Thread(new ThreadStart(delegate { while (true) { IntPtr pt = Process.GetCurrentProcess().MainWindowHandle; if (ChangeIcon) { if (pt.ToInt64() != 0) { NativeMethods.SetClassLong(pt, -14, Resources.AppIcon.Handle.ToInt64()); ChangeIcon = false; } } Int32 tmp = NativeMethods.GetAsyncKeyState(0x1b) & 0xf; if (tmp != 0) Process.GetCurrentProcess().Kill(); Thread.Sleep(16); } })); thd.IsBackground = true; thd.Start(); // Retrieve parameters String DLLPath = args[0]; String DumpPath = args[1]; String Operation = args[2]; Int32 Renderer = Convert.ToInt32(args[3]); wrap.Load(DLLPath); Directory.SetCurrentDirectory(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory + "GSDumpGSDXConfigs\\" + Path.GetFileName(DLLPath) + "\\")); if (Operation == "GSReplay") { dump = GSDump.LoadDump(DumpPath); if (Client != null) { SendStatistics(); SendDumpSize(); } wrap.Run(dump, Renderer); ChangeIcon = true; } else wrap.GSConfig(); wrap.Unload(); if (GSDXWrapper.DumpTooOld) { if (Client != null) { TCPMessage msg = new TCPMessage(); msg.MessageType = MessageType.StateOld; Client.Send(msg); } } if (Client != null) Client.Disconnect(); } else { Clients = new List<TCPLibrary.MessageBased.Core.BaseMessageClientS>(); Server = new TCPLibrary.MessageBased.Core.BaseMessageServer(); Server.OnClientMessageReceived += new BaseMessageServer.MessageReceivedHandler(Server_OnClientMessageReceived); Server.OnClientAfterConnect += new TCPLibrary.Core.Server.ConnectedHandler(Server_OnClientAfterConnect); Server.OnClientAfterDisconnected += new TCPLibrary.Core.Server.DisconnectedHandler(Server_OnClientAfterDisconnected); Server.Port = 9999; Server.Enabled = true; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); frmMain = new GSDumpGUI(); Application.Run(frmMain); Server.Enabled = false; } }