private void BuildGlobalFiles(ClassInfo[] classInfos, EnumInfo[] enumInfos) { foreach (Configuration.FileInfo fileInfo in _configuration.AllGlobalFileInfos) { string templateFileName = Path.Combine(_configuration.TemplateRoot, fileInfo.template); string targetFileName = Path.Combine(_configuration.TargetRoot, fileInfo.target); targetFileName = Replacer.Replace(_configuration.ProjectReplaceInfos, targetFileName); CheckExistenceTemplateFile(templateFileName); CheckExistenceDestinationFile(targetFileName, fileInfo.overwrite); IBusinessObjectClass[] businessObjectClasses = new IBusinessObjectClass[classInfos.Length]; for (int index = 0; index < classInfos.Length; index++) { businessObjectClasses[index] = classInfos[index].objectClass; } Replacer replacer = new Replacer(templateFileName); // for each class replacer.Include( DefinedPlaceholder.INCLUDE_FOREACHCLASS, GetClassInfos(businessObjectClasses)); replacer.Repeat( DefinedPlaceholder.REPEAT_FOREACHCLASS_BEGIN, DefinedPlaceholder.REPEAT_FOREACHCLASS_END, GetClassInfos(businessObjectClasses)); // for each enum replacer.Include( DefinedPlaceholder.INCLUDE_FOREACHENUM, GetEnumInfos(enumInfos)); replacer.Repeat( DefinedPlaceholder.REPEAT_FOREACHENUM_BEGIN, DefinedPlaceholder.REPEAT_FOREACHENUM_END, GetEnumInfos(enumInfos)); // common ReplaceCommon(replacer, classInfos[0].type); replacer.Save(targetFileName); } }
private void BuildClassFile(Type type, IBusinessObjectClass businessObjectClass, IBusinessObjectProperty[] properties) { foreach (Configuration.FileInfo fileInfo in _configuration.ClassFileInfos) { string name = GetName(businessObjectClass.Identifier); string templateFileName = Path.Combine(_configuration.TemplateRoot, fileInfo.template); string targetFileName = Path.Combine(_configuration.TargetRoot, Replace(fileInfo.target, DefinedPlaceholder.DOMAIN_CLASSNAME, name)); targetFileName = Replacer.Replace(_configuration.ProjectReplaceInfos, targetFileName); CheckExistenceTemplateFile(templateFileName); CheckExistenceDestinationFile(targetFileName, fileInfo.overwrite); Replacer replacer = new Replacer(templateFileName); // for each property replacer.Include( DefinedPlaceholder.INCLUDE_FOREACHPROPERTY, GetPropertyInfos(businessObjectClass, properties)); replacer.Repeat( DefinedPlaceholder.REPEAT_FOREACHPROPERTY_BEGIN, DefinedPlaceholder.REPEAT_FOREACHPROPERTY_END, GetPropertyInfos(businessObjectClass, properties)); replacer.Repeat( DefinedPlaceholder.REPEAT_FOREACHREFERENCEDPROPERTY_BEGIN, DefinedPlaceholder.REPEAT_FOREACHREFERENCEDPROPERTY_END, GetReferencedPropertyInfos(businessObjectClass, properties, true), "isList=true"); replacer.Repeat( DefinedPlaceholder.REPEAT_FOREACHREFERENCEDPROPERTY_BEGIN, DefinedPlaceholder.REPEAT_FOREACHREFERENCEDPROPERTY_END, GetReferencedPropertyInfos(businessObjectClass, properties, false), "isList=false"); // common replacer.Replace(DefinedPlaceholder.DOMAIN_CLASSNAME, name); ReplaceCommon(replacer, type); replacer.Save(targetFileName); } }
private void BuildGlobalFiles(ClassInfo[] classInfos, EnumInfo[] enumInfos) { foreach (Configuration.FileInfo fileInfo in _configuration.AllGlobalFileInfos) { string templateFileName = Path.Combine(_configuration.TemplateRoot, fileInfo.template); string targetFileName = Path.Combine(_configuration.TargetRoot, fileInfo.target); targetFileName = Replacer.Replace(_configuration.ProjectReplaceInfos, targetFileName); CheckExistenceTemplateFile(templateFileName); CheckExistenceDestinationFile(targetFileName, fileInfo.overwrite); IBusinessObjectClass[] businessObjectClasses = new IBusinessObjectClass[classInfos.Length]; for (int index = 0; index < classInfos.Length; index++) businessObjectClasses[index] = classInfos[index].objectClass; Replacer replacer = new Replacer(templateFileName); // for each class replacer.Include( DefinedPlaceholder.INCLUDE_FOREACHCLASS, GetClassInfos(businessObjectClasses)); replacer.Repeat( DefinedPlaceholder.REPEAT_FOREACHCLASS_BEGIN, DefinedPlaceholder.REPEAT_FOREACHCLASS_END, GetClassInfos(businessObjectClasses)); // for each enum replacer.Include( DefinedPlaceholder.INCLUDE_FOREACHENUM, GetEnumInfos(enumInfos)); replacer.Repeat( DefinedPlaceholder.REPEAT_FOREACHENUM_BEGIN, DefinedPlaceholder.REPEAT_FOREACHENUM_END, GetEnumInfos(enumInfos)); // common ReplaceCommon(replacer, classInfos[0].type); replacer.Save(targetFileName); } }