예제 #1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            RegistryKey softwareKey = Registry.LocalMachine.OpenSubKey("SOFTWARE");
            if (Array.Exists(softwareKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("Microsoft") == 0; }))
            {
                RegistryKey msKey = softwareKey.OpenSubKey("Microsoft");
                if (Array.Exists(msKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("XNA") == 0; }))
                {
                    RegistryKey xnaKey = msKey.OpenSubKey("XNA");
                    if (Array.Exists(xnaKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("Framework") == 0; }))
                    {
                        RegistryKey asmKey = xnaKey.OpenSubKey("Framework");
                        if (Array.Exists(asmKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("v3.1") == 0; }))
                        {
                            // OK
                        }
                        else
                        {
                            MessageBox.Show("XNA was found to be installed on your system, but you do not have version 3.1. Please download and install XNA version 3.1.");
                        }
                    }
                    else
                        MessageBox.Show("XNA was found to be installed on your system, but certain components are missing. Please (re)download and (re)install XNA version 3.1.");
                }
                else
                    MessageBox.Show("XNA was not found to be installed on your system. Please download and install XNA version 3.1.");
            }
            else
                MessageBox.Show("Error: No Microsoft products were found on your system.");

            //NICHOLAS: There is no need for this now. I'm not running the game as an admin and it works fine for me.
            //          We can enable this in a Release build.
            //if (System.Environment.OSVersion.Platform == PlatformID.Win32Windows || (System.Environment.OSVersion.Platform == PlatformID.Win32NT && System.Environment.OSVersion.Version.Major < 6 ) || IsAdministrator)
            //{
                using (Game1 game = new Game1())
                {
                    //LuaFunctionAttribute.RegisterAllLuaFunctions(game, LuaInterfaceManager.LuaVM);
                    game.Run();
                }
            //}
            //else
                //MessageBox.Show("Please close this message box and run TSOClient.exe as an administrator.");
        }
