예제 #1
0
        /// <summary>
        /// ExcuteAllInstallEvent
        /// </summary>
        public static void ExcuteAllInstallEvent()
        {
            var pls = AllPlugins.ToList().FindAll(a => a.Installed && a.NeedInstalled);

            foreach (var a in pls)
            {
                // 如果已安装过则跳过,未安装过的往下走,如果未安装的发现自己有Dependence则先安装Dependence,深度优先安装
                if (a.IsEnabled)
                {
                    continue;
                }
                a.NeedInstalled = false;
                a.IsEnabled     = false;
                a.Installed     = true;

                // 安装dependences
                foreach (var p in a.Dependences)
                {
                    var dp = pls.FirstOrDefault(x => x.SystemName == p);
                    if (dp == null)
                    {
                        // 找不到自己dependence的情况。。。
                        a.RuntimeInformation = string.Format("Plugin '{0}' start up failed, Dependence {1} can't be found.", a.SystemName, p);
                        LoggerMan.Error(a.RuntimeInformation);
                        break;
                    }

                    InstallPlugin(dp);
                }

                // 安装自己
                InstallPlugin(a);
            }
        }
예제 #2
0
        private static void MarkPlugin(string systemName, bool bolIn)
        {
            if (String.IsNullOrEmpty(systemName))
            {
                throw new ArgumentNullException("systemName");
            }
            var pl = AllPlugins.ToList().Find(a => a.SystemName == systemName);

            if (pl.Installed != bolIn)
            {
                pl.Installed     = bolIn;
                pl.NeedInstalled = bolIn;
                try
                {
                    PluginFileParser.SavePluginDescriptionFile(pl);
                }
                catch (Exception ex)
                {
                    pl.Installed = !bolIn;
                    LoggerMan.Error(ex);
                }
            }
        }
예제 #3
0
 /// <summary>
 /// SavePlugins
 /// </summary>
 /// <param name="pluginDescriptor"></param>
 public static void SavePlugins(
     PluginDescriptor pluginDescriptor)
 {
     AllPlugins.ToList().Add(pluginDescriptor);
 }