init
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Sda.DictionaryItemEnumGenerator
|
||||
{
|
||||
public static class Generator
|
||||
{
|
||||
public static void Generate(
|
||||
[NotNull] string inputFileName,
|
||||
[NotNull] string InputDictionaryXMLFile,
|
||||
[NotNull] string ScriptOutputDir,
|
||||
[NotNull] string csharpOutput)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ScriptOutputDir))
|
||||
throw new ArgumentNullException("ScriptOutputDir");
|
||||
if (string.IsNullOrEmpty(inputFileName))
|
||||
throw new ArgumentNullException("inputFileName");
|
||||
if (string.IsNullOrEmpty(csharpOutput))
|
||||
throw new ArgumentNullException("csharpOutput");
|
||||
if (string.IsNullOrEmpty(InputDictionaryXMLFile))
|
||||
throw new ArgumentNullException("InputDictionaryXMLFile");
|
||||
try
|
||||
{
|
||||
// 1. UML-ből generált DictionaryItems.txt fájl feldolgozása
|
||||
InputDataCollection idc = new InputDataCollection();
|
||||
idc.Load(inputFileName);
|
||||
|
||||
// 2. GeneratedDictionaryItems.kres XML fájl betöltése + stringresources betöltése és feldolgozása
|
||||
GeneratedDictionaryInputDataCollection dictInputDatas = new GeneratedDictionaryInputDataCollection();
|
||||
dictInputDatas.Load(InputDictionaryXMLFile);
|
||||
|
||||
// 3. az XML és TXT fájlok összefésülése
|
||||
DictionaryItemGroupUtils dictionaryitemGroupUtils = new DictionaryItemGroupUtils();
|
||||
dictionaryitemGroupUtils.Load(idc, dictInputDatas.DictionaryItemGroups);
|
||||
|
||||
// 4. Kréta DB Scriptek generálása
|
||||
dictionaryitemGroupUtils.GenerateDBScripts(ScriptOutputDir);
|
||||
|
||||
// 5. GeneratedEnums.cs fájl generálása
|
||||
dictionaryitemGroupUtils.SaveCSharp(csharpOutput);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ArgumentException(ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal static void GenerateConsole(
|
||||
[NotNull] string inputFileName,
|
||||
[NotNull] string InputDictionaryXMLFile,
|
||||
[NotNull] string ScriptOutputDir,
|
||||
[NotNull] string csharpOutput)
|
||||
{
|
||||
if (string.IsNullOrEmpty(inputFileName))
|
||||
inputFileName = @"g:\Kreta\Main\DBScripts\DictionaryItems.txt";
|
||||
if (string.IsNullOrEmpty(InputDictionaryXMLFile))
|
||||
InputDictionaryXMLFile = @"g:\Kreta\Main\GeneratedDictionaryItems.kres";
|
||||
if (string.IsNullOrEmpty(ScriptOutputDir))
|
||||
ScriptOutputDir = @"g:\Kreta\Main\DBScripts\Mssql\";
|
||||
if (string.IsNullOrEmpty(csharpOutput))
|
||||
csharpOutput = @"g:\Kreta\Main\Kreta.Enums\";
|
||||
|
||||
FileInfo fi = new FileInfo(inputFileName);
|
||||
Console.WriteLine("InputFileName: " + fi.FullName);
|
||||
Console.WriteLine("Exists: " + fi.Exists);
|
||||
Console.WriteLine();
|
||||
//FileInfo fi2 = new FileInfo( outputFilename );
|
||||
//Console.WriteLine( "OutputDirectory: " + fi2.FullName );
|
||||
//Console.WriteLine( "Exists: " + fi2.Exists );
|
||||
if (!fi.Exists)
|
||||
{
|
||||
Console.WriteLine("Input File does Not Exists");
|
||||
Console.WriteLine("Exit Code is 1");
|
||||
Environment.ExitCode = 1;
|
||||
Environment.Exit(Environment.ExitCode);
|
||||
}
|
||||
try
|
||||
{
|
||||
// 1. UML-ből generált DictionaryItems.txt fájl feldolgozása
|
||||
InputDataCollection idc = new InputDataCollection();
|
||||
idc.Load(inputFileName);
|
||||
|
||||
// 2. GeneratedDictionaryItems.kres XML fájl betöltése + stringresources betöltése és feldolgozása
|
||||
GeneratedDictionaryInputDataCollection dictInputDatas = new GeneratedDictionaryInputDataCollection();
|
||||
dictInputDatas.Load(InputDictionaryXMLFile);
|
||||
|
||||
// 3. az XML és TXT fájlok összefésülése
|
||||
DictionaryItemGroupUtils dictionaryitemGroupUtils = new DictionaryItemGroupUtils();
|
||||
dictionaryitemGroupUtils.Load(idc, dictInputDatas.DictionaryItemGroups);
|
||||
|
||||
dictionaryitemGroupUtils.GenerateDBScripts(ScriptOutputDir);
|
||||
|
||||
dictionaryitemGroupUtils.SaveCSharp(csharpOutput);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ArgumentException(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user