コード例 #1
0
        public string GetGameChatChannelNameFromIdentifier(string gameIdentifier)
        {
            CnCNetGame game = GameList.Find(g => g.InternalName == gameIdentifier.ToLowerInvariant());

            if (game == null)
            {
                return(null);
            }
            return(game.ChatChannel);
        }
コード例 #2
0
        public string GetGameBroadcastingChannelNameFromIdentifier(string gameIdentifier)
        {
            CnCNetGame game = GameList.Find(g => g.InternalName == gameIdentifier.ToLower());

            if (game == null)
            {
                return(null);
            }
            return(game.GameBroadcastChannel);
        }
コード例 #3
0
        /// <summary>
        /// Seeks the supported game list for a specific game's internal name and if found,
        /// returns the game's full name. Otherwise returns the internal name specified in the param.
        /// </summary>
        /// <param name="gameName">The internal name of the game to seek for.</param>
        /// <returns>The full name of a supported game based on its internal name.
        /// Returns the given parameter if the name isn't found in the supported game list.</returns>
        public string GetGameNameFromInternalName(string gameName)
        {
            CnCNetGame game = GameList.Find(g => g.InternalName == gameName.ToLowerInvariant());

            if (game == null)
            {
                return(gameName);
            }

            return(game.UIName);
        }
コード例 #4
0
        /// <summary>
        /// Gets the index of a CnCNet supported game based on its internal name.
        /// </summary>
        /// <param name="gameName">The internal name (suffix) of the game.</param>
        /// <returns>The index of the specified CnCNet game. -1 if the game is unknown or not supported.</returns>
        public int GetGameIndexFromInternalName(string gameName)
        {
            for (int gId = 0; gId < GameList.Count; gId++)
            {
                CnCNetGame game = GameList[gId];

                if (gameName.ToLowerInvariant() == game.InternalName)
                {
                    return(gId);
                }
            }

            return(-1);
        }
