Example #1
0
        public static int RunOptionsAndReturnExitCode(Options options, string filePath = null)
        {
            try
            {
                var @namespace = options.Namespace;
                filePath ??= options.FilePath;
                var className = !string.IsNullOrEmpty(options.ClassName)
                    ? options.ClassName
                    : GetClassNameFromFileName(filePath);
                var output         = options.Output;
                var root           = options.Root;
                var filePathOutput = Path.Combine(output, $"{className}.cs");
                if (File.Exists(filePath))
                {
                    List <XsdModel> xsdModelList = XmlSchemaTraverse(filePath, root);
                    var             xsd          = new Xsd {
                        Session = new Dictionary <string, object>()
                    };
                    xsd.Session.Add("_Namespace_", @namespace);
                    xsd.Session.Add("_ClassName_", className);
                    xsd.Session.Add("_DatabaseSchema_", "pagard");
                    if (null != xsdModelList && xsdModelList.Count > 0)
                    {
                        xsd.Session.Add("xsdModelList", xsdModelList);
                        xsd.Initialize();
                        var xsdOutput = xsd.TransformText();
                        File.WriteAllText(filePathOutput, xsdOutput);
                    }
                }
                else if (Directory.Exists(filePath))
                {
                    Parallel.ForEach(Directory.GetFiles(filePath, "*.xsd", SearchOption.AllDirectories), file =>
                    {
                        RunOptionsAndReturnExitCode(options, file);
                    });
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Console.ReadKey();
            return(0);
        }
Example #2
0
 public static int Main(string[] args) {
     Xsd xsd = new Xsd();
     return xsd.Run(args);
 }
Example #3
0
File: xsd.cs Project: ydunk/masters
        public static int Main(string[] args)
        {
            Xsd xsd = new Xsd();

            return(xsd.Run(args));
        }