Beispiel #1
0
        /// <summary>
        /// Firstly checks whether a specified CVar is valid, then if so, modifies the cvar reference
        /// </summary>
        /// <param name="name">The name of the CVar to retrieve</param>
        /// <param name="cvar">The CVar object to modify (usually blank)</param>
        /// <returns>True if the CVar exists, otherwise false</returns>
        public static bool TryGet(string name, out CVar cvar)
        {
            if ((cvar = Get(name)) != null)
            {
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// Retrieve a console variable by name - not case sensitive
        /// </summary>
        /// <param name="name">The name of the CVar to retrieve</param>
        /// <returns>null if not found, CVar instance if successful</returns>
        public static CVar Get(string name)
        {
            CVar cvar = CVars.FirstOrDefault(var => var.Name.Equals(name));

            if (cvar != default(CVar))
            {
                return(cvar);
            }

            if (NativeCVarMethods.HasCVar(name))
            {
                CVars.Add(new ExternalCVar(name));

                return(CVars.Last());
            }

            return(null);
        }
Beispiel #3
0
        /// <summary>
        /// Firstly checks whether a specified CVar is valid, then if so, modifies the cvar reference
        /// </summary>
        /// <param name="name">The name of the CVar to retrieve</param>
        /// <param name="cvar">The CVar object to modify (usually blank)</param>
        /// <returns>True if the CVar exists, otherwise false</returns>
        public static bool TryGet(string name, out CVar cvar)
        {
            if ((cvar = Get(name)) != null)
                return true;

            return false;
        }