コード例 #5
0
        public void Initialize(GraphicsDevice gd)
        {
            GameList = new List <CnCNetGame>();

            // Default supported games.
            CnCNetGame[] defaultGames = new CnCNetGame[]
            {
                new CnCNetGame()
                {
                    ChatChannel          = "#cncnet-dta",
                    ClientExecutableName = "DTA.exe",
                    GameBroadcastChannel = "#cncnet-dta-games",
                    InternalName         = "dta",
                    RegistryInstallPath  = "HKCU\\Software\\TheDawnOfTheTiberiumAge",
                    UIName  = "Dawn of the Tiberium Age",
                    Texture = AssetLoader.TextureFromImage(Resources.dtaicon)
                },

                new CnCNetGame()
                {
                    ChatChannel          = "#cncnet-ti",
                    ClientExecutableName = "TI_Launcher.exe",
                    GameBroadcastChannel = "#cncnet-ti-games",
                    InternalName         = "ti",
                    RegistryInstallPath  = "HKCU\\Software\\TwistedInsurrection",
                    UIName  = "Twisted Insurrection",
                    Texture = AssetLoader.TextureFromImage(Resources.tiicon)
                },

                new CnCNetGame()
                {
                    ChatChannel          = "#cncnet-ts",
                    ClientExecutableName = "TiberianSun.exe",
                    GameBroadcastChannel = "#cncnet-ts-games",
                    InternalName         = "ts",
                    RegistryInstallPath  = "HKLM\\Software\\Westwood\\Tiberian Sun",
                    UIName  = "Tiberian Sun",
                    Texture = AssetLoader.TextureFromImage(Resources.tsicon)
                },

                new CnCNetGame()
                {
                    ChatChannel          = "#cncnet-mo",
                    ClientExecutableName = "MentalOmegaClient.exe",
                    GameBroadcastChannel = "#cncnet-mo-games",
                    InternalName         = "mo",
                    RegistryInstallPath  = "HKCU\\Software\\MentalOmega",
                    UIName  = "Mental Omega",
                    Texture = AssetLoader.TextureFromImage(Resources.moicon)
                },

                new CnCNetGame()
                {
                    ChatChannel          = "#cncnet-yr",
                    ClientExecutableName = "CnCNetClientYR.exe",
                    GameBroadcastChannel = "#cncnet-yr-games",
                    InternalName         = "yr",
                    RegistryInstallPath  = "HKLM\\Software\\Westwood\\Yuri's Revenge",
                    UIName  = "Yuri's Revenge",
                    Texture = AssetLoader.TextureFromImage(Resources.yricon)
                },

                new CnCNetGame()
                {
                    ChatChannel          = "#redres-lobby",
                    ClientExecutableName = "RRLauncher.exe",
                    GameBroadcastChannel = "#redres-games",
                    InternalName         = "rr",
                    RegistryInstallPath  = "HKML\\Software\\RedResurrection",
                    UIName  = "YR Red-Resurrection",
                    Texture = AssetLoader.TextureFromImage(Resources.rricon)
                },

                new CnCNetGame()
                {
                    ChatChannel          = "#cncreloaded",
                    ClientExecutableName = "CnCReloadedClient.exe",
                    GameBroadcastChannel = "#cncreloaded-games",
                    InternalName         = "cncr",
                    RegistryInstallPath  = "HKCU\\Software\\CnCReloaded",
                    UIName  = "C&C: Reloaded",
                    Texture = AssetLoader.TextureFromImage(Resources.cncricon)
                }
            };

            // CnCNet chat + unsupported games.
            CnCNetGame[] otherGames = new CnCNetGame[]
            {
                new CnCNetGame()
                {
                    ChatChannel   = "#cncnet",
                    InternalName  = "cncnet",
                    UIName        = "General CnCNet Chat",
                    AlwaysEnabled = true,
                    Texture       = AssetLoader.TextureFromImage(Resources.cncneticon)
                },

                new CnCNetGame()
                {
                    ChatChannel  = "#cncnet-td",
                    InternalName = "td",
                    UIName       = "Tiberian Dawn",
                    Supported    = false,
                    Texture      = AssetLoader.TextureFromImage(Resources.tdicon)
                },

                new CnCNetGame()
                {
                    ChatChannel  = "#cncnet-ra",
                    InternalName = "ra",
                    UIName       = "Red Alert",
                    Supported    = false,
                    Texture      = AssetLoader.TextureFromImage(Resources.raicon)
                },

                new CnCNetGame()
                {
                    ChatChannel  = "#cncnet-d2",
                    InternalName = "d2",
                    UIName       = "Dune 2000",
                    Supported    = false,
                    Texture      = AssetLoader.TextureFromImage(Resources.unknownicon)
                }
            };

            GameList.AddRange(defaultGames);
            GameList.AddRange(GetCustomGames(defaultGames.Concat(otherGames).ToList()));
            GameList.AddRange(otherGames);

            if (GetGameIndexFromInternalName(ClientConfiguration.Instance.LocalGame) == -1)
            {
                throw new ClientConfigurationException("Could not find a game in the game collection matching LocalGame value of " +
                                                       ClientConfiguration.Instance.LocalGame + ".");
            }
        }
