Parse() private static method

private static Parse ( JToken j ) : Protocol
j JToken
return Protocol
Beispiel #1
0
        static int GenProtocol(string infile, string outdir,
                               IEnumerable <KeyValuePair <string, string> > namespaceMapping)
        {
            try
            {
                string   text     = System.IO.File.ReadAllText(infile);
                Protocol protocol = Protocol.Parse(text);

                CodeGen codegen = new CodeGen();
                codegen.AddProtocol(protocol);

                foreach (var entry in namespaceMapping)
                {
                    codegen.NamespaceMapping[entry.Key] = entry.Value;
                }

                codegen.GenerateCode();
                codegen.WriteTypes(outdir);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Exception occurred. " + ex.Message);
                return(1);
            }

            return(0);
        }
Beispiel #2
0
        static void GenProtocol(string infile, string outdir)
        {
            try
            {
                string text     = System.IO.File.ReadAllText(infile);
                var    protocol = Protocol.Parse(text);

                var codegen = new CodeGen();
                codegen.AddProtocol(protocol);

                codegen.GenerateCode();
                codegen.WriteTypes(outdir);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Concat("Exception occurred. ", ex.Message));
            }
        }
Beispiel #3
0
        static void GenProtocol(string infile, string outdir)
        {
            try
            {
                string   text     = System.IO.File.ReadAllText(infile);
                Protocol protocol = Protocol.Parse(text);

                CodeGen codegen = new CodeGen();
                codegen.AddProtocol(protocol);

                codegen.GenerateCode();
                codegen.WriteTypes(outdir);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception occurred. " + ex.Message);
            }
        }