예제 #2
0
        static void Main(string[] args)
        {
            //Controls whether the application is allowed to start.
            bool Exit = false;
            string Software = "";

            if ((is64BitOperatingSystem == false) && (is64BitProcess == false))
                Software = "SOFTWARE";
            else
                Software = "SOFTWARE\\Wow6432Node";

            RegistryKey softwareKey = Registry.LocalMachine.OpenSubKey(Software);
            if (Array.Exists(softwareKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("Microsoft") == 0; }))
            {
                RegistryKey msKey = softwareKey.OpenSubKey("Microsoft");
                if (Array.Exists(msKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("XNA") == 0; }))
                {
                    RegistryKey xnaKey = msKey.OpenSubKey("XNA");
                    if (Array.Exists(xnaKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("Framework") == 0; }))
                    {
                        RegistryKey asmKey = xnaKey.OpenSubKey("Framework");
                        if (!Array.Exists(asmKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("v3.1") == 0; }))
                        {
                            MessageBox.Show("XNA was found to be installed on your system, but you do not have version 3.1. Please download and install XNA version 3.1.");
                        }
                    }
                    else
                        MessageBox.Show("XNA was found to be installed on your system, but certain components are missing. Please (re)download and (re)install XNA version 3.1.");
                }
                else
                    MessageBox.Show("XNA was not found to be installed on your system. Please download and install XNA version 3.1.");
            }
            else
                MessageBox.Show("Error: No Microsoft products were found on your system.");

            if (args.Length > 0)
            {
                int ScreenWidth = int.Parse(args[0].Split("x".ToCharArray())[0]);
                int ScreenHeight = int.Parse(args[0].Split("x".ToCharArray())[1]);

                if (args.Length >= 1)
                {
                    if (args[1] == "windowed" || args[1] == "Windowed")
                        GlobalSettings.Default.Windowed = true;
                }
            }

            //Find the path to TSO on the user's system.
            softwareKey = Registry.LocalMachine.OpenSubKey("SOFTWARE");

            if (Array.Exists(softwareKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("Maxis") == 0; }))
            {
                RegistryKey maxisKey = softwareKey.OpenSubKey("Maxis");
                if (Array.Exists(maxisKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("The Sims Online") == 0; }))
                {
                    RegistryKey tsoKey = maxisKey.OpenSubKey("The Sims Online");
                    string installDir = (string)tsoKey.GetValue("InstallDir");
                    installDir += "\\TSOClient\\";
                    GlobalSettings.Default.StartupPath = installDir;
                }
                else
                {
                    MessageBox.Show("Error TSO was not found on your system.");
                    Exit = true;
                }
            }
            else
            {
                MessageBox.Show("Error: No Maxis products were found on your system.");
                Exit = true;
            }

            if (!Exit)
            {
                using (Game1 game = new Game1())
                {
                    GlobalSettings.Default.ClientVersion = GetClientVersion();
                    //This path should be used to store all files generated by the client, to avoid access conflicts.
                    GlobalSettings.Default.DocumentsPath =
                        System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Project Dollhouse\\";

                    if(!Directory.Exists(GlobalSettings.Default.DocumentsPath))
                        Directory.CreateDirectory(GlobalSettings.Default.DocumentsPath);

                    game.Run();
                }
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            //Controls whether the application is allowed to start.
            bool Exit = false;

            RegistryKey softwareKey = Registry.LocalMachine.OpenSubKey("SOFTWARE");
            if (Array.Exists(softwareKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("Microsoft") == 0; }))
            {
                RegistryKey msKey = softwareKey.OpenSubKey("Microsoft");
                if (Array.Exists(msKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("XNA") == 0; }))
                {
                    RegistryKey xnaKey = msKey.OpenSubKey("XNA");
                    if (Array.Exists(xnaKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("Framework") == 0; }))
                    {
                        RegistryKey asmKey = xnaKey.OpenSubKey("Framework");
                        if (!Array.Exists(asmKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("v3.1") == 0; }))
                        {
                            MessageBox.Show("XNA was found to be installed on your system, but you do not have version 3.1. Please download and install XNA version 3.1.");
                        }
                    }
                    else
                        MessageBox.Show("XNA was found to be installed on your system, but certain components are missing. Please (re)download and (re)install XNA version 3.1.");
                }
                else
                    MessageBox.Show("XNA was not found to be installed on your system. Please download and install XNA version 3.1.");
            }
            else
                MessageBox.Show("Error: No Microsoft products were found on your system.");

            if (args.Length > 0)
            {
                int ScreenWidth = int.Parse(args[0].Split("x".ToCharArray())[0]);
                int ScreenHeight = int.Parse(args[0].Split("x".ToCharArray())[1]);

                if (args.Length >= 1)
                {
                    if (args[1] == "windowed" || args[1] == "Windowed")
                        GlobalSettings.Default.Windowed = true;
                }
            }

            //Find the path to TSO on the user's system.
            softwareKey = Registry.LocalMachine.OpenSubKey("SOFTWARE");

            if (Array.Exists(softwareKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("Maxis") == 0; }))
            {
                RegistryKey maxisKey = softwareKey.OpenSubKey("Maxis");
                if (Array.Exists(maxisKey.GetSubKeyNames(), delegate(string s) { return s.CompareTo("The Sims Online") == 0; }))
                {
                    RegistryKey tsoKey = maxisKey.OpenSubKey("The Sims Online");
                    string installDir = (string)tsoKey.GetValue("InstallDir");
                    installDir += "\\TSOClient\\";
                    GlobalSettings.Default.StartupPath = installDir;
                }
                else
                    MessageBox.Show("Error TSO was not found on your system.");
            }
            else
            {
                MessageBox.Show("Error: No Maxis products were found on your system.");
                Exit = true;
            }

            //NICHOLAS: There is no need for this now. I'm not running the game as an admin and it works fine for me.
            //          We can enable this in a Release build.
            //if (System.Environment.OSVersion.Platform == PlatformID.Win32Windows || (System.Environment.OSVersion.Platform == PlatformID.Win32NT && System.Environment.OSVersion.Version.Major < 6 ) || IsAdministrator)
            //{
            if (!Exit)
            {
                using (Game1 game = new Game1())
                {
                    game.Run();
                }
            }
        }