예제 #1
0
        static void Main(string[] args)
        {
            var composeApp = new ComposeAppService();

            if (args[0] == "compose")
            {
                Console.WriteLine("composing...");
                composeApp.Compose(args.Skip(1).ToArray(), m => Console.WriteLine(m), i => drawTextProgressBar(1, 100));
            }
            else if (args[0] == "process" || args[0] == "processAndSave")
            {
                Console.WriteLine("process...");
                var num       = args.Length > 1 ? int.Parse(args[1]) : 3;
                var extension = args.Length > 2 ? args[2] : "*.JPG";
                if (args.Length > 3)
                {
                    Directory.SetCurrentDirectory(args[3]);
                }
                var files = GroupFiles(extension, num, ignoreStichInName: true);
                int total = files.Count;
                int count = 0;
                foreach (var item in files)
                {
                    count++;
                    Console.WriteLine(string.Format("composing {0} of {1}....", count, total));
                    var saveProject = args[0] == "processAndSave";
                    composeApp.Compose(item, m => Console.WriteLine(m), i => drawTextProgressBar(i, 100), saveProject: saveProject);
                }
            }
            Console.WriteLine("Finished.");
        }
예제 #2
0
        private static void Process(ProcessOptions options)
        {
            var composeApp = new ComposeAppService();

            Console.WriteLine("process...");
            if (string.IsNullOrEmpty(options.Extension))
            {
                options.Extension = "*.JPG";
            }

            if (!string.IsNullOrEmpty(options.Folder))
            {
                Directory.SetCurrentDirectory(options.Folder);
            }
            var files = GroupFiles(options.Extension, options.Num, ignoreStichInName: true);
            int total = files.Count;
            int count = 0;

            foreach (var item in files)
            {
                count++;
                Console.WriteLine(string.Format("composing {0} of {1}....", count, total));
                var saveProject = options.Save.HasValue ? options.Save.Value : false;
                composeApp.Compose(item, options.Motion, m => Console.WriteLine(m), i => drawTextProgressBar(i, 100), saveProject: saveProject);
            }
            Console.WriteLine("Finished.");
        }
예제 #3
0
        private static void Compose(ComposeOptions options)
        {
            Console.WriteLine("composing...");
            var composeApp  = new ComposeAppService();
            var saveProject = options.Save.HasValue ? options.Save.Value : false;

            composeApp.Compose(options.Images.ToArray(), options.Motion, m => Console.WriteLine(m), i => drawTextProgressBar(1, 100), saveProject);
        }