Add embedded help.

This commit is contained in:
Starbeamrainbowlabs 2016-05-08 12:14:34 +01:00
parent 2555566dd5
commit e03b1c5426
4 changed files with 29 additions and 0 deletions

View file

@ -26,3 +26,5 @@ Vector3 position
``` ```
See the [Changelog](https://git.starbeamrainbowlabs.com/sbrl/cscz/src/master/Changelog.md) for a summary of what's changed between releases. See the [Changelog](https://git.starbeamrainbowlabs.com/sbrl/cscz/src/master/Changelog.md) for a summary of what's changed between releases.
Type `./cscz.exe --help` for usage information or see Help.md in the project folder.

9
cscz/Help.md Normal file
View file

@ -0,0 +1,9 @@
cscz - The C# Class Generator
Usage:
cat filename | ./cscz
Examples:
cat MyDef.cscz | ./cscz
tee | ./cscz >Carrot.cs

View file

@ -1,6 +1,8 @@
using System; using System;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
using System.Reflection;
using System.IO;
namespace cscz namespace cscz
{ {
@ -8,6 +10,19 @@ namespace cscz
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
if(args.Length >= 1 && args[0] == "--help")
{
Assembly asm = Assembly.GetExecutingAssembly();
/*** Debug - Lists the names of all embedded resources ***
foreach(string str in asm.GetManifestResourceNames())
Console.WriteLine(str);*/
StreamReader helpTextReader = new StreamReader(asm.GetManifestResourceStream(@"cscz.Help.md"));
string helpText = helpTextReader.ReadToEnd();
helpTextReader.Dispose();
Console.WriteLine(helpText);
return;
}
ClassGenerator cg = new ClassGenerator(); ClassGenerator cg = new ClassGenerator();
/* /*
cg.Signatures.Add("float radius"); cg.Signatures.Add("float radius");

View file

@ -43,4 +43,7 @@
<Compile Include="ClassGenerator.cs" /> <Compile Include="ClassGenerator.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<EmbeddedResource Include="Help.md" />
</ItemGroup>
</Project> </Project>