Exemplo n.º 1
0
        /// <summary>
        ///     Attempts to remove module from <see cref="ExpressionContext.Imports"/>.
        /// </summary>
        /// <param name="mod">The module to remove</param>
        /// <returns>true if successfully removed</returns>
        public bool RemoveModule(RegenModule mod)
        {
            var imprt = Context.Imports.RootImport.FirstOrDefault(ib => ib.Name.Equals(mod.Name));

            if (imprt != null)
            {
                Context.Imports.RootImport.Remove(imprt);
                return(!Context.Imports.RootImport.Contains(imprt));
            }

            return(false);
        }
Exemplo n.º 2
0
 /// <summary>
 ///     Adds or override a module to <see cref="ExpressionContext.Imports"/>.
 /// </summary>
 /// <param name="mod">The module to add</param>
 public void AddModule(RegenModule mod)
 {
     Context.Imports.AddInstance(mod.Instance, mod.Name);
     //any changes, syncronize with CreateContext.
 }