public EmbeddedCGenerator(ServiceGenerator.StackConfiguration Config) : base(Config) { switch (Config.newline) { case ServiceGenerator.NEWLINETYPE.CRLF: cl = "\r\n"; break; case ServiceGenerator.NEWLINETYPE.LF: cl = "\n"; break; } switch (Config.TargetPlatform) { case ServiceGenerator.PLATFORMS.MICROSTACK_POSIX: this.Platform = PLATFORMS.POSIX; this.SubTarget = SUBTARGETS.NONE; break; case ServiceGenerator.PLATFORMS.MICROSTACK_WINSOCK1: this.Platform = PLATFORMS.WINDOWS; this.SubTarget = SUBTARGETS.NONE; this.WinSock = 1; break; case ServiceGenerator.PLATFORMS.MICROSTACK_WINSOCK2: this.Platform = PLATFORMS.WINDOWS; this.SubTarget = SUBTARGETS.NONE; this.WinSock = 2; break; case ServiceGenerator.PLATFORMS.MICROSTACK_POCKETPC: this.Platform = PLATFORMS.WINDOWS; this.SubTarget = SUBTARGETS.PPC2003; this.WinSock = 1; break; } }
public DotNetGenerator(string ns,ServiceGenerator.StackConfiguration Config) : base(Config) { if (ns!="") { nspace = ns; } }
public CodeGenerator(ServiceGenerator.StackConfiguration StackConfiguration) { Configuration = StackConfiguration; ProjectName = StackConfiguration.projectname; ClassName = StackConfiguration.classname; }
public static void Generate_WebServer(ServiceGenerator.StackConfiguration config, DirectoryInfo outputDir) { bool Legacy = !config.HTTP_1dot1; string PreFix = config.prefixlib; StreamWriter writer; string lib; lib = GetEULA(PreFix + "WebServer.h", "") + RemoveOldEULA(ReadFileStore("ILibWebServer.h")); lib = lib.Replace("ILib", PreFix); writer = File.CreateText(outputDir.FullName + "\\" + PreFix + "WebServer.h"); writer.Write(lib); writer.Close(); lib = GetEULA(PreFix + "WebServer.c", "") + "\r\n"; if (Legacy) { lib += "#define HTTPVERSION \"1.0\""; } else { lib += "#define HTTPVERSION \"1.1\""; } lib += RemoveOldEULA(ReadFileStore("ILibWebServer.c")); lib = lib.Replace("ILib", PreFix); if (Legacy) { // Remove HTTP/1.1 Specific Code string xx = "//{{{ REMOVE_THIS_FOR_HTTP/1.0_ONLY_SUPPORT--> }}}"; string yy = "//{{{ <--REMOVE_THIS_FOR_HTTP/1.0_ONLY_SUPPORT }}}"; int ix = lib.IndexOf(xx); int iy; while (ix != -1) { iy = lib.IndexOf(yy) + yy.Length; lib = lib.Remove(ix, iy - ix); ix = lib.IndexOf(xx); } } writer = File.CreateText(outputDir.FullName + "\\" + PreFix + "WebServer.c"); writer.Write(lib); writer.Close(); }
public static void Generate_WebClient(ServiceGenerator.StackConfiguration config, DirectoryInfo outputDir) { bool Legacy = !config.HTTP_1dot1; string PreFix = config.prefixlib; int i; StreamWriter writer; string lib; lib = GetEULA(PreFix + "WebClient.h", "") + RemoveOldEULA(ReadFileStore("ILibWebClient.h")); lib = lib.Replace("ILib", PreFix); // // Buffer Limitations // lib = ReplaceLine(lib, "#define INITIAL_BUFFER_SIZE", "#define INITIAL_BUFFER_SIZE " + config.InitialHTTPBufferSize.ToString() + "\n"); i = lib.IndexOf("#define MAX_HTTP_HEADER_SIZE"); if (i != -1) { if (config.MaxHTTPHeaderSize > 0) { lib = ReplaceLine(lib, "#define MAX_HTTP_HEADER_SIZE", "#define MAX_HTTP_HEADER_SIZE " + config.MaxHTTPHeaderSize.ToString() + "\n"); } else { lib = DeleteLine(lib, "#define MAX_HTTP_HEADER_SIZE"); } } else { if (config.MaxHTTPHeaderSize > 0) { i = GetIndexOfNextLine(lib, "#define INITIAL_BUFFER_SIZE"); if (i != -1) { lib = lib.Insert(i, "#define MAX_HTTP_HEADER_SIZE " + config.MaxHTTPHeaderSize.ToString() + "\n"); } } } i = lib.IndexOf("#define MAX_HTTP_PACKET_SIZE"); if (i != -1) { if (config.MaxHTTPPacketSize > 0) { lib = ReplaceLine(lib, "#define MAX_HTTP_PACKET_SIZE", "#define MAX_HTTP_PACKET_SIZE " + config.MaxHTTPPacketSize.ToString() + "\n"); } else { lib = DeleteLine(lib, "#define MAX_HTTP_PACKET_SIZE"); } } else { if (config.MaxHTTPPacketSize > 0) { i = GetIndexOfNextLine(lib, "#define INITIAL_BUFFER_SIZE"); if (i != -1) { lib = lib.Insert(i, "#define MAX_HTTP_PACKET_SIZE " + config.MaxHTTPPacketSize.ToString() + "\n"); } } } writer = File.CreateText(outputDir.FullName + "\\" + PreFix + "WebClient.h"); writer.Write(lib); writer.Close(); lib = GetEULA(PreFix + "WebClient.c", "") + RemoveOldEULA(ReadFileStore("ILibWebClient.c")); lib = lib.Replace("ILib", PreFix); if (Legacy) { // Remove HTTP/1.1 Specific Code string xx = "//{{{ REMOVE_THIS_FOR_HTTP/1.0_ONLY_SUPPORT--> }}}"; string yy = "//{{{ <--REMOVE_THIS_FOR_HTTP/1.0_ONLY_SUPPORT }}}"; int ix = lib.IndexOf(xx); int iy; while (ix != -1) { iy = lib.IndexOf(yy) + yy.Length; lib = lib.Remove(ix, iy - ix); ix = lib.IndexOf(xx); } } writer = File.CreateText(outputDir.FullName + "\\" + PreFix + "WebClient.c"); writer.Write(lib); writer.Close(); }
public static bool GenerateEx(object[] deviceList, DirectoryInfo outputDirectory, ServiceGenerator.StackConfiguration Config) { EmbeddedCGenerator g = new EmbeddedCGenerator(Config); return (g.Generate((UPnPDevice[])deviceList, outputDirectory)); }
public JavaAndroidGenerator(ServiceGenerator.StackConfiguration Config) : base(Config) { nspace = ClassName; }