/// <summary> /// Converters the specified models. /// </summary> /// <param name="models">The models.</param> /// <returns></returns> public static List <AddInAssemblyModel> Converter(IEnumerable <AddInModel> models) { var result = new List <AddInAssemblyModel>(); using (var eum = models.GetEnumerator()) { while (eum.MoveNext()) { var model = new AddInAssemblyModel() { Path = eum.Current.Path }; if (eum.Current.Childs != null) { foreach (var item in eum.Current.Childs) { model.Types.Add(item.Name); } } if (model.Types.Count > 0) { result.Add(model); } } } return(result); }
/// <summary> /// Reads the models. /// </summary> /// <returns></returns> public static List <AddInAssemblyModel> ReadModels() { var result = new List <AddInAssemblyModel>(); if (!File.Exists(Helper.GlobalHelper.AddInManagerAssemblyFile)) { return(result); } var array = File.ReadAllLines(Helper.GlobalHelper.AddInManagerAssemblyFile); if (array.Length == 0) { return(result); } foreach (var item in array) { var sp = item.Split(new char[] { ';' }, System.StringSplitOptions.RemoveEmptyEntries); if (sp.Length < 2) { continue; } var model = new AddInAssemblyModel() { Path = sp[0].Trim() }; for (int i = 1; i < sp.Length; i++) { model.Types.Add(sp[i].Trim()); } result.Add(model); } return(result); }