/// <summary>
        /// Initializes various basic systems like the client's logger,
        /// constants, and the general exception handler.
        /// Reads the user's settings from an INI file,
        /// checks for necessary permissions and starts the client if
        /// everything goes as it should.
        /// </summary>
        /// <param name="parameters">The client's startup parameters.</param>
        public static void Initialize(StartupParams parameters)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(HandleExcept);

            Environment.CurrentDirectory = ProgramConstants.GamePath;

            CheckPermissions();

            Logger.Initialize(ProgramConstants.GamePath + "Client/", "client.log");
            Logger.WriteLogFile = true;

            if (!Directory.Exists(ProgramConstants.GamePath + "Client"))
            {
                Directory.CreateDirectory(ProgramConstants.GamePath + "Client");
            }

            File.Delete(ProgramConstants.GamePath + "Client/client.log");

            MainClientConstants.Initialize();

            Logger.Log("***Logfile for " + MainClientConstants.GAME_NAME_LONG + " client***");
            Logger.Log("Client version: " + Application.ProductVersion);

            // Log information about given startup params
            if (parameters.NoAudio)
            {
                Logger.Log("Startup parameter: No audio");
            }

            if (parameters.MultipleInstanceMode)
            {
                Logger.Log("Startup parameter: Allow multiple client instances");
            }

            parameters.UnknownStartupParams.ForEach(p => Logger.Log("Unknown startup parameter: " + p));

            Logger.Log("Loading settings.");

            UserINISettings.Initialize(ClientConfiguration.Instance.SettingsIniName);

            // Delete obsolete files from old target project versions

            File.Delete(ProgramConstants.GamePath + "mainclient.log");
            File.Delete(ProgramConstants.GamePath + "launchupdt.dat");
            try
            {
                File.Delete(ProgramConstants.GamePath + "wsock32.dll");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Deleting wsock32.dll failed! Please close any " +
                                "applications that could be using the file, and then start the client again."
                                + Environment.NewLine + Environment.NewLine +
                                "Message: " + ex.Message,
                                "CnCNet Client");
                Environment.Exit(0);
            }

            Application.EnableVisualStyles();

            new Startup().Execute();
        }
 public GameOptionsPanel(WindowManager windowManager, UserINISettings iniSettings, XNAControl topBar)
     : base(windowManager, iniSettings)
 {
     this.topBar = topBar;
 }
 public ComponentsPanel(WindowManager windowManager, UserINISettings iniSettings)
     : base(windowManager, iniSettings)
 {
 }
 public XNAOptionsPanel(WindowManager windowManager,
                        UserINISettings iniSettings) : base(windowManager)
 {
     IniSettings      = iniSettings;
     CustomGUICreator = optionsGUICreator;
 }
Example #5
0
 public AudioOptionsPanel(WindowManager windowManager, UserINISettings iniSettings)
     : base(windowManager, iniSettings)
 {
 }
Example #6
0
        public static void Initialize(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(HandleExcept);

            Environment.CurrentDirectory = MainClientConstants.gamepath;

            CheckPermissions();

            Logger.Initialize(MainClientConstants.gamepath + "Client\\", "client.log");
            Logger.WriteLogFile = true;

            if (!Directory.Exists(MainClientConstants.gamepath + "Client"))
            {
                Directory.CreateDirectory(MainClientConstants.gamepath + "Client");
            }

            File.Delete(MainClientConstants.gamepath + "Client\\client.log");

            MainClientConstants.Initialize();

            Logger.Log("***Logfile for " + MainClientConstants.GAME_NAME_LONG + " client***");
            Logger.Log("Client version: " + Application.ProductVersion);

            Logger.Log("Loading settings.");

            UserINISettings.Initialize(ClientConfiguration.Instance.SettingsIniName);

            // Delete obsolete files from old target project versions

            File.Delete(MainClientConstants.gamepath + "mainclient.log");
            File.Delete(MainClientConstants.gamepath + "launchupdt.dat");
            try
            {
                File.Delete(MainClientConstants.gamepath + "wsock32.dll");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Deleting wsock32.dll failed! Please close any applications that could be using the file, and then start the client again." + Environment.NewLine + Environment.NewLine +
                                "Message: " + ex.Message,
                                "CnCNet Client");
                Environment.Exit(0);
            }

            Application.EnableVisualStyles();

            int argsLength = args.GetLength(0);

            for (int arg = 0; arg < argsLength; arg++)
            {
                string argument = args[arg].ToUpper();

                switch (argument)
                {
                case "-NOAUDIO":
                    AudioMaster.DisableSounds = true;
                    Logger.Log("Startup parameter: Audio disabled");
                    break;

                default:
                    Logger.Log("Unknown startup parameter: " + argument);
                    break;
                }
            }

            new Startup().Execute();
        }
 public CnCNetOptionsPanel(WindowManager windowManager, UserINISettings iniSettings,
                           GameCollection gameCollection)
     : base(windowManager, iniSettings)
 {
     this.gameCollection = gameCollection;
 }
Example #8
0
 public XNAOptionsPanel(WindowManager windowManager,
                        UserINISettings iniSettings) : base(windowManager)
 {
     IniSettings = iniSettings;
 }