Example #1
0
 [SetUp]
 public void Init()
 {
     Options options = new Options();
     generator = new Generator(options);
     eventFired = false;
Example #2
0
 private void WriteGeneratorToFile(Type type, Generator gen)
 {
     WriteGeneratorToFile(type.FullName, gen);
 }
Example #3
0
        private void WriteGeneratorToFile(string fileName, Generator gen)
        {
            if (string.IsNullOrEmpty(outputDir))
                outputDir = ".";

            var filePath = Path.GetFullPath(outputDir);
            if(!fileName.EndsWith(".cs"))
                fileName = string.Format("{0}.cs", fileName);

            filePath = Path.Combine(filePath, fileName);
            File.WriteAllText(filePath, gen.ToString());
            GeneratedFiles.Add(filePath);

            Console.WriteLine("Generated '{0}'", fileName);
        }
Example #4
0
        private void ProcessService(Type type)
        {
            if (outputDebug)
            {
                log.Debug("Service: {0}", type.Name);

                foreach (var method in type.GetMethods())
                    log.Debug("  Method: {0}", method.Name);
            }

            var gen = new Generator(type.Assembly);
            gen.GenerateService(type);

            WriteGeneratorToFile(type, gen);
        }
Example #5
0
        private void WriteDataObjectFactory()
        {
            var gen = new Generator(assembly);
            gen.GenerateDataObjectFactory(RpcTypes);

            WriteGeneratorToFile("DataObjectFactory", gen);
        }
Example #6
0
        private void ProcessException(Type type)
        {
            if (outputDebug)
            {
                log.Debug("Exception: {0}", type.Name);

                foreach (var field in type.GetFields())
                    log.Debug("  Field: {0}", field.Name);
            }

            var gen = new Generator(type.Assembly);
            gen.GenerateDataObject(type);

            WriteGeneratorToFile(type, gen);
        }
Example #7
0
        private string ProcessDataObject(Type type)
        {
            if (outputDebug)
            {
                log.Debug("DataObject: {0}", type.Name);

                foreach (var field in type.GetFields())
                    log.Debug("  Field: {0}", field.Name);
            }

            var gen = new Generator(type.Assembly);
            var dataObjectFullName = gen.GenerateDataObject(type);

            WriteGeneratorToFile(type, gen);

            return dataObjectFullName;
        }
Example #8
0
        private void ProcessMessage(Type type)
        {
            if (options.OutputDebug)
            {
                Console.WriteLine("Message: {0}", type.Name);

                foreach (var field in type.GetFields())
                    Console.WriteLine("  Field: {0}", field.Name);
            }

            var gen = new Generator(options);
            gen.GenerateMessage(type);

            WriteGeneratorToFile(type, gen);
        }
Example #9
0
        private void WriteGeneratorToFile(Type type, Generator gen)
        {
            if (string.IsNullOrEmpty(options.OutputDir))
                options.OutputDir = ".";

            var filePath = Path.GetFullPath(options.OutputDir);
            var fileName = string.Format("{0}.cs", type.Name);

            filePath = Path.Combine(filePath, fileName);
            File.WriteAllText(filePath, gen.ToString());
            GeneratedFiles.Add(filePath);

            Console.WriteLine("Generated '{0}'", fileName);
        }
Example #10
0
        private void ProcessService(Type type)
        {
            if (options.OutputDebug)
            {
                Console.WriteLine("Service: {0}", type.Name);

                foreach (var method in type.GetMethods())
                    Console.WriteLine("  Method: {0}", method.Name);
            }

            var gen = new Generator(options);
            gen.GenerateService(type);

            WriteGeneratorToFile(type, gen);
        }