Beispiel #1
0
 static void GenerateWriter(Parameters parameters)
 {
     var protocol = new Protocol(parameters.Input);
     protocol.GenerateCppWriter(parameters.Output);
     //XSLT.Generator.Generate(XSLT.Templates.CppWriterHeader, parameters.Input, parameters.Output + ".h");
     //XSLT.Generator.Generate(XSLT.Templates.CppWriterSource, parameters.Input, parameters.Output + ".hpp");
 }
Beispiel #2
0
 static int Main(string[] args)
 {
     try
     {
         if (ShouldPrintHelpOnly(args))
         {
             Parameters.PrintUsage();
         }
         else
         {
             var parameters = new Parameters(args);
             if (parameters.Operation == Operation.Generation)
                 Generate(parameters);
             else if (parameters.Operation == Operation.Verification)
                 return Verify(parameters);
             else
                 Parameters.PrintUsage();
         }
         return 0;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return 1;
     }
 }
Beispiel #3
0
        static int Verify(Parameters parameters)
        {
            var oldProtocol = new Protocol(parameters.Old);
            var newProtocol = new Protocol(parameters.New);
            if (oldProtocol.Compare(newProtocol))
                return 0;

            return 1;
        }
Beispiel #4
0
 static void Generate(Parameters parameters)
 {
     if (parameters.Language == Language.CSharp)
         CSharpGenerator.Generate(parameters);
     else if (parameters.Language == Language.Cpp)
         CppGenerator.Generate(parameters);
     else
         Console.WriteLine("Unknown language = {0}", parameters.Language);
 }
Beispiel #5
0
 public static void Generate(Parameters parameters)
 {
     if (parameters.Side == Side.Client)
         GenerateClient(parameters);
     else if (parameters.Side == Side.Server)
         GenerateServer(parameters);
     else if (parameters.Side == Side.Writer)
         GenerateWriter(parameters);
     else if (parameters.Side == Side.Reader)
         GenerateReader(parameters);
     else
         Console.WriteLine("Not supported {0} side by C++ language", parameters.Side);
 }
Beispiel #6
0
 static void GenerateServer(Parameters parameters)
 {
     if (parameters.Mode == Mode.Local)
     {
         var protocol = new Protocol(parameters.Input);
         protocol.GenerateCharpLocalServer(parameters.Namespace, parameters.Output);
     }
     else if (parameters.Mode == Mode.Remote)
     {
         Console.WriteLine("Remote C# server is not implemented");
     }
     else
     {
         Console.WriteLine("Not supported {0} mode by C# server", parameters.Operation);
     }
 }
Beispiel #7
0
 static void GenerateServer(Parameters parameters)
 {
     if (parameters.Mode == Mode.Local)
     {
         var protocol = new Protocol(parameters.Input);
         protocol.GenerateCppLocalServer(parameters.Output, parameters.Prefix);
     }
     else if (parameters.Mode == Mode.Remote)
     {
         var protocol = new Protocol(parameters.Input);
         protocol.GenerateCppRemoteServer(parameters.Output, parameters.Prefix);
     }
     else
     {
         Console.WriteLine("Not supported {0} mode by C++ server", parameters.Operation);
     }
 }
Beispiel #8
0
 static void GenerateClient(Parameters parameters)
 {
     if (parameters.Mode == Mode.Local)
     {
         var protocol = new Protocol(parameters.Input);
         protocol.GenerateCharpLocalClient(parameters.Namespace, parameters.Output);
     }
     else if (parameters.Mode == Mode.Remote)
     {
         var protocol = new Protocol(parameters.Input);
         protocol.GenerateCharpRemoteClient(parameters.Namespace, parameters.Output);
     }
     else
     {
         Console.WriteLine("Not supported {0} mode by C# client", parameters.Operation);
     }
 }
Beispiel #9
0
 static void GenerateReader(Parameters parameters)
 {
     Console.WriteLine("Reader is not implemented for C++ language");
 }
Beispiel #10
0
 static void GenerateReader(Parameters parameters)
 {
     var protocol = new Protocol(parameters.Input);
     protocol.GenerateCSharpReader(protocol.Namespace, parameters.Output);
     //XSLT.Generator.Generate(XSLT.Templates.CSharpReader, parameters.Input, parameters.Output);
 }