コード例 #1
0
ファイル: Generator.cs プロジェクト: tritao/thrift
 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;
        }