Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var outputDirPath = System.IO.Path.Combine(Application.StartupPath, "Output");

            if (!Directory.Exists(outputDirPath))
            {
                try
                {
                    Directory.CreateDirectory(outputDirPath);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.ReadKey();
                    return;
                }
            }
            foreach (var fn in Directory.GetFiles(Application.StartupPath, "PacketTemplate_*.dll"))
            {
                var asm     = Assembly.LoadFile(fn);
                var t       = Helpers.GetTemplate(asm);
                var shortfn = new FileInfo(fn).Name;
                shortfn = shortfn.Substring(0, shortfn.LastIndexOf('.'));
                var path = System.IO.Path.Combine(outputDirPath, shortfn.Replace(".", "_"));
                if (!Directory.Exists(path))
                {
                    try
                    {
                        Directory.CreateDirectory(path);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        Console.ReadKey();
                        return;
                    }
                }

                var rtv = GenCPP.Gen(t, path, shortfn.Substring("PacketTemplate_".Length));
                if (rtv != "")
                {
                    Console.WriteLine(rtv);
                    Console.ReadKey();
                    return;
                }
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            //ByteBufferTest.Test();

            //var outputDirPath = @"..\Output";
            var outputDirPath = System.IO.Path.Combine(Application.StartupPath, "Output");

            foreach (var dll in Directory.GetFiles(Application.StartupPath, "PacketTemplate_*.dll"))
            {
                var asm      = Assembly.LoadFile(dll);
                var template = TemplateScaner.GetTemplate(asm);
                var dllName  = new FileInfo(dll).Name;
                dllName = dllName.Substring(0, dllName.LastIndexOf('.'));

                var rtv1 = GenJava.Gen(template, outputDirPath, dllName.Substring("PacketTemplate_".Length));
                var rtv2 = GenCS.Gen(template, outputDirPath, dllName.Substring("PacketTemplate_".Length));
                var rtv3 = GenCPP.Gen(template, outputDirPath, dllName.Substring("PacketTemplate_".Length));
            }

            System.Diagnostics.Process.Start("explorer.exe", outputDirPath);
        }