Ejemplo n.º 1
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        private static void Main(string[] args)
        {
            var options = new Options();

            if (!Parser.Default.ParseArguments(args, options))
            {
                return;
            }

            var xml = File.ReadAllText(options.XmlFile);

            var classInfo = new Xml2CSharpConverer().Convert(xml);

            var classInfoWriter = new ClassInfoWriter(classInfo, options.CustomNameSpace);

            if (string.IsNullOrEmpty(options.CSharpFileName))
            {
                classInfoWriter.WriteHeader(Console.Out);
                classInfoWriter.Write(Console.Out);
                classInfoWriter.WriteFooter(Console.Out);
            }

            if (!string.IsNullOrEmpty(options.CSharpFileName))
            {
                using (var sw = new StreamWriter(File.OpenWrite(options.CSharpFileName)))
                {
                    classInfoWriter.WriteHeader(sw);
                    classInfoWriter.Write(sw);
                    classInfoWriter.WriteFooter(sw);
                }
            }
        }
 public void Then_no_duplicate_classes_are_created(string fileName)
 {
     var classInfo = new Xml2CSharpConverer().Convert(File.ReadAllText(Path.Combine("Specs\\ConvertExamples", fileName)));
     var writer = new ClassInfoWriter(classInfo);
     writer.Write(Console.Out);
     classInfo.Select(c => c.Name).Distinct().Should().HaveCount(classInfo.Count());
 }
Ejemplo n.º 3
0
        public void Then_no_duplicate_classes_are_created(string fileName)
        {
            var classInfo = new Xml2CSharpConverer().Convert(File.ReadAllText(Path.Combine("Specs\\ConvertExamples", fileName)));
            var writer    = new ClassInfoWriter(classInfo);

            writer.Write(Console.Out);
            classInfo.Select(c => c.Name).Distinct().Should().HaveCount(classInfo.Count());
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            var options = new Options();
            if (!Parser.Default.ParseArguments(args, options))
                return;

            var xml = File.ReadAllText(options.XmlFile);

            var classInfo = new Xml2CSharpConverer().Convert(xml);

            var classInfoWriter = new ClassInfoWriter(classInfo);
            classInfoWriter.Write(Console.Out);
            classInfoWriter.Write(new StreamWriter(File.OpenWrite(options.CSharpFileName)));
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            var options = new Options();

            if (!Parser.Default.ParseArguments(args, options))
            {
                return;
            }

            var xml = File.ReadAllText(options.XmlFile);

            var classInfo = new Xml2CSharpConverer().Convert(xml);

            var classInfoWriter = new ClassInfoWriter(classInfo);

            classInfoWriter.Write(Console.Out);
            classInfoWriter.Write(new StreamWriter(File.OpenWrite(options.CSharpFileName)));
        }
Ejemplo n.º 6
0
        public Home()
        {
            Get["/"] = parameters =>
            {
                return View["Index"];
            };

            Post["/"] = parameters =>
            {
                var xml = this.Request.Form.xml;
                var classInfo = new Xml2CSharpConverer().Convert(xml);

                var classInfoWriter = new ClassInfoWriter(classInfo);

                var stringWriter = new StringWriter();
                classInfoWriter.Write(stringWriter);

                return View["result", new ConvertResponse { CSharpCode = stringWriter.ToString() }];
            };
        }
Ejemplo n.º 7
0
        public Home()
        {
            Get["/"] = parameters =>
            {
                return(View["Index"]);
            };

            Post["/"] = parameters =>
            {
                var xml       = this.Request.Form.xml;
                var classInfo = new Xml2CSharpConverer().Convert(xml);

                var classInfoWriter = new ClassInfoWriter(classInfo);

                var stringWriter = new StringWriter();
                classInfoWriter.Write(stringWriter);

                return(View["result", new ConvertResponse {
                                XmlInput = xml, CSharpCode = stringWriter.ToString()
                            }]);
            };
        }
Ejemplo n.º 8
0
        public Home()
        {
            Get["/"] = parameters =>
            {
                return(View["Index"]);
            };

            Post["/"] = parameters =>
            {
                var xml       = this.Request.Form.xml;
                var classInfo = new Xml2CSharpConverer().Convert(xml);

                var classInfoWriter = new ClassInfoWriter(classInfo);

                var stringWriter = new StringWriter();
                classInfoWriter.Write(stringWriter);
                File.WriteAllText(@"E:\_MIS_Moalemi\final.cs", stringWriter.ToString());
                return(View["result", new ConvertResponse {
                                CSharpCode = stringWriter.ToString()
                            }]);
            };
        }