Esempio n. 1
0
        private bool SafeCheck(ILibrarian lib)
        {
            try {
                return(lib.Check());
            } catch (Exception e) {
                SLogger <LiYinLoader> .Warn($"An error occurred when checking a librarian", e);

                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 获取传入的所有程序集的入口实现
        /// </summary>
        /// <returns>所有入口类</returns>
        private IEnumerable <ILibrarian> GetLibrarianFrom(IEnumerable <Assembly> assemblies)
        {
            List <ILibrarian> result = new List <ILibrarian>();

            foreach (var ass in assemblies)
            {
                try
                {
                    ILibrarian lib = GetLibrarianFrom(ass);
                    if (lib.Check())
                    {
                        lib.Ready();
                        result.Add(lib);
                    }
                }
                catch (Exception ex)
                {
                    Logger.Warn($"加载与检查{ass.GetName().Name}的入口类时失败,该程序集无法被加载为秋之盒拓展", ex);
                }
            }
            return(result);
        }