示例#1
0
        public void ClassWithEnumFromUnrelatedClass()
        {
            var c = new Copier();

            c.AddType(typeof(MockRequest));
            c.AddType(typeof(OtherMockRequest));
            c.AddType(typeof(MockResponse));
            var r = c.Process();

            Console.WriteLine(r);
        }
示例#2
0
        public void ServiceTest()
        {
            var settings = new CopierSettings();

            settings.BaseTypesToRemove.Add(typeof(BaseServiceInstance <,>));
            var c = new Copier(settings);

            c.LimitOutputToAssemblyOfType(typeof(TokenRequest));
            c.AddType(typeof(TokenRequest));
            var r = c.Process();

            Console.WriteLine(r);
        }
示例#3
0
        public void BasicClassTest()
        {
            var c = new Copier();

            //c.LimitOutputToAssemblyOfType(typeof(Common.Models.Root));
            c.AddType(typeof(GenericBase));
            c.AddType(typeof(Basic));
            c.AddType(typeof(ServiceResponse <CompoundResponse>));
            c.AddType(typeof(MockRequest));
            c.AddType(typeof(OtherMockRequest));
            c.AddType(typeof(MockResponse));
            var r = c.Process();

            Console.WriteLine(r);
        }
示例#4
0
文件: Program.cs 项目: lbreivik/wren
        static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");

            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json", true, true)
                                    .Build();

            var startFolder       = config["StartingFolder"];
            var publishFolderRoot = config["PublishFolder"];

            Console.WriteLine(startFolder);

            //need to look over the folders in the starting folder

            var folders = Directory.GetDirectories(startFolder);

            //var folders = new string[] {"/Users/louise/Documents/Photos/20200426"};
            foreach (var folder in folders)
            {
                var justFolderName = Path.GetFileName(folder);
                var publishFolder  = Path.Combine(publishFolderRoot, justFolderName);
                //Console.WriteLine($"{folder}-{publishFolder}");
                if (!Directory.Exists(publishFolder))
                {
                    var exportFolder = Path.Combine(folder, "export");
                    if (Directory.Exists(exportFolder))
                    {
                        //send it for processing
                        var copier = new Copier(publishFolderRoot);
                        copier.Process(exportFolder);
                        //Console.WriteLine("processing");
                    }
                }
            }


            Console.WriteLine(config["PublishFolder"]);
            //var copier = new Copier();
            //copier.Process("/Users/louise/Documents/Photos/20200403/export");
            Console.WriteLine("Hello World!");
        }
示例#5
0
        public void ServiceTestWithReplacementType()
        {
            var settings = new CopierSettings
            {
                ReplacementTypes =
                {
                    { typeof(TokenDate),   typeof(DateTime) },
                    { typeof(TokenString), typeof(string)   },
                }
            };

            settings.BaseTypesToRemove.Add(typeof(BaseServiceInstance <,>));
            var c = new Copier(settings);

            c.LimitOutputToAssemblyOfType(typeof(TokenRequest));
            c.AddType(typeof(TokenRequest));
            var r = c.Process();

            Console.WriteLine(r);
        }
示例#6
0
        public string ModelDuplicator()
        {
            (string, string)replaceWith = ($"Gtt.Links.Core", $"Gtt.Links.Client");
            var settings = new CopierSettings();

            settings.BaseTypesToRemove.Add(typeof(BaseServiceInstance <,>));
            settings.BaseTypesToRemove.Add(typeof(BaseStatefulServiceInstance <, , , ,>));
            var mt = new Copier(settings)
            {
                AlwaysGetAndSet  = true,
                ReplaceNamespace = replaceWith
            };

            mt.LimitOutputToAssemblyOfType(typeof(HealthCheckRequest));

            foreach (var instance in _instances)
            {
                mt.AddType(instance.RequestType);
                mt.AddType(instance.ResponseType);
            }

            return(mt.Process());
        }