//============================================================================* // OnBuyClicked() //============================================================================* private void OnBuyClicked(Object sender, EventArgs e) { if (!m_RWRegistry.Trial && m_RWRegistry.ValidateKey()) { Process.Start(@"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4WEFAN2YP56AA"); } else { Process.Start(@"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QN48YFMCYZLR8"); } }
static void Main(string[] args) { //----------------------------------------------------------------------------* // Set Application Properties //----------------------------------------------------------------------------* Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //----------------------------------------------------------------------------* // Get the command line arguments //----------------------------------------------------------------------------* bool fDev = false; string strGUID = ""; foreach (string strArg in args) { if (strArg.ToUpper() == "/DEV") { fDev = true; } if (strArg.Length > 6 && strArg.ToUpper().Substring(0, 6) == "/GUID=") { strGUID = strArg.Substring(6); } } //----------------------------------------------------------------------------* // Make sure the correct GUID has been sent //----------------------------------------------------------------------------* if (strGUID == null || strGUID != "1aa3257d-fa44-4f49-9546-076b2385cd35") { MessageBox.Show(String.Format("You must use the launcher to start {0}. You can not execute it directly.", Application.ProductName), "Execution Out of Order", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //----------------------------------------------------------------------------* // If this is a trial and we're expired, exit //----------------------------------------------------------------------------* cRWRegistry RWRegistry = new cRWRegistry(); if ((RWRegistry.Trial && RWRegistry.TrialExpired) || RWRegistry.InvalidRegistry || !RWRegistry.ValidateKey()) { return; } //----------------------------------------------------------------------------* // See if we're already running //----------------------------------------------------------------------------* bool fCreateNew = true; using (Mutex mutex = new Mutex(true, "ReloadersWorkShop", out fCreateNew)) { //----------------------------------------------------------------------------* // Not running, continue normally //----------------------------------------------------------------------------* if (fCreateNew) { //----------------------------------------------------------------------------* // Start the Application //----------------------------------------------------------------------------* try { Application.Run(new cMainForm(RWRegistry, fDev)); } catch (Exception e) { MessageBox.Show(e.Message, "Exception in Reloader's Work Shop!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } //----------------------------------------------------------------------------* // Already running, bring the currently running version to the foreground //----------------------------------------------------------------------------* else { Process CurrentProcess = Process.GetCurrentProcess(); Process[] aProcesses = Process.GetProcessesByName(CurrentProcess.ProcessName); foreach (Process CheckProcess in aProcesses) { if (CheckProcess.Id != CurrentProcess.Id) { NativeMethods.SetForegroundWindow(CheckProcess.MainWindowHandle); break; } } } } }
static void Main(string[] args) { bool fUpdate = false; foreach (string strArg in args) { if (strArg.ToUpper() == "/UPDATE") { fUpdate = true; } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //----------------------------------------------------------------------------* // See if the ReloadersWorkShopLauncher is already running //----------------------------------------------------------------------------* bool fMutexCreated = true; using (Mutex ThisMutex = new Mutex(true, "ReloadersWorkShopLauncher", out fMutexCreated)) { //----------------------------------------------------------------------------* // Not running, continue //----------------------------------------------------------------------------* if (fMutexCreated) { //----------------------------------------------------------------------------* // See if ReloadersWorkShop is already running //----------------------------------------------------------------------------* using (Mutex RWMutex = new Mutex(true, "ReloadersWorkShop", out fMutexCreated)) { //----------------------------------------------------------------------------* // If it is, bring the current instance to the foreground //----------------------------------------------------------------------------* if (!fMutexCreated) { Process[] aProcesses = Process.GetProcessesByName("ReloadersWorkShop"); if (aProcesses.Length > 0) { NativeMethods.SetForegroundWindow(aProcesses[0].MainWindowHandle); } } //----------------------------------------------------------------------------* // Otherwise, it's ok to run the launcher //----------------------------------------------------------------------------* else { //----------------------------------------------------------------------------* // Update ReloadersWorkShopUpdater.exe if needed //----------------------------------------------------------------------------* if (fUpdate) { if (File.Exists("ReloadersWorkShopUpdater.upd")) { try { if (File.Exists("ReloadersWorkShopUpdater.exe")) { File.Delete("ReloadersWorkShopUpdater.exe"); } File.Move("ReloadersWorkShopUpdater.upd", "ReloadersWorkShopUpdater.exe"); } catch { } } } //----------------------------------------------------------------------------* // Check for updates //----------------------------------------------------------------------------* cRWRegistry RWRegistry = new cRWRegistry(); bool fUpdating = false; if (!RWRegistry.Trial || !RWRegistry.TrialExpired) { fUpdating = CheckForUpdates(); } //----------------------------------------------------------------------------* // If we're not updating, check the registry //----------------------------------------------------------------------------* if (!fUpdating) { //----------------------------------------------------------------------------* // See if this is a fresh install //----------------------------------------------------------------------------* if (RWRegistry.FreshInstall) { Process.Start("ReloadersWorkShopUpdater.exe", "/INSTALL"); return; } //----------------------------------------------------------------------------* // Make sure the registry has not been tampered with //----------------------------------------------------------------------------* if (RWRegistry.InvalidRegistry) { MessageBox.Show("The registry entries for Reloader's WorkShop are either corrupted or have been tampered with and needs to be repaired. You will need to reenter your Activation Key and other info.", "Corrupted Registry", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Process.Start("ReloadersWorkShopUpdater.exe", "/INSTALL"); return; } //----------------------------------------------------------------------------* // See if this is a Trial Version and check the date if it is //----------------------------------------------------------------------------* if (!RWRegistry.Trial && !RWRegistry.ValidateKey()) { MessageBox.Show("Your Activation Key is not valid. You will need to reenter your Activation Key and other info.", "Invalid Activation Key", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Process.Start("ReloadersWorkShopUpdater.exe", "/INSTALL"); return; } //----------------------------------------------------------------------------* // Check the license info //----------------------------------------------------------------------------* /* * cRWLicense RWLicense = new cRWLicense(); * * if (!RWLicense.ValidateLicense()) * return; */ //----------------------------------------------------------------------------* // If we get to here, everything is good to go, start the Main Form //----------------------------------------------------------------------------* Application.Run(new cMainForm(RWRegistry)); } } } } //----------------------------------------------------------------------------* // Launcher already running, bring the currently running window to the foreground //----------------------------------------------------------------------------* else { Process CurrentProcess = Process.GetCurrentProcess(); Process[] aProcesses = Process.GetProcessesByName(CurrentProcess.ProcessName); foreach (Process CheckProcess in aProcesses) { if (CheckProcess.Id != CurrentProcess.Id) { NativeMethods.SetForegroundWindow(CheckProcess.MainWindowHandle); break; } } } } }