private static void GenerateGlueForOpenPetraCore(TCmdOpts ACmd, string AOutputDir) { TNamespace namespaceRoot; try { Console.WriteLine("parsing all cs files for namespaces..."); namespaceRoot = TNamespace.ParseFromDirectory(AOutputDir + "/Server/lib/"); if (namespaceRoot.Children.Count < 1) { Console.WriteLine("problems with parsing namespaces from " + AOutputDir + "/Server/lib/"); Environment.Exit(-1); } } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Environment.Exit(-1); return; } try { /* * CreateInstantiators instantiators = new CreateInstantiators(); * instantiators.CreateFiles(namespaceRoot, OutputDir + "/Server/lib", cmd.GetOptValue("TemplateDir")); * TCreateConnectors connectors = new TCreateConnectors(); * connectors.CreateFiles(namespaceRoot, OutputDir + "/Server/lib", cmd.GetOptValue("TemplateDir")); */ CreateInterfaces interfaces = new CreateInterfaces(); interfaces.CreateFiles(namespaceRoot, AOutputDir + "/Shared/lib/Interfaces", ACmd.GetOptValue("TemplateDir")); GenerateClientGlue.GenerateCode(namespaceRoot, AOutputDir + "/Client/app/Core/Remoteobjects", ACmd.GetOptValue("TemplateDir")); GenerateClientGlue.GenerateConnectorCode(AOutputDir + "/../Common/Remoting/Client", ACmd.GetOptValue("TemplateDir")); GenerateServerGlue.GenerateCode(namespaceRoot, AOutputDir + "/Server/app/WebService", ACmd.GetOptValue("TemplateDir")); namespaceRoot = new TNamespace(); TNamespace ServerAdminNamespace = new TNamespace("ServerAdmin"); namespaceRoot.Children.Add("ServerAdmin", ServerAdminNamespace); TNamespace ServerAdminWebConnectorNamespace = new TNamespace("WebConnectors"); ServerAdminNamespace.Children.Add("WebConnectors", ServerAdminWebConnectorNamespace); GenerateServerGlue.GenerateCode(namespaceRoot, AOutputDir + "/Server/app/WebService", ACmd.GetOptValue("TemplateDir")); GenerateClientGlue.GenerateCode(namespaceRoot, AOutputDir + "/ServerAdmin/app/Core", ACmd.GetOptValue("TemplateDir")); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Environment.Exit(-1); } }
private static void GenerateGlueForPlugin(TCmdOpts ACmd, string AOutputDir) { TNamespace namespaceRoot; AOutputDir = AOutputDir.Replace("\\", "/"); try { Console.WriteLine("parsing plugin cs files for namespaces..."); namespaceRoot = TNamespace.ParseFromDirectory(AOutputDir + "/Server/"); if (namespaceRoot.Children.Count < 1) { Console.WriteLine("There are no connectors in " + AOutputDir + "/Server/"); return; } } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Environment.Exit(-1); return; } try { CreateInterfaces interfaces = new CreateInterfaces(); #if disabled // at the moment, we do not support UIConnectors for plugins. Better to focus on Webconnectors! if (!Directory.Exists(AOutputDir + "/Shared")) { Directory.CreateDirectory(AOutputDir + "/Shared"); } interfaces.CreateFiles(namespaceRoot, AOutputDir + "/Shared", ACmd.GetOptValue("TemplateDir")); #endif GenerateClientGlue.GenerateCode(namespaceRoot, AOutputDir + "/Client", ACmd.GetOptValue("TemplateDir")); GenerateServerGlue.GenerateCode(namespaceRoot, AOutputDir + "/Server", ACmd.GetOptValue("TemplateDir")); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Environment.Exit(-1); } }
public static void Main(string[] args) { TCmdOpts cmd = new TCmdOpts(); new TAppSettingsManager(false); TLogging.DebugLevel = TAppSettingsManager.GetInt32("debuglevel", 0); String OutputDir; if (!cmd.IsFlagSet("TemplateDir")) { Console.WriteLine("call: " + sampleCall); return; } if (cmd.IsFlagSet("outputdir")) { OutputDir = cmd.GetOptValue("outputdir"); // calculate ICTPath from outputdir string fullOutputPath = Path.GetFullPath(OutputDir).Replace("\\", "/"); if (!fullOutputPath.Contains("csharp/ICT")) { Console.WriteLine("Output path must be below the csharp/ICT directory"); } CSParser.ICTPath = fullOutputPath.Substring(0, fullOutputPath.IndexOf("csharp/ICT") + "csharp/ICT".Length); } else { Console.WriteLine("call: " + sampleCall); return; } TNamespace namespaceRoot; try { Console.WriteLine("parsing all cs files for namespaces..."); namespaceRoot = TNamespace.ParseFromDirectory(OutputDir + "/Server/lib/"); if (namespaceRoot.Children.Count < 1) { Console.WriteLine("problems with parsing namespaces from " + OutputDir + "/Server/lib/"); Environment.Exit(-1); } } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Environment.Exit(-1); return; } try { CreateInterfaces interfaces = new CreateInterfaces(); interfaces.CreateFiles(namespaceRoot, OutputDir + "/Shared/lib/Interfaces", cmd.GetOptValue("TemplateDir")); CreateInstantiators instantiators = new CreateInstantiators(); instantiators.CreateFiles(namespaceRoot, OutputDir + "/Server/lib", cmd.GetOptValue("TemplateDir")); TCreateConnectors connectors = new TCreateConnectors(); connectors.CreateFiles(namespaceRoot, OutputDir + "/Server/lib", cmd.GetOptValue("TemplateDir")); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Environment.Exit(-1); } }