Ejemplo n.º 1
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 (Native.ConsoleInterop.HasCVar(name))
            {
                CVars.Add(new ExternalCVar(name));

                return(CVars.Last());
            }

            return(null);
        }
Ejemplo n.º 2
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)
 {
     return((cvar = Get(name)) != null);
 }
Ejemplo n.º 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)
 {
     return (cvar = Get(name)) != null;
 }