static void Main(string[] args) { LoquiGenerator gen = new LoquiGenerator() { RaisePropertyChangedDefault = false, NotifyingDefault = NotifyingType.ReactiveUI, ObjectCentralizedDefault = true, HasBeenSetDefault = false, }; gen.XmlTranslation.ShouldGenerateXSD = true; gen.XmlTranslation.ExportWithIGetter = false; var proto = gen.AddProtocol( new ProtocolGeneration( gen, new ProtocolKey("DynamicLeveledLists"), new DirectoryInfo("../../../DynamicLeveledLists")) { DefaultNamespace = "DynamicLeveledLists", }); proto.AddProjectToModify( new FileInfo(Path.Combine(proto.GenerationFolder.FullName, "DynamicLeveledLists.csproj"))); gen.Generate().Wait(); }
static void GeneratePex() { LoquiGenerator gen = new LoquiGenerator(typical: false) { NotifyingDefault = NotifyingType.None, NullableDefault = false, ToStringDefault = false, }; gen.AddTypicalTypeAssociations(); gen.Add(gen.MaskModule); var dir = new DirectoryInfo("../../../../Mutagen.Bethesda.Core/Pex/DataTypes"); var pexProto = gen.AddProtocol( new ProtocolGeneration( gen, new ProtocolKey("Pex"), dir) { DefaultNamespace = "Mutagen.Bethesda.Pex", DoGeneration = ShouldRun("Pex") }); var projFile = new FileInfo(Path.Combine(pexProto.GenerationFolder.FullName, "../../Mutagen.Bethesda.Core.csproj")); pexProto.AddProjectToModify(projFile); gen.Generate().Wait(); }
static void GenerateTester() { if (!ShouldRun("Test")) { return; } LoquiGenerator gen = new LoquiGenerator() { NotifyingDefault = NotifyingType.None, HasBeenSetDefault = false }; var xmlModule = new XmlTranslationModule(gen) { ShouldGenerateXSD = true }; gen.Add(xmlModule); var testerProto = gen.AddProtocol( new ProtocolGeneration( gen, new ProtocolKey("Tests"), new DirectoryInfo("../../../../Mutagen.Bethesda.Tests/Settings")) { DefaultNamespace = "Mutagen.Bethesda.Tests", }); testerProto.AddProjectToModify( new FileInfo("../../../../Mutagen.Bethesda.Tests/Mutagen.Bethesda.Tests.csproj")); gen.Generate().Wait(); }
public Task Modify(LoquiGenerator gen) { return(Task.WhenAll( subModules.Select( (subGen) => { return subGen.Modify(gen); }))); }
static async Task GenerateRecords() { LoquiGenerator gen = new LoquiGenerator(typical: false) { NotifyingDefault = NotifyingType.None, NullableDefault = true, ToStringDefault = false, }; gen.AddTypicalTypeAssociations(); gen.Add(gen.MaskModule); gen.Namespaces.Add("Mutagen.Bethesda.Internals"); gen.MaskModule.AddTypeAssociation <FormLinkType>(MaskModule.TypicalField); gen.MaskModule.AddTypeAssociation <GenderedType>(new GenderedItemMaskGeneration()); gen.GenerationModules.Add(new PluginModule()); gen.Add(new PluginTranslationModule(gen)); gen.AddTypeAssociation <FormLinkType>("FormLink"); gen.AddTypeAssociation <FormIDType>("FormID"); gen.AddTypeAssociation <FormKeyType>("FormKey"); gen.AddTypeAssociation <ModKeyType>("ModKey"); gen.AddTypeAssociation <RecordTypeType>("RecordType"); gen.AddTypeAssociation <BufferType>("Buffer"); gen.AddTypeAssociation <DataType>("Data"); gen.AddTypeAssociation <ZeroType>("Zero"); gen.AddTypeAssociation <CustomLogic>("CustomLogic"); gen.AddTypeAssociation <GroupType>("Group"); gen.AddTypeAssociation <GenderedType>("Gendered"); gen.AddTypeAssociation <BreakType>("Break"); gen.AddTypeAssociation <MarkerType>("Marker"); gen.ReplaceTypeAssociation <Loqui.Generation.EnumType, Mutagen.Bethesda.Generation.EnumType>(); gen.ReplaceTypeAssociation <Loqui.Generation.StringType, Mutagen.Bethesda.Generation.StringType>(); gen.ReplaceTypeAssociation <Loqui.Generation.LoquiType, Mutagen.Bethesda.Generation.MutagenLoquiType>(); gen.ReplaceTypeAssociation <Loqui.Generation.FloatType, Mutagen.Bethesda.Generation.FloatType>(); gen.ReplaceTypeAssociation <Loqui.Generation.PercentType, Mutagen.Bethesda.Generation.PercentType>(); gen.ReplaceTypeAssociation <Loqui.Generation.DictType, Mutagen.Bethesda.Generation.DictType>(); gen.ReplaceTypeAssociation <Loqui.Generation.BoolType, Mutagen.Bethesda.Generation.BoolType>(); // Always run core var bethesdaProto = gen.AddProtocol( new ProtocolGeneration( gen, new ProtocolKey("Bethesda"), new DirectoryInfo("../../../../Mutagen.Bethesda.Core/Plugins/Records")) { DefaultNamespace = "Mutagen.Bethesda.Plugins.Records", DoGeneration = ShouldRun("All") }); bethesdaProto.AddProjectToModify( new FileInfo(Path.Combine(bethesdaProto.GenerationFolder.FullName, "../../Mutagen.Bethesda.Core.csproj"))); if (ShouldRun("All")) { var proto = gen.AddProtocol( new ProtocolGeneration( gen, new ProtocolKey("All"), new DirectoryInfo("../../../../Mutagen.Bethesda/Plugins/Records")) { DefaultNamespace = "Mutagen.Bethesda", }); proto.AddProjectToModify( new FileInfo(Path.Combine(proto.GenerationFolder.FullName, "../../Mutagen.Bethesda.csproj"))); } if (ShouldRun("Oblivion")) { var proto = gen.AddProtocol( new ProtocolGeneration( gen, new ProtocolKey("Oblivion"), new DirectoryInfo("../../../../Mutagen.Bethesda.Oblivion/Records")) { DefaultNamespace = "Mutagen.Bethesda.Oblivion", }); proto.AddProjectToModify( new FileInfo(Path.Combine(proto.GenerationFolder.FullName, "../Mutagen.Bethesda.Oblivion.csproj"))); } if (ShouldRun("Skyrim")) { var proto = gen.AddProtocol( new ProtocolGeneration( gen, new ProtocolKey("Skyrim"), new DirectoryInfo("../../../../Mutagen.Bethesda.Skyrim/Records")) { DefaultNamespace = "Mutagen.Bethesda.Skyrim", }); proto.AddProjectToModify( new FileInfo(Path.Combine(proto.GenerationFolder.FullName, "../Mutagen.Bethesda.Skyrim.csproj"))); } if (ShouldRun("Fallout4")) { var proto = gen.AddProtocol( new ProtocolGeneration( gen, new ProtocolKey("Fallout4"), new DirectoryInfo("../../../../Mutagen.Bethesda.Fallout4/Records")) { DefaultNamespace = "Mutagen.Bethesda.Fallout4", }); proto.AddProjectToModify( new FileInfo(Path.Combine(proto.GenerationFolder.FullName, "../Mutagen.Bethesda.Fallout4.csproj"))); } await gen.Generate(); }
public ClassGeneration(LoquiGenerator gen, ProtocolGeneration protoGen, FilePath sourceFile) : base(gen, protoGen, sourceFile) { }
public MutagenXmlModule(LoquiGenerator gen) : base(gen) { }
public XmlTranslationModule(LoquiGenerator gen) : base(gen) { _typeGenerations[typeof(LoquiType)] = new LoquiXmlTranslationGeneration(); _typeGenerations[typeof(BoolNullType)] = new PrimitiveXmlTranslationGeneration <bool?>(); _typeGenerations[typeof(BoolType)] = new PrimitiveXmlTranslationGeneration <bool>(); _typeGenerations[typeof(CharNullType)] = new PrimitiveXmlTranslationGeneration <char?>(); _typeGenerations[typeof(CharType)] = new PrimitiveXmlTranslationGeneration <char>(); _typeGenerations[typeof(DateTimeNullType)] = new PrimitiveXmlTranslationGeneration <DateTime?>(); _typeGenerations[typeof(DateTimeType)] = new PrimitiveXmlTranslationGeneration <DateTime>(); _typeGenerations[typeof(DoubleNullType)] = new PrimitiveXmlTranslationGeneration <double?>(); _typeGenerations[typeof(DoubleType)] = new PrimitiveXmlTranslationGeneration <double>(); _typeGenerations[typeof(EnumType)] = new EnumXmlTranslationGeneration(); _typeGenerations[typeof(EnumNullType)] = new EnumXmlTranslationGeneration(); _typeGenerations[typeof(FloatNullType)] = new PrimitiveXmlTranslationGeneration <float?>("Float"); _typeGenerations[typeof(FloatType)] = new PrimitiveXmlTranslationGeneration <float>("Float"); _typeGenerations[typeof(Int8NullType)] = new PrimitiveXmlTranslationGeneration <sbyte?>("Int8"); _typeGenerations[typeof(Int8Type)] = new PrimitiveXmlTranslationGeneration <sbyte>("Int8"); _typeGenerations[typeof(Int16NullType)] = new PrimitiveXmlTranslationGeneration <short?>(); _typeGenerations[typeof(Int16Type)] = new PrimitiveXmlTranslationGeneration <short>(); _typeGenerations[typeof(Int32NullType)] = new PrimitiveXmlTranslationGeneration <int?>(); _typeGenerations[typeof(Int32Type)] = new PrimitiveXmlTranslationGeneration <int>(); _typeGenerations[typeof(Int64NullType)] = new PrimitiveXmlTranslationGeneration <long?>(); _typeGenerations[typeof(Int64Type)] = new PrimitiveXmlTranslationGeneration <long>(); _typeGenerations[typeof(P2Int32NullType)] = new PrimitiveXmlTranslationGeneration <P2Int?>(); _typeGenerations[typeof(P2Int32Type)] = new PrimitiveXmlTranslationGeneration <P2Int>(); _typeGenerations[typeof(P2Int16NullType)] = new PrimitiveXmlTranslationGeneration <P2Int16?>(); _typeGenerations[typeof(P2Int16Type)] = new PrimitiveXmlTranslationGeneration <P2Int16>(); _typeGenerations[typeof(P2FloatNullType)] = new PrimitiveXmlTranslationGeneration <P2Float?>(); _typeGenerations[typeof(P2FloatType)] = new PrimitiveXmlTranslationGeneration <P2Float>(); _typeGenerations[typeof(P3FloatNullType)] = new PrimitiveXmlTranslationGeneration <P3Float?>(); _typeGenerations[typeof(P3FloatType)] = new PrimitiveXmlTranslationGeneration <P3Float>(); _typeGenerations[typeof(P3IntNullType)] = new PrimitiveXmlTranslationGeneration <P3Int?>(); _typeGenerations[typeof(P3IntType)] = new PrimitiveXmlTranslationGeneration <P3Int>(); _typeGenerations[typeof(P3UInt8NullType)] = new PrimitiveXmlTranslationGeneration <P3UInt8?>(); _typeGenerations[typeof(P3UInt8Type)] = new PrimitiveXmlTranslationGeneration <P3UInt8>(); _typeGenerations[typeof(P3UInt16NullType)] = new PrimitiveXmlTranslationGeneration <P3UInt16?>(); _typeGenerations[typeof(P3UInt16Type)] = new PrimitiveXmlTranslationGeneration <P3UInt16>(); _typeGenerations[typeof(P3Int16NullType)] = new PrimitiveXmlTranslationGeneration <P3Int16?>(); _typeGenerations[typeof(P3Int16Type)] = new PrimitiveXmlTranslationGeneration <P3Int16>(); _typeGenerations[typeof(P3DoubleNullType)] = new PrimitiveXmlTranslationGeneration <P3Double?>(); _typeGenerations[typeof(P3DoubleType)] = new PrimitiveXmlTranslationGeneration <P3Double>(); _typeGenerations[typeof(PercentNullType)] = new PrimitiveXmlTranslationGeneration <Percent?>(); _typeGenerations[typeof(PercentType)] = new PercentXmlTranslationGeneration(); _typeGenerations[typeof(RangeDoubleNullType)] = new PrimitiveXmlTranslationGeneration <RangeDouble?>(); _typeGenerations[typeof(RangeDoubleType)] = new PrimitiveXmlTranslationGeneration <RangeDouble>(); _typeGenerations[typeof(StringType)] = new PrimitiveXmlTranslationGeneration <string>(nullable: true) { CanBeNotNullable = false }; _typeGenerations[typeof(TypicalRangedIntType <RangeInt8?>)] = new PrimitiveXmlTranslationGeneration <RangeInt8?>(); _typeGenerations[typeof(TypicalRangedIntType <RangeInt8>)] = new PrimitiveXmlTranslationGeneration <RangeInt8>(); _typeGenerations[typeof(TypicalRangedIntType <RangeInt16?>)] = new PrimitiveXmlTranslationGeneration <RangeInt16?>(); _typeGenerations[typeof(TypicalRangedIntType <RangeInt16>)] = new PrimitiveXmlTranslationGeneration <RangeInt16>(); _typeGenerations[typeof(TypicalRangedIntType <RangeInt32?>)] = new PrimitiveXmlTranslationGeneration <RangeInt32?>(); _typeGenerations[typeof(TypicalRangedIntType <RangeInt32>)] = new PrimitiveXmlTranslationGeneration <RangeInt32>(); _typeGenerations[typeof(TypicalRangedIntType <RangeInt64?>)] = new PrimitiveXmlTranslationGeneration <RangeInt64?>(); _typeGenerations[typeof(TypicalRangedIntType <RangeInt64>)] = new PrimitiveXmlTranslationGeneration <RangeInt64>(); _typeGenerations[typeof(TypicalRangedIntType <RangeUInt8?>)] = new PrimitiveXmlTranslationGeneration <RangeUInt8?>(); _typeGenerations[typeof(TypicalRangedIntType <RangeUInt8>)] = new PrimitiveXmlTranslationGeneration <RangeUInt8>(); _typeGenerations[typeof(TypicalRangedIntType <RangeUInt16?>)] = new PrimitiveXmlTranslationGeneration <RangeUInt16?>(); _typeGenerations[typeof(TypicalRangedIntType <RangeUInt16>)] = new PrimitiveXmlTranslationGeneration <RangeUInt16>(); _typeGenerations[typeof(TypicalRangedIntType <RangeUInt32?>)] = new PrimitiveXmlTranslationGeneration <RangeUInt32?>(); _typeGenerations[typeof(TypicalRangedIntType <RangeUInt32>)] = new PrimitiveXmlTranslationGeneration <RangeUInt32>(); _typeGenerations[typeof(TypicalRangedIntType <RangeUInt64?>)] = new PrimitiveXmlTranslationGeneration <RangeUInt64?>(); _typeGenerations[typeof(TypicalRangedIntType <RangeUInt64>)] = new PrimitiveXmlTranslationGeneration <RangeUInt64>(); _typeGenerations[typeof(UDoubleNullType)] = new PrimitiveXmlTranslationGeneration <UDouble?>(); _typeGenerations[typeof(UDoubleType)] = new PrimitiveXmlTranslationGeneration <UDouble>(); _typeGenerations[typeof(UInt8NullType)] = new PrimitiveXmlTranslationGeneration <byte?>(); _typeGenerations[typeof(UInt8Type)] = new PrimitiveXmlTranslationGeneration <byte>(); _typeGenerations[typeof(UInt16NullType)] = new PrimitiveXmlTranslationGeneration <ushort?>(); _typeGenerations[typeof(UInt16Type)] = new PrimitiveXmlTranslationGeneration <ushort>(); _typeGenerations[typeof(UInt32NullType)] = new PrimitiveXmlTranslationGeneration <uint?>(); _typeGenerations[typeof(UInt32Type)] = new PrimitiveXmlTranslationGeneration <uint>(); _typeGenerations[typeof(UInt64NullType)] = new PrimitiveXmlTranslationGeneration <ulong?>(); _typeGenerations[typeof(UInt64Type)] = new PrimitiveXmlTranslationGeneration <ulong>(); _typeGenerations[typeof(FilePathType)] = new PrimitiveXmlTranslationGeneration <FilePath>(); _typeGenerations[typeof(FilePathNullType)] = new PrimitiveXmlTranslationGeneration <FilePath?>(); _typeGenerations[typeof(DirectoryPathType)] = new PrimitiveXmlTranslationGeneration <DirectoryPath>(); _typeGenerations[typeof(DirectoryPathNullType)] = new PrimitiveXmlTranslationGeneration <DirectoryPath?>(); _typeGenerations[typeof(ListType)] = new ListXmlTranslationGeneration(); _typeGenerations[typeof(DictType)] = new DictXmlTranslationGeneration(); _typeGenerations[typeof(ByteArrayType)] = new ByteArrayXmlTranslationGeneration(); _typeGenerations[typeof(NothingType)] = new NothingXmlTranslationGeneration(); _typeGenerations[typeof(ColorType)] = new PrimitiveXmlTranslationGeneration <Color>(); MainAPI = new TranslationModuleAPI( writerAPI: new MethodAPI( majorAPI: new APILine[] { XElementLine }, customAPI: null, optionalAPI: new APILine[] { NameLine }), readerAPI: new MethodAPI( majorAPI: new APILine[] { XElementLine }, customAPI: null, optionalAPI: null)); MinorAPIs.Add( new TranslationModuleAPI( writerAPI: new MethodAPI( majorAPI: new APILine[] { PathLine }, customAPI: null, optionalAPI: new APILine[] { NameLine }), readerAPI: new MethodAPI( majorAPI: new APILine[] { PathLine }, customAPI: null, optionalAPI: null)) { Funnel = new TranslationFunnel( MainAPI, ConvertFromPathOut, ConvertFromPathIn) }); var stream = new APILine("Stream", "Stream stream"); MinorAPIs.Add( new TranslationModuleAPI( writerAPI: new MethodAPI( majorAPI: new APILine[] { stream }, customAPI: null, optionalAPI: new APILine[] { NameLine }), readerAPI: new MethodAPI( majorAPI: new APILine[] { stream }, customAPI: null, optionalAPI: null)) { Funnel = new TranslationFunnel( MainAPI, ConvertFromStreamOut, ConvertFromStreamIn) }); }
public BinaryTranslationModule(LoquiGenerator gen) : base(gen) { }
static void GenerateRecords() { LoquiGenerator gen = new LoquiGenerator(typical: false) { NotifyingDefault = NotifyingType.None, HasBeenSetDefault = true, ToStringDefault = false, }; gen.AddTypicalTypeAssociations(); var xmlGen = new MutagenXmlModule(gen); gen.Add(xmlGen); gen.Add(gen.MaskModule); gen.Namespaces.Add("Mutagen.Bethesda.Internals"); xmlGen.ShouldGenerateXSD = false; xmlGen.AddTypeAssociation <FormLinkType>(new FormLinkXmlTranslationGeneration()); xmlGen.AddTypeAssociation <FormIDType>(new PrimitiveXmlTranslationGeneration <FormID>()); xmlGen.AddTypeAssociation <FormKeyType>(new PrimitiveXmlTranslationGeneration <FormKey>()); xmlGen.AddTypeAssociation <ModKeyType>(new PrimitiveXmlTranslationGeneration <ModKey>()); xmlGen.AddTypeAssociation <RecordTypeType>(new PrimitiveXmlTranslationGeneration <RecordType>()); xmlGen.AddTypeAssociation <DataType>(new DataTypeXmlTranslationGeneration()); xmlGen.AddTypeAssociation <GenderedType>(new GenderedTypeXmlTranslationGeneration()); xmlGen.AddTypeAssociation <Loqui.Generation.StringType>(new StringXmlTranslationGeneration(), overrideExisting: true); xmlGen.AddTypeAssociation <Mutagen.Bethesda.Generation.StringType>(new StringXmlTranslationGeneration()); gen.MaskModule.AddTypeAssociation <FormLinkType>(MaskModule.TypicalField); gen.MaskModule.AddTypeAssociation <GenderedType>(new GenderedItemMaskGeneration()); gen.GenerationModules.Add(new MutagenModule()); gen.Add(new BinaryTranslationModule(gen)); gen.AddTypeAssociation <FormLinkType>("FormLink"); gen.AddTypeAssociation <FormIDType>("FormID"); gen.AddTypeAssociation <FormKeyType>("FormKey"); gen.AddTypeAssociation <ModKeyType>("ModKey"); gen.AddTypeAssociation <RecordTypeType>("RecordType"); gen.AddTypeAssociation <BufferType>("Buffer"); gen.AddTypeAssociation <DataType>("Data"); gen.AddTypeAssociation <ZeroType>("Zero"); gen.AddTypeAssociation <CustomLogic>("CustomLogic"); gen.AddTypeAssociation <TransferType>("Transfer"); gen.AddTypeAssociation <GroupType>("Group"); gen.AddTypeAssociation <GenderedType>("Gendered"); gen.AddTypeAssociation <BreakType>("Break"); gen.ReplaceTypeAssociation <Loqui.Generation.EnumType, Mutagen.Bethesda.Generation.EnumType>(); gen.ReplaceTypeAssociation <Loqui.Generation.StringType, Mutagen.Bethesda.Generation.StringType>(); gen.ReplaceTypeAssociation <Loqui.Generation.LoquiType, Mutagen.Bethesda.Generation.MutagenLoquiType>(); gen.ReplaceTypeAssociation <Loqui.Generation.FloatType, Mutagen.Bethesda.Generation.FloatType>(); gen.ReplaceTypeAssociation <Loqui.Generation.PercentType, Mutagen.Bethesda.Generation.PercentType>(); gen.ReplaceTypeAssociation <Loqui.Generation.DictType, Mutagen.Bethesda.Generation.DictType>(); gen.ReplaceTypeAssociation <Loqui.Generation.BoolType, Mutagen.Bethesda.Generation.BoolType>(); // Always run core var bethesdaProto = gen.AddProtocol( new ProtocolGeneration( gen, new ProtocolKey("Bethesda"), new DirectoryInfo("../../../../Mutagen.Bethesda.Core/Records")) { DefaultNamespace = "Mutagen.Bethesda", }); bethesdaProto.AddProjectToModify( new FileInfo(Path.Combine(bethesdaProto.GenerationFolder.FullName, "../Mutagen.Bethesda.Core.csproj"))); if (ShouldRun("All")) { var proto = gen.AddProtocol( new ProtocolGeneration( gen, new ProtocolKey("All"), new DirectoryInfo("../../../../Mutagen.Bethesda/Records")) { DefaultNamespace = "Mutagen.Bethesda", }); proto.AddProjectToModify( new FileInfo(Path.Combine(proto.GenerationFolder.FullName, "../Mutagen.Bethesda.csproj"))); } if (ShouldRun("Oblivion")) { var proto = gen.AddProtocol( new ProtocolGeneration( gen, new ProtocolKey("Oblivion"), new DirectoryInfo("../../../../Mutagen.Bethesda.Oblivion/Records")) { DefaultNamespace = "Mutagen.Bethesda.Oblivion", }); proto.AddProjectToModify( new FileInfo(Path.Combine(proto.GenerationFolder.FullName, "../Mutagen.Bethesda.Oblivion.csproj"))); } if (ShouldRun("Skyrim")) { var proto = gen.AddProtocol( new ProtocolGeneration( gen, new ProtocolKey("Skyrim"), new DirectoryInfo("../../../../Mutagen.Bethesda.Skyrim/Records")) { DefaultNamespace = "Mutagen.Bethesda.Skyrim", }); proto.AddProjectToModify( new FileInfo(Path.Combine(proto.GenerationFolder.FullName, "../Mutagen.Bethesda.Skyrim.csproj"))); } gen.Generate().Wait(); }