示例#1
0
        protected override void OnExecute()
        {
            if (this.Culture != string.Empty)
            {
                System.Globalization.CultureInfo.DefaultThreadCurrentCulture   = new System.Globalization.CultureInfo(this.Culture);
                System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = new System.Globalization.CultureInfo(this.Culture);
            }

            this.Out.WriteLine("receiving info");
            var metaData = this.service.GetMetaData(this.Address, DataBaseSettings.DataBaseName, DataBaseSettings.Tags, FilterSettings.FilterExpression, CodeSettings.Devmode, this.Revision);

            metaData = ReplaceOptionProcessor.Process(metaData);

            var generationSettings = new CodeGenerationSettings()
            {
                ClassName     = CodeSettings.ClassName,
                Namespace     = CodeSettings.Namespace,
                BaseNamespace = CodeSettings.BaseNamespace,
                Prefix        = CodeSettings.Prefix,
                Postfix       = CodeSettings.Postfix,
                BasePath      = CodeSettings.BasePath,
                Options       = CodeSettings.Options,
                Tags          = (TagInfo)DataBaseSettings.Tags,
                Revision      = this.Revision,
            };

            foreach (var item in CommandStringUtility.ArgumentsToDictionary(this.Arguments))
            {
                generationSettings.Arguments.Add(item);
            }

            if (CodeSettings.IsBuildMode == true)
            {
                var compiler = this.compilers.FirstOrDefault(item => item.Name == CodeSettings.LanguageType);
                if (compiler == null)
                {
                    throw new InvalidOperationException($"'{CodeSettings.LanguageType}'은(는) 존재하지 않는 언어입니다.");
                }
                this.Out.WriteLine("compiling code.");
                compiler.Compile(this.OutputPath, metaData.Item1, generationSettings, CodeSettings.BuildTarget);
                this.Out.WriteLine("code compiled.");
            }
            else
            {
                this.Out.WriteLine("code generating.");
                var generator = this.generators.FirstOrDefault(item => item.Name == CodeSettings.LanguageType);
                if (generator == null)
                {
                    throw new InvalidOperationException($"'{CodeSettings.LanguageType}'은(는) 존재하지 않는 언어입니다.");
                }
                generator.Generate(this.OutputPath, metaData.Item1, generationSettings);
                this.Out.WriteLine("code generated.");
            }

            this.Out.WriteLine("data serializing.");
            var serializer = this.serializers.FirstOrDefault(item => item.Name == this.DataType);

            serializer.Serialize(Path.Combine(this.OutputPath, this.DataFilename), metaData.Item2);
            this.Out.WriteLine("data serialized.");
        }
        public void Test3()
        {
            var parser = new CommandLineParser(this);

            parser.Parse("get \"database=\\\"a b c\\\"\"");

            CommandStringUtility.ArgumentsToDictionary(this.Arguments);
        }
示例#3
0
 private IDictionary <string, object> GetProperties()
 {
     return(CommandStringUtility.ArgumentsToDictionary(this.Arguments));
 }