public GenerateSettings(IGenerator generator, List<Type> generatorTypeList, List<Type> wizardTypeList, List<string> moduleList) : this() { try { _generator = generator; _moduleList = moduleList; _generatorTypeList = generatorTypeList; _wizardTypeList = wizardTypeList; var globalCacheFile = new GlobalCacheFile(); var cacheFile = new ModelCacheFile(_generator); foreach (var v in generatorTypeList) { var attribute = v.GetCustomAttributes(typeof(GeneratorProjectAttribute), true).Cast<GeneratorProjectAttribute>().FirstOrDefault(); if (!globalCacheFile.ExcludeList.Contains(v.FullName)) { _generatorMap.Add(attribute.Name, v); } } LoadGenerators(true); //Add modules foreach (var s in moduleList.OrderBy(x => x)) { chkModule.Items.Add(s); if (cacheFile.GeneratedModuleList.Count(x => x.ToLower() == s.ToLower()) > 0) chkModule.SetItemChecked(chkModule.Items.Count - 1, true); } if (moduleList.Count == 0) { wizard1.WizardPages.Remove(pageModules); } wizard1.FinishEnabled = (moduleList.Count == 0); } catch (Exception ex) { throw; } }
private void LoadGenerators(bool isMain) { try { var globalCacheFile = new GlobalCacheFile(); var cacheFile = new ModelCacheFile(_generator); tvwProjects.Nodes.Clear(); foreach (var key in _generatorMap.Keys) { var sysType = _generatorMap[key]; if (!globalCacheFile.ExcludeList.Contains(sysType.FullName)) { var attribute = sysType.GetCustomAttributes(typeof(GeneratorProjectAttribute), true).Cast<GeneratorProjectAttribute>().FirstOrDefault(); if ((isMain && attribute.IsMain) || !isMain) { var typeName = string.Empty; if (attribute.CurrentType != null) typeName = attribute.CurrentType.ToString(); var node = tvwProjects.Nodes.Add(typeName, attribute.Name); node.Tag = attribute; if (_wizardTypeList != null) { node.Checked = _wizardTypeList.Contains(sysType); } else { node.Checked = !cacheFile.ExcludeList.Contains(sysType.FullName); } } } } } catch (Exception ex) { throw; } }