示例#1
0
 public Generator(Options options)
 {
     this.options = options;
     sb = new StringBuilder();
     currentIndent = new Stack<uint>();
     isStartOfLine = false;
 }
示例#2
0
文件: Program.cs 项目: tritao/thrift
        static void Main(string[] args)
        {
            var options = new Options();

            if (!ParseCommandLineOptions(args, options))
                return;

            foreach (var assemblyFile in options.Assemblies)
            {
                Assembly assembly;
                if (!ParseAssembly(assemblyFile, out assembly))
                    continue;

                var compiler = new Compiler(options, assembly);
                compiler.Process();
            }
        }
示例#3
0
文件: Compiler.cs 项目: tritao/thrift
 public Compiler(Options options, Assembly assembly)
 {
     this.options = options;
     this.assembly = assembly;
 }
示例#4
0
文件: Program.cs 项目: tritao/thrift
        static bool ParseCommandLineOptions(String[] args, Options options)
        {
            var set = new OptionSet()
                {
                    // Compiler options
                    { "ns|namespace=", v => options.OutputNamespace = v },
                    { "o|outdir=", v => options.OutputDir = v },
                    { "debug", v => options.OutputDebug = true },
                    // Misc. options
                    { "v|verbose",  v => { options.Verbose = true; } },
                    { "h|?|help",   v => options.ShowHelpText = v != null },
                };

            if (args.Length == 0 || options.ShowHelpText)
            {
                ShowHelp(set);
                return false;
            }

            try
            {
                options.Assemblies = set.Parse(args);
            }
            catch (OptionException)
            {
                Console.WriteLine("Error parsing the command line.");
                ShowHelp(set);
                return false;
            }

            return true;
        }