예제 #1
0
 public static void SetValue(IntPtr windowHandle, double progressValue, double progressMax)
 {
     if (taskbarSupported && !(DetectLinux.WineDetected() || DetectLinux.NativeLinuxDetected()))
     {
         taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
     }
 }
예제 #2
0
 public static void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
 {
     if (taskbarSupported && !(DetectLinux.WineDetected() || DetectLinux.NativeLinuxDetected()))
     {
         taskbarInstance.SetProgressState(windowHandle, taskbarState);
     }
 }
예제 #3
0
        static void Main()
        {
            bool mono  = DetectLinux.MonoDetected();
            bool wine  = DetectLinux.WineDetected();
            bool linux = DetectLinux.NativeLinuxDetected();

            Directory.SetCurrentDirectory(Path.GetDirectoryName(Application.ExecutablePath));

            if (Self.isTempFolder(Directory.GetCurrentDirectory()))
            {
                MessageBox.Show(null, "Please, extract me and my DLL files before executing...", "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Environment.Exit(0);
            }

            if (!Directory.Exists("Languages"))
            {
                Directory.CreateDirectory("Languages");
            }

            try {
                File.Delete("Languages/Default.lng");
                File.WriteAllText("Languages/Default.lng", ExtractResource.AsString("GameLauncher.Language.Default.lng"));
            }
            catch { }

            try {
                File.Delete(Directory.GetCurrentDirectory() + "\\tempname.zip");
            } catch { }

            if (!File.Exists("LZMA.dll"))
            {
                File.WriteAllBytes("LZMA.dll", ExtractResource.AsByte("GameLauncher.LZMA.LZMA.dll"));
            }

            if (!linux && !File.Exists("discord-rpc.dll"))
            {
                File.WriteAllBytes("discord-rpc.dll", ExtractResource.AsByte("GameLauncher.Discord.discord-rpc.dll"));
            }

            if (linux && !File.Exists("libdiscord-rpc.so"))
            {
                File.WriteAllBytes("libdiscord-rpc.so", ExtractResource.AsByte("GameLauncher.Discord.libdiscord-rpc.so"));
            }

            if (File.Exists("GameLauncherUpdater.exe"))
            {
                File.Delete("GameLauncherUpdater.exe");
            }

            try {
                File.Delete("GL_Update.exe");
                File.WriteAllBytes("GL_Update.exe", ExtractResource.AsByte("GameLauncher.Updater.GL_Update.exe"));
            } catch { }

            if (!File.Exists("servers.txt"))
            {
                try {
                    File.Create("servers.txt");
                } catch { }
            }

            if (Debugger.IsAttached)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new mainScreen());
            }
            else
            {
                if (NFSW.isNFSWRunning())
                {
                    MessageBox.Show(null, "An instance of Need for Speed: World is already running", "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    Process.GetProcessById(Process.GetCurrentProcess().Id).Kill();
                }

                Mutex mutex = new Mutex(false, "GameLauncherNFSW-MeTonaTOR");
                try {
                    if (mutex.WaitOne(0, false))
                    {
                        String[]      files        = { "Newtonsoft.Json.dll", "INIFileParser.dll", "Microsoft.WindowsAPICodePack.dll", "Microsoft.WindowsAPICodePack.Shell.dll" };
                        List <string> missingfiles = new List <string>();

                        foreach (string file in files)
                        {
                            if (!File.Exists(file))
                            {
                                missingfiles.Add(file);
                            }
                        }

                        if (missingfiles.Count != 0)
                        {
                            string message = "Cannot launch GameLauncher. The following files are missing:\n\n";

                            foreach (string file in missingfiles)
                            {
                                message += "• " + file + "\n";
                            }

                            message += "\nCurrent directory: " + Directory.GetCurrentDirectory();

                            MessageBox.Show(null, message, "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Environment.Exit(1);
                        }

                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                        Application.Run(new mainScreen());
                    }
                    else
                    {
                        MessageBox.Show(null, "An instance of the application is already running.", "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                } finally {
                    if (mutex != null)
                    {
                        mutex.Close();
                        mutex = null;
                    }
                }
            }
        }
예제 #4
0
        private void DebugWindow_Load(object sender, EventArgs e)
        {
            data.AutoGenerateColumns = true;

            IniFile SettingFile = new IniFile("Settings.ini");

            string TracksHigh = (SettingFile.Read("TracksHigh") == "1") ? "True" : "False";
            string Password   = (!String.IsNullOrEmpty(SettingFile.Read("Password"))) ? "True" : "False";
            string SkipUpdate = (SettingFile.Read("SkipUpdate") == "1") ? "True" : "False";

            string Antivirus   = String.Empty;
            string Firewall    = String.Empty;
            string AntiSpyware = String.Empty;

            if (!DetectLinux.UnixDetected())
            {
                try
                {
                    Antivirus   = (String.IsNullOrEmpty(AntivirusInstalled())) ? "---" : AntivirusInstalled();
                    Firewall    = (String.IsNullOrEmpty(AntivirusInstalled("FirewallProduct"))) ? "---" : AntivirusInstalled("FirewallProduct");
                    AntiSpyware = (String.IsNullOrEmpty(AntivirusInstalled("AntiSpywareProduct"))) ? "---" : AntivirusInstalled("AntiSpywareProduct");
                }
                catch
                {
                    Antivirus   = "Unknown";
                    Firewall    = "Unknown";
                    AntiSpyware = "Unknown";
                }
            }

            string LauncherPosition = "";
            string OS = "";

            if (DetectLinux.WineDetected())
            {
                OS = "Wine";
            }
            else if (DetectLinux.LinuxDetected())
            {
                OS = "Linux";
            }
            else if (DetectLinux.MacOSDetected())
            {
                OS = "MacOS";
            }
            else
            {
                OS = (from x in new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem").Get().Cast <ManagementObject>()
                      select x.GetPropertyValue("Caption")).FirstOrDefault().ToString();
            }

            if (SettingFile.Read("LauncherPosX") + "x" + SettingFile.Read("LauncherPosY") == "x")
            {
                LauncherPosition = "Windows Default Position";
            }
            else
            {
                LauncherPosition = SettingFile.Read("LauncherPosX") + "x" + SettingFile.Read("LauncherPosY");
            }

            long          memKb = 0;
            ulong         lpFreeBytesAvailable = 0;
            List <string> GPUs            = new List <string>();
            string        Win32_Processor = "";

            if (!DetectLinux.UnixDetected())
            {
                Kernel32.GetPhysicallyInstalledSystemMemory(out memKb);

                ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT Name FROM Win32_VideoController");
                string graphicsCard = string.Empty;
                foreach (ManagementObject mo in searcher.Get())
                {
                    foreach (PropertyData property in mo.Properties)
                    {
                        GPUs.Add(property.Value.ToString());
                    }
                }

                Win32_Processor = (from x in new ManagementObjectSearcher("SELECT Name FROM Win32_Processor").Get().Cast <ManagementObject>()
                                   select x.GetPropertyValue("Name")).FirstOrDefault().ToString();

                Kernel32.GetDiskFreeSpaceEx(SettingFile.Read("InstallationDirectory"), out lpFreeBytesAvailable, out ulong lpTotalNumberOfBytes, out ulong lpTotalNumberOfFreeBytes);
            }

            var Win32_VideoController = string.Join(" | ", GPUs);

            var settings = new List <ListType> {
                new ListType {
                    Name = "InstallationDirectory", Value = SettingFile.Read("InstallationDirectory")
                },
                new ListType {
                    Name = "HWID", Value = Security.FingerPrint.Value()
                },
                new ListType {
                    Name = "Server Address", Value = ServerIP
                },
                new ListType {
                    Name = "Server Name", Value = ServerName
                },
                new ListType {
                    Name = "Credentials Saved", Value = Password
                },
                new ListType {
                    Name = "Language", Value = SettingFile.Read("Language")
                },
                new ListType {
                    Name = "TracksHigh", Value = TracksHigh
                },
                new ListType {
                    Name = "SkipUpdate", Value = SkipUpdate
                },
                new ListType {
                    Name = "LauncherPos", Value = LauncherPosition
                },
                new ListType {
                    Name = "ProxyPort", Value = Self.ProxyPort.ToString()
                },

                new ListType {
                    Name = "", Value = ""
                },
            };

            if (DetectLinux.UnixDetected())
            {
                var embedded = Directory.Exists("wine");
                settings.Add(new ListType {
                    Name = "Embedded Wine", Value = embedded.ToString()
                });
                if (!embedded)
                {
                    settings.Add(new ListType {
                        Name = "Wine version", Value = WineManager.GetWineVersion()
                    });
                }
                settings.Add(new ListType {
                    Name = "", Value = ""
                });
            }

            if (!DetectLinux.UnixDetected())
            {
                settings.AddRange(new[] {
                    new ListType {
                        Name = "Antivirus", Value = Antivirus
                    },
                    new ListType {
                        Name = "Firewall", Value = Firewall
                    },
                    new ListType {
                        Name = "AntiSpyware", Value = AntiSpyware
                    },
                    new ListType {
                        Name = "", Value = ""
                    },
                    new ListType {
                        Name = "CPU", Value = Win32_Processor
                    },
                    new ListType {
                        Name = "GPU", Value = Win32_VideoController
                    },
                    new ListType {
                        Name = "RAM", Value = (memKb / 1024).ToString() + "MB"
                    },
                    new ListType {
                        Name = "Disk Space Left", Value = FormatFileSize(lpFreeBytesAvailable)
                    },
                    new ListType {
                        Name = "", Value = ""
                    }
                });
            }
            settings.AddRange(new[] {
                new ListType {
                    Name = "Operating System", Value = OS
                },
                new ListType {
                    Name = "Environment Version", Value = Environment.OSVersion.Version.ToString()
                },
                new ListType {
                    Name = "Screen Resolution", Value = Screen.PrimaryScreen.Bounds.Width + "x" + Screen.PrimaryScreen.Bounds.Height
                }
            });

            data.DataSource = settings;

            DataGridViewCellStyle style = new DataGridViewCellStyle();

            style.Font = new Font(data.Font, FontStyle.Bold);
            data.Columns[0].DefaultCellStyle = style;

            data.Columns[0].Width += 50;

            int size_x = 1024;
            int size_y = 450;

            data.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.Size = new Size(size_x, size_y);
        }
예제 #5
0
        static void Main()
        {
            int  SysVersion = (int)Environment.OSVersion.Platform;
            bool mono       = DetectLinux.MonoDetected();
            bool wine       = DetectLinux.WineDetected();
            bool linux      = DetectLinux.NativeLinuxDetected();

            try {
            } catch {
                MessageBox.Show("This should fake antivirus :v");
            }

            /*if(Environment.OSVersion.Version.Major <= 5 && !linux) {
             *  MessageBox.Show(null, "Windows XP Support has been terminated. Please upgrade your Operating System to 'Vista' or newer.", "GameLauncher.exe", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             *  Environment.Exit(Environment.ExitCode);
             * }*/

            Directory.SetCurrentDirectory(Path.GetDirectoryName(Application.ExecutablePath));

            if (!Directory.Exists("Languages"))
            {
                Directory.CreateDirectory("Languages");
            }

            try {
                File.Delete("Languages/Default.lng");
                File.WriteAllText("Languages/Default.lng", ExtractResource.AsString("GameLauncher.Language.Default.lng"));
            }
            catch { }

            try {
                File.Delete(Directory.GetCurrentDirectory() + "\\tempname.zip");
            } catch { }

            if (linux)
            {
                MessageBox.Show(null, "Native Linux support is still under alpha stage. Therefore, launcher or game could crash.", "GameLauncher.exe", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (mono == true)
            {
                MessageBox.Show(null, "Mono support is still under alpha stage. Therefore, launcher could not launch.", "GameLauncher.exe", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            if (!File.Exists("LZMA.dll"))
            {
                File.WriteAllBytes("LZMA.dll", ExtractResource.AsByte("GameLauncher.LZMA.LZMA.dll"));
            }

            if (!linux && !File.Exists("discord-rpc.dll"))
            {
                File.WriteAllBytes("discord-rpc.dll", ExtractResource.AsByte("GameLauncher.Discord.discord-rpc.dll"));
            }

            if (linux && !File.Exists("libdiscord-rpc.so"))
            {
                File.WriteAllBytes("libdiscord-rpc.so", ExtractResource.AsByte("GameLauncher.Discord.libdiscord-rpc.so"));
            }

            if (File.Exists("GameLauncherUpdater.exe"))
            {
                File.Delete("GameLauncherUpdater.exe");
            }

            try {
                File.Delete("GL_Update.exe");
                File.WriteAllBytes("GL_Update.exe", ExtractResource.AsByte("GameLauncher.Updater.GL_Update.exe"));
            } catch { }

            if (!File.Exists("servers.txt"))
            {
                try {
                    File.Create("servers.txt");
                } catch { }
            }

            if (Debugger.IsAttached)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new mainScreen());
            }
            else
            {
                if (NFSW.isNFSWRunning())
                {
                    MessageBox.Show(null, "An instance of Need for Speed: World is already running", "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    Process.GetProcessById(Process.GetCurrentProcess().Id).Kill();
                }

                Mutex mutex = new Mutex(false, "GameLauncherNFSW-MeTonaTOR");
                try {
                    if (mutex.WaitOne(0, false))
                    {
                        String[]      files        = { "Newtonsoft.Json.dll", "LZMA.dll" };
                        List <string> missingfiles = new List <string>();

                        foreach (string file in files)
                        {
                            if (!File.Exists(file))
                            {
                                missingfiles.Add(file);
                            }
                        }

                        if (missingfiles.Count != 0)
                        {
                            string message = "Cannot launch GameLauncher. The following files are missing:\n\n";

                            foreach (string file in missingfiles)
                            {
                                message += "• " + file + "\n";
                            }

                            message += "\nCurrent directory: " + Directory.GetCurrentDirectory();
                            message += "\nYou will be moved to the project page for re-download.";

                            MessageBox.Show(null, message, "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Process.Start(@"https://github.com/SoapboxRaceWorld/GameLauncher_NFSW/releases");
                            Environment.Exit(1);
                        }

                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                        Application.Run(new mainScreen());
                    }
                    else
                    {
                        MessageBox.Show(null, "An instance of the application is already running.", "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                } finally {
                    if (mutex != null)
                    {
                        mutex.Close();
                        mutex = null;
                    }
                }
            }
        }
예제 #6
0
        static void Main()
        {
            int  SysVersion = (int)Environment.OSVersion.Platform;
            bool mono       = DetectLinux.MonoDetected();
            bool wine       = DetectLinux.WineDetected();
            bool linux      = DetectLinux.LinuxDetected();

            //Discord fix
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Application.ExecutablePath));

            //Languages
            if (!File.Exists("Languages"))
            {
                Directory.CreateDirectory("Languages");
                File.WriteAllText("Languages/Dutch.lng", ExtractResource.AsString("GameLauncher.Languages.Dutch.lng"));
                File.WriteAllText("Languages/English.lng", ExtractResource.AsString("GameLauncher.Languages.English.lng"));
                File.WriteAllText("Languages/French.lng", ExtractResource.AsString("GameLauncher.Languages.French.lng"));
                File.WriteAllText("Languages/German_Formal.lng", ExtractResource.AsString("GameLauncher.Languages.German_Formal.lng"));
                File.WriteAllText("Languages/German_Informal.lng", ExtractResource.AsString("GameLauncher.Languages.German_Informal.lng"));
                File.WriteAllText("Languages/Polish.lng", ExtractResource.AsString("GameLauncher.Languages.Polish.lng"));
                File.WriteAllText("Languages/Portuguese.lng", ExtractResource.AsString("GameLauncher.Languages.Portuguese.lng"));
                File.WriteAllText("Languages/Spanish.lng", ExtractResource.AsString("GameLauncher.Languages.Spanish.lng"));
                File.WriteAllText("Languages/Swedish.lng", ExtractResource.AsString("GameLauncher.Languages.Swedish.lng"));
            }

            //Remove zip file
            try {
                File.Delete(Directory.GetCurrentDirectory() + "\\tempname.zip");
            } catch { }

            //Console log with warning
            if (mono == true)
            {
                MessageBox.Show(null, "Mono support is still under alpha stage. Therefore, launcher could not launch.", "GameLauncher.exe", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            //Add LZMA.dll on the fly (used for decompression of section{int}.dll files)
            if (!File.Exists("LZMA.dll"))
            {
                File.WriteAllBytes("LZMA.dll", ExtractResource.AsByte("GameLauncher.LZMA.LZMA.dll"));
            }

            //Add GameLauncherUpdater.exe on the fly
            if (!File.Exists("GameLauncherUpdater.exe"))
            {
                File.WriteAllBytes("GameLauncherUpdater.exe", ExtractResource.AsByte("GameLauncher.Updater.GameLauncherUpdater.exe"));
            }

            //Detect if NFSW is launched
            if (NFSW.isNFSWRunning())
            {
                MessageBox.Show(null, "An instance of Need for Speed: World is already running", "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Process.GetProcessById(Process.GetCurrentProcess().Id).Kill();
            }

            Mutex mutex = new Mutex(false, "GameLauncherNFSW-MeTonaTOR"); //Forgot about other launchers...

            try {
                if (mutex.WaitOne(0, false))
                {
                    //First of all, we need to check if files exists
                    String[]      files        = { "Newtonsoft.Json.dll", "LZMA.dll", "ICSharpCode.SharpZipLib.dll" };
                    List <string> missingfiles = new List <string>();

                    foreach (string file in files)
                    {
                        if (!File.Exists(file))
                        {
                            missingfiles.Add(file);
                        }
                    }

                    if (missingfiles.Count != 0)
                    {
                        string message = "Cannot launch GameLauncher. The following files are missing:\n\n";

                        foreach (string file in missingfiles)
                        {
                            message += "• " + file + "\n";
                        }

                        message += "\nCurrent directory: " + Directory.GetCurrentDirectory();
                        message += "\nYou will be moved to the project page for re-download.";

                        MessageBox.Show(null, message, "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Process.Start(@"https://github.com/SoapboxRaceWorld/GameLauncher_NFSW/releases");
                        Environment.Exit(1);
                    }

                    if (Environment.OSVersion.Version.Major >= 6)
                    {
                        User32.SetProcessDPIAware();
                    }

                    //try {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new mainScreen());
                    //} catch(Exception) {
                    //Temporarely we gonna kill it.
                    //  Process.GetProcessById(Process.GetCurrentProcess().Id).Kill();
                    //}
                }
                else
                {
                    MessageBox.Show(null, "An instance of the application is already running.", "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            } finally {
                if (mutex != null)
                {
                    mutex.Close();
                    mutex = null;
                }
            }
        }
예제 #7
0
        static void Main()
        {
            int  SysVersion = (int)Environment.OSVersion.Platform;
            bool mono       = DetectLinux.MonoDetected();
            bool wine       = DetectLinux.WineDetected();
            bool linux      = DetectLinux.LinuxDetected();

            //Remove zip file
            File.Delete(Directory.GetCurrentDirectory() + "\\tempname.zip");

            //Console log with warning
            if (mono == true)
            {
                //It will never work under pure mono... so...
                Application.Exit();
            }
            else if (wine == true)
            {
                MessageBox.Show(null, "Wine support is still under alpha stage. Therefore, launcher could not launch.", "GameLauncher.exe", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            //Add LZMA.dll on the fly (used for decompression of section{int}.dll files)
            if (!File.Exists("LZMA.dll"))
            {
                File.WriteAllBytes("LZMA.dll", ExtractResource.AsByte("GameLauncher.LZMA.LZMA.dll"));
            }

            //Add GameLauncherUpdater.exe on the fly
            if (!File.Exists("GameLauncherUpdater.exe"))
            {
                File.WriteAllBytes("GameLauncherUpdater.exe", ExtractResource.AsByte("GameLauncher.Updater.GameLauncherUpdater.exe"));
            }

            //Detect if NFSW is launched
            Mutex detectRunningNFSW = new Mutex(false, "Global\\{3E34CEFB-7B34-4e62-8034-33256B8BC2F7}");

            try {
                if (!detectRunningNFSW.WaitOne(0, false))
                {
                    MessageBox.Show(null, "An instance of Need for Speed: World is already running", "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    Environment.Exit(0);
                }
            } finally {
                if (detectRunningNFSW != null)
                {
                    detectRunningNFSW.Close();
                    detectRunningNFSW = null;
                }
            }

            Mutex mutex = new Mutex(false, "GameLauncherNFSW-MeTonaTOR"); //Forgot about other launchers...

            try {
                if (mutex.WaitOne(0, false))
                {
                    //First of all, we need to check if files exists
                    String[]      files        = { "Microsoft.WindowsAPICodePack.dll", "Microsoft.WindowsAPICodePack.Shell.dll", "Newtonsoft.Json.dll", "LZMA.dll", "ICSharpCode.SharpZipLib.dll" };
                    List <string> missingfiles = new List <string>();

                    foreach (string file in files)
                    {
                        if (!File.Exists(file))
                        {
                            missingfiles.Add(file);
                        }
                    }

                    if (missingfiles.Count != 0)
                    {
                        string message = "Cannot launch GameLauncher. The following files are missing:\n\n";

                        foreach (string file in missingfiles)
                        {
                            message += "• " + file + "\n";
                        }

                        message += "\nCurrent directory: " + Directory.GetCurrentDirectory();
                        message += "\nYou will be moved to the project page for re-download.";

                        MessageBox.Show(null, message, "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Process.Start(@"https://github.com/metonator/GameLauncher_NFSW/releases");
                        Environment.Exit(1);
                    }

                    if (Environment.OSVersion.Version.Major >= 6)
                    {
                        User32.SetProcessDPIAware();
                    }

                    //try {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new mainScreen());
                    //} catch(Exception ex) {
                    //    if(linux == true) {
                    //        extraLinuxInfo = "\n\nAditionally, please report that you're using Wine/Mono Runtime and your Linux Distro";
                    //    }

                    //    MessageBox.Show(null, "Failed to launch GameLauncher. " + ex.Message + "\n\nStack Trace:\n" + ex.StackTrace + extraLinuxInfo, "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //    Environment.Exit(1);
                    //}
                }
                else
                {
                    MessageBox.Show(null, "An instance of the application is already running.", "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            } finally {
                if (mutex != null)
                {
                    mutex.Close();
                    mutex = null;
                }
            }
        }