/// <summary> /// 安装 /// </summary> /// <param name="autos">安装类型属性</param> /// <param name="parameter">安装参数</param> /// <returns>安装是否成功</returns> internal static bool Setup(ICollection<keyValue<Type, auto>> autos, auto.parameter parameter, bool isConfig) { bool isSetup = true; if (autos != null) { try { HashSet<Type> types = autos.getHash(value => value.Key); keyValue<Type, Type>[] depends = autos .getFind(value => value.Value.DependType != null && types.Contains(value.Value.DependType)) .getArray(value => new keyValue<Type, Type>(value.Key, value.Value.DependType)); foreach (Type type in algorithm.topologySort.Sort(depends, types, true)) { //Stopwatch time = new Stopwatch(); //time.Start(); if (!(CurrentAssembly.CreateInstance(type.FullName) as IAuto) .Run(isConfig ? config.pub.Default.LoadConfig(parameter.Copy(), type.ToString()) : parameter)) { error.Add(type.fullName() + " 安装失败"); isSetup = false; } //time.Stop(); //error.Message(parameter.ProjectName + " " + type.FullName + " : " + time.ElapsedMilliseconds.ToString() + "ms"); } } finally { cSharp.coder.Output(parameter); } } return isSetup; }