public void AssemblyStart(Assembly assembly, IAutoCodeGeneratorContext context) { foreach (var def in Defs.Where(a => a.TargetAssembly == assembly)) { var ns = context.GetOrCreateNamespace(assembly.GetName().Name); var csStruct = ns.GetOrCreateClass(def.TypeName); csStruct.Description = def.TypeDescription; csStruct.IsPartial = true; // csStruct.Kind = CsNamespaceMemberKind.Struct; csStruct.AddProperty(def.ValuePropertyName, def.CsWrappedType) .WithMakeAutoImplementIfPossible() .WithIsPropertyReadOnly() .WithNoEmitField(); AddConstructor(csStruct, def); AddEqualsMethods(csStruct, def); AddGetHashCodeMethod(csStruct, def); AddToStringMethod(csStruct, def); if (def.WrappedType == WrappedTypes.Int) { csStruct.ImplementedInterfaces.Add(csStruct.GetTypeName <IIntegerBasedKey>()); } } }
public void AssemblyStart(Assembly assembly, IAutoCodeGeneratorContext context) { var projectDir = _assemblyBaseDirectoryProvider.GetBaseDirectory(assembly); foreach (var item in ItemsToCreate) { if (item.TargetAssembly != assembly) { continue; } var csFile = new CsFile(); foreach (var ns in AllGenerators.GetFileImportNamespaces()) { csFile.AddImportNamespace(ns); } var privContext = new MyWrappedContext(csFile); SingleTaskEnumsGenerator.CreateCode(privContext, item); var fileToSave = item.GetFileName(projectDir); if (csFile.SaveIfDifferent(fileToSave.FullName)) { context.FileSaved(fileToSave); } } }
public void AssemblyEnd(Assembly assembly, IAutoCodeGeneratorContext context) { }