Esempio n. 1
0
        /// <summary>
        /// Creates a new MulManager object reading initial data from the registry
        /// </summary>
        public MulManager()
        {
            m_2DFolder = GetExePath("Ultima Online");

            // Issues 43 - Problems when the client path isn't found - http://code.google.com/p/pandorasbox3/issues/detail?id=43 - Smjert

            if (m_2DFolder == null && !FixClientPath())
            {
                ErrMsgBox.Show("Impossible to load .mul files", "Error");
                Environment.Exit(1);
            }
            // Issues 43 - End

            m_Table = new NameValueCollection();
        }
Esempio n. 2
0
        // Issues 43 - Problems when the client path isn't found - http://code.google.com/p/pandorasbox3/issues/detail?id=43 - Smjert
        public static bool FixClientPath()
        {
            var reply = ErrMsgBox.Show(
                "The client path has not been found, maybe your registry key is corrupted or is missing, choose a way to fix it:" +
                "\n\n Yes: Pandora will try to search where you installed the client automatically" +
                "\n No: You manually specify the client path",
                "Client path not found",
                MessageBoxButtons.YesNo);

            if (reply == DialogResult.Yes)
            {
                var directory = @"C:\\Program Files\\EA Games\\Ultima Online 2D Client\\";

                if (Directory.Exists(directory))
                {
                    if (File.Exists(directory + @"\client.exe"))
                    {
                        WriteRegistryKey(directory);
                    }
                }
                else
                {
                    directory = @"C:\Programmi\EA Games\Ultima Online 2D Client";
                    if (Directory.Exists(directory + @"\client.exe"))
                    {
                        WriteRegistryKey(directory);
                    }
                    else
                    {
                        ErrMsgBox.Show(
                            "The automatic search failed to find the folder, please specify the path manually",
                            "Folder not found");
                        if (!SetCustomPath())
                        {
                            return(false);
                        }
                    }
                }
                return(true);
            }
            if (reply == DialogResult.No && SetCustomPath())
            {
                return(true);
            }

            return(false);
        }
Esempio n. 3
0
        private static bool SetCustomPath()
        {
            FolderBrowserDialog fdialog = new FolderBrowserDialog();
            DialogResult        result  = fdialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (Directory.Exists(fdialog.SelectedPath) && File.Exists(fdialog.SelectedPath + @"\client.exe"))
                {
                    WriteRegistryKey(fdialog.SelectedPath);
                    return(true);
                }
                else
                {
                    result = ErrMsgBox.Show("You selected the wrong folder, do you want to retry?", "Wrong Folder", MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes)
                    {
                        return(SetCustomPath());
                    }
                }
            }
            return(false);
        }