File tree Expand file tree Collapse file tree 5 files changed +42
-3
lines changed
Expand file tree Collapse file tree 5 files changed +42
-3
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,41 @@ foreach (var register in deviceRegisters)
6868}
6969#>
7070 };
71+
72+ /// <summary>
73+ /// Gets the contents of the metadata file describing the <see cref="<#= deviceName #>"/>
74+ /// device registers.
75+ /// </summary>
76+ public static readonly string Metadata = GetDeviceMetadata();
77+
78+ static string GetDeviceMetadata()
79+ {
80+ var deviceType = typeof(Device);
81+ using var metadataStream = deviceType.Assembly.GetManifestResourceStream($"{deviceType.Namespace}.device.yml");
82+ using var streamReader = new System.IO.StreamReader(metadataStream);
83+ return streamReader.ReadToEnd();
84+ }
85+ }
86+
87+ /// <summary>
88+ /// Represents an operator that returns the contents of the metadata file
89+ /// describing the <see cref="<#= deviceName #>"/> device registers.
90+ /// </summary>
91+ [Description("Returns the contents of the metadata file describing the <#= deviceName #> device registers.")]
92+ public partial class GetMetadata : Source<string>
93+ {
94+ /// <summary>
95+ /// Returns an observable sequence with the contents of the metadata file
96+ /// describing the <see cref="<#= deviceName #>"/> device registers.
97+ /// </summary>
98+ /// <returns>
99+ /// A sequence with a single <see cref="string"/> object representing the
100+ /// contents of the metadata file.
101+ /// </returns>
102+ public override IObservable<string> Generate()
103+ {
104+ return Observable.Return(Device.Metadata);
105+ }
71106 }
72107
73108 /// <summary>
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22
33 <PropertyGroup >
4- <VersionPrefix >0.2 .0</VersionPrefix >
4+ <VersionPrefix >0.3 .0</VersionPrefix >
55 <VersionSuffix ></VersionSuffix >
66 <PackageId >Harp.Generators</PackageId >
77 <Title >Harp Generators</Title >
Original file line number Diff line number Diff line change 1515 <FirmwarePath >..\Firmware\$projectname$</FirmwarePath >
1616 </PropertyGroup >
1717 <ItemGroup >
18- <PackageReference Include =" Harp.Generators" Version =" 0.1 .0" GeneratePathProperty =" true" />
18+ <PackageReference Include =" Harp.Generators" Version =" 0.3 .0" GeneratePathProperty =" true" />
1919 </ItemGroup >
2020 <Target Name =" TextTransform" BeforeTargets =" AfterBuild" >
2121 <PropertyGroup >
Original file line number Diff line number Diff line change 2323 <PackageReference Include =" Bonsai.Harp" Version =" 3.5.0" />
2424 </ItemGroup >
2525
26+ <ItemGroup >
27+ <EmbeddedResource Include =" ..\..\device.yml" />
28+ </ItemGroup >
29+
2630</Project >
Original file line number Diff line number Diff line change 22
33 <PropertyGroup >
44 <PackageType >Template</PackageType >
5- <VersionPrefix >0.1.2 </VersionPrefix >
5+ <VersionPrefix >0.2.0 </VersionPrefix >
66 <VersionSuffix ></VersionSuffix >
77 <PackageId >Harp.Templates</PackageId >
88 <Title >Harp Templates</Title >
You can’t perform that action at this time.
0 commit comments