Exemplo n.º 1
0
        public void Hdrgen_rekodoth()
        {
            var hdrgen = new HeaderGenerator(typeof(Address).Assembly, sw);

            hdrgen.Execute();
            Debug.WriteLine(sw);
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            if (args.Length <= 0)
            {
                Console.WriteLine("usage: hdrgen <.NET assembly file name> [output file name]");
                return;
            }
            var assemblyName = args[0];
            var asm          = typeof(NativeInteropAttribute).Assembly;

            if (args.Length == 1)
            {
                var hdrgen = new HeaderGenerator(asm, System.Console.Out);
                hdrgen.Execute();
            }
            else
            {
                TextWriter w = null;
                try
                {
                    w = File.CreateText(args[1]);
                    var hdrgen = new HeaderGenerator(asm, w);
                    hdrgen.Execute();
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine($"hdrgen: an error occurred while generating headers. {ex.Message}");
                }
                finally
                {
                    if (w != null)
                    {
                        w.Dispose();
                    }
                }
            }
        }