示例#1
0
        public async Task ImportAsync(string path, SyncOptions options, ISession session)
        {
            using (var fs = FileSystems.Create(path))
            {
                var selectedSynchronizers = GetSynchronizers(options.Targets);
                var selectedCount         = selectedSynchronizers.Count;

                WriteSummary(fs, selectedSynchronizers);

                var sync = new SyncService(fs);

                await selectedSynchronizers.Foreach(async (synchronizer, step) =>
                {
                    log.WriteLine();
                    log.WriteLine("--------------------------------------------------------");
                    log.WriteLine("* STEP {0} of {1}: Importing {2} started", step, selectedCount, synchronizer.Name);
                    log.WriteLine();

                    await synchronizer.ImportAsync(sync, options, session);

                    log.WriteLine();
                    log.WriteLine("* STEP {0} of {1}: Importing {2} completed", step, selectedCount, synchronizer.Name);
                    log.WriteLine("--------------------------------------------------------");
                });
            }
        }
示例#2
0
        public async Task GenerateTemplateAsync(string path)
        {
            using (var fs = FileSystems.Create(path))
            {
                if (!fs.CanWrite)
                {
                    Console.WriteLine("ERROR: Cannot write to the file system.");
                    return;
                }

                var sync = new SyncService(fs);

                foreach (var synchronizer in GetSynchronizers())
                {
                    await synchronizer.GenerateSchemaAsync(sync);
                }
            }
        }
示例#3
0
        public async Task ExportAsync(string path, SyncOptions options, ISession session)
        {
            using (var fs = FileSystems.Create(path))
            {
                if (!fs.CanWrite)
                {
                    Console.WriteLine("ERROR: Cannot write to the file system.");
                    return;
                }

                var selectedSynchronizers = GetSynchronizers(options.Targets);
                var selectedCount         = selectedSynchronizers.Count;

                WriteSummary(fs, selectedSynchronizers);

                var sync = new SyncService(fs);

                foreach (var synchronizer in selectedSynchronizers)
                {
                    await synchronizer.GenerateSchemaAsync(sync);
                }

                await selectedSynchronizers.Foreach(async (synchronizer, step) =>
                {
                    log.WriteLine();
                    log.WriteLine("--------------------------------------------------------");
                    log.WriteLine("* STEP {0} of {1}: Exporting {2} started", step, selectedCount, synchronizer.Name);
                    log.WriteLine();

                    await synchronizer.CleanupAsync(fs);
                    await synchronizer.ExportAsync(sync, options, session);

                    log.WriteLine();
                    log.WriteLine("* STEP {0} of {1}: Exporting {2} completed", step, selectedSynchronizers.Count, synchronizer.Name);
                    log.WriteLine("--------------------------------------------------------");
                });
            }
        }