Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

[DO NOT MERGE] Create New Tool LGgen #1283

Closed
wants to merge 11 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
LGgen basic structure + LG interface
t-hahan committed Aug 13, 2019
commit 5701081b9210451efb1a99f2f8d327a2a1480951
25 changes: 25 additions & 0 deletions packages/LGgen/LGgen.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29201.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LGgen", "LGgen\LGgen.csproj", "{78727352-DA0F-4E1C-A57B-F1D11A2B2138}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{78727352-DA0F-4E1C-A57B-F1D11A2B2138}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78727352-DA0F-4E1C-A57B-F1D11A2B2138}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78727352-DA0F-4E1C-A57B-F1D11A2B2138}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78727352-DA0F-4E1C-A57B-F1D11A2B2138}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BD0D2E7C-4996-4B68-9932-40ECB6B0CE64}
EndGlobalSection
EndGlobal
12 changes: 12 additions & 0 deletions packages/LGgen/LGgen/LGgen.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bot.Builder.LanguageGeneration" Version="4.6.0-Daily-2019-08-12-01-composer" />
</ItemGroup>

</Project>
75 changes: 75 additions & 0 deletions packages/LGgen/LGgen/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System;
using System.Reflection;
using System.Resources;
using System.Runtime;
using System.Runtime.Serialization.Formatters;

namespace LGgen
{
class Program
{
static void Usage()
{
Console.Error.WriteLine("LGgen [-l cs/ts] [-i LG_FILE_PATH] [-o OUTPUT_PATH]");
Console.Error.WriteLine("Generate a strongly typed class from a LG file");
Console.Error.WriteLine("-l cs/ts : select C# or Typescript.");
Console.Error.WriteLine("-i : LG file path");
Console.Error.WriteLine("-o : output path, defaults to directory where LG file is and the same name with LG file");
System.Environment.Exit(-1);
}

static void Main(string[] args)
{
string lang = null;
string input = null;
string output = null;
//Usage();

if (args == null) Usage();


for (var i = 0; i < args.Length; ++i)
{
var arg = args[i];
switch(arg)
{
case "-l" :
lang = args[++i];
break;

case "-i" :
input = args[++i];
break;

case "-o" :
if (args.Length == i + 1)
{
output = input.Substring(0, input.IndexOf('.'));
switch(lang)
{
case "cs":
output += ".cs";
break;
case "ts":
output += ".ts";
break;
}
}
else
{
output = args[++i];
}
break;
default:
Usage();
break;
}
};

CSharp.test();



}
}
}
18 changes: 18 additions & 0 deletions packages/LGgen/LGgen/csharp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Bot.Builder.LanguageGeneration;

namespace LGgen
{
class CSharp
{
public static void test()
{
TemplateEngine lgEngine = new TemplateEngine();
lgEngine.AddFile("C:/Users/t-hahan/Desktop/New folder/mytest.lg");
lgEngine.Templates.ForEach(num => Console.WriteLine(num.Name));

}
}
}