Generator for resource files.
示例#1
0
 public void Generate_Dir_Successful()
 {
     using (var dir = new TemporaryDirectory())
     {
         var gen = new QowaivCodeGenerator();
         gen.Generate(dir);
     }
 }
示例#2
0
文件: Program.cs 项目: Corniel/Qowaiv
        /// <summary>Executes the program.</summary>
        /// <param name="args">The Arguments of the program.</param>
        /// <remarks>
        /// CodeGenerator.exe outputDir underlyingType className [longClassName] [a|an] [namespace]
        /// 
        /// Example: CodeGenerator.exe C:\Temp\Qowaiv string EmailAddress "Email address" an Qowaiv
        /// </remarks>
        public static void Main(string[] args)
        {
            AppendLoggers();

            try
            {
                if (args == null || args.Length < 3) { throw new Exception("arguments required."); }

                var outputDir = new DirectoryInfo(args[0]);

                Type underlyingType = null;
                if (!args[1].Contains('.'))
                {
                    underlyingType = Type.GetType("System." + args[1].Substring(0, 1).ToUpperInvariant() + args[1].Substring(1));
                }
                else
                {
                    underlyingType = Type.GetType(args[1]);
                }

                if (underlyingType == null) { throw new ArgumentException("Could not resolve the underlying type."); }

                var input = new SvoStruct() { ClassName = args[2], UnderlyingType = underlyingType };

                if (args.Length > 3) { input.ClassLongName = args[3]; }
                if (args.Length > 4) { input.a = args[4].ToLower(); }
                if (args.Length > 5) { input.Namespace = args[5]; }

                var rsxGen = new QowaivCodeGenerator();
                var svoGen = new SvoStructGenerator();

                rsxGen.Generate(outputDir);
                svoGen.Generate(outputDir, input);

            }
            catch(Exception x)
            {
                log.Error(x);
            }
        }
 public void Generate_Dir_Successful()
 {
     var gen = new QowaivCodeGenerator();
     gen.Generate(new DirectoryInfo(@"c:\temp\Qowaiv"));
 }