コード例 #6
0
        public void Initialize(GraphicsDevice gd)
        {
            GameList = new List <CnCNetGame>();

            // Default supported games.
            CnCNetGame[] defaultGames = new CnCNetGame[]
            {
                new CnCNetGame()
                {
                    ChatChannel          = "#cncnet-dta",
                    ClientExecutableName = "DTA.exe",
                    GameBroadcastChannel = "#cncnet-dta-games",
                    InternalName         = "dta",
                    RegistryInstallPath  = "HKCU\\Software\\TheDawnOfTheTiberiumAge",
                    UIName  = "Dawn of the Tiberium Age",
                    Texture = AssetLoader.TextureFromImage(Resources.dtaicon)
                },

                new CnCNetGame()
                {
                    ChatChannel          = "#cncnet-ti",
                    ClientExecutableName = "TI_Launcher.exe",
                    GameBroadcastChannel = "#cncnet-ti-games",
                    InternalName         = "ti",
                    RegistryInstallPath  = "HKCU\\Software\\TwistedInsurrection",
                    UIName  = "Twisted Insurrection",
                    Texture = AssetLoader.TextureFromImage(Resources.tiicon)
                },

                new CnCNetGame()
                {
                    ChatChannel          = "#cncnet-ts",
                    ClientExecutableName = "TiberianSun.exe",
                    GameBroadcastChannel = "#cncnet-ts-games",
                    InternalName         = "ts",
                    RegistryInstallPath  = "HKLM\\Software\\Westwood\\Tiberian Sun",
                    UIName  = "Tiberian Sun",
                    Texture = AssetLoader.TextureFromImage(Resources.tsicon)
                },

                new CnCNetGame()
                {
                    ChatChannel          = "#cncnet-mo",
                    ClientExecutableName = "MentalOmegaClient.exe",
                    GameBroadcastChannel = "#cncnet-mo-games",
                    InternalName         = "mo",
                    RegistryInstallPath  = "HKCU\\Software\\MentalOmega",
                    UIName  = "Mental Omega",
                    Texture = AssetLoader.TextureFromImage(Resources.moicon)
                },

                /// Extreme Starry
                new CnCNetGame()
                {
                    ChatChannel          = "#cncnet-es",
                    ClientExecutableName = "ExtremeStarryClient.exe",
                    GameBroadcastChannel = "#cncnet-es-games",
                    InternalName         = "es",
                    RegistryInstallPath  = "HKCU\\Software\\ExtremeStarry",
                    UIName  = "Extreme Starry",
                    Texture = AssetLoader.TextureFromImage(Resources.esicon)
                },

                new CnCNetGame()
                {
                    ChatChannel          = "#cncnet-yr",
                    ClientExecutableName = "CnCNetClientYR.exe",
                    GameBroadcastChannel = "#cncnet-yr-games",
                    InternalName         = "yr",
                    RegistryInstallPath  = "HKLM\\Software\\Westwood\\Yuri's Revenge",
                    UIName  = "Yuri's Revenge",
                    Texture = AssetLoader.TextureFromImage(Resources.yricon)
                },

                new CnCNetGame()
                {
                    ChatChannel          = "#redres-lobby",
                    ClientExecutableName = "RRLauncher.exe",
                    GameBroadcastChannel = "#redres-games",
                    InternalName         = "rr",
                    RegistryInstallPath  = "HKML\\Software\\RedResurrection",
                    UIName  = "YR Red-Resurrection",
                    Texture = AssetLoader.TextureFromImage(Resources.rricon)
                },

                new CnCNetGame()
                {
                    ChatChannel          = "#projectphantom",
                    ClientExecutableName = "PPLauncher.exe",
                    GameBroadcastChannel = "#projectphantom-games",
                    InternalName         = "pp",
                    RegistryInstallPath  = "HKML\\Software\\ProjectPhantom",
                    UIName  = "Project Phantom",
                    Texture = AssetLoader.TextureFromImage(Resources.ppicon)
                }
            };

            // CnCNet chat + unsupported games.
            CnCNetGame[] otherGames = new CnCNetGame[]
            {
                new CnCNetGame()
                {
                    ChatChannel   = "#cncnet",
                    InternalName  = "cncnet",
                    UIName        = "General CnCNet Chat",
                    AlwaysEnabled = true,
                    Texture       = AssetLoader.TextureFromImage(Resources.cncneticon)
                },

                new CnCNetGame()
                {
                    ChatChannel  = "#cncnet-td",
                    InternalName = "td",
                    UIName       = "Tiberian Dawn",
                    Supported    = false,
                    Texture      = AssetLoader.TextureFromImage(Resources.tdicon)
                },

                new CnCNetGame()
                {
                    ChatChannel  = "#cncnet-ra",
                    InternalName = "ra",
                    UIName       = "Red Alert",
                    Supported    = false,
                    Texture      = AssetLoader.TextureFromImage(Resources.raicon)
                },

                new CnCNetGame()
                {
                    ChatChannel  = "#cncnet-d2",
                    InternalName = "d2",
                    UIName       = "Dune 2000",
                    Supported    = false,
                    Texture      = AssetLoader.TextureFromImage(Resources.unknownicon)
                }
            };

            GameList.AddRange(defaultGames);
            GameList.AddRange(GetCustomGames(defaultGames.Concat(otherGames).ToList()));
            GameList.AddRange(otherGames);
        }