Пример #1
0
        private static Yield Create_Helper(Plug dekiApi, XDoc exports, int exportRelto, string exportReltoPath, int importRelto, string importReltoPath, bool forceOverwrite, Result <BulkCopy> result)
        {
            Result <Exporter> exporterResult;

            if (string.IsNullOrEmpty(exportReltoPath))
            {
                yield return(exporterResult = Exporter.CreateAsync(dekiApi, exports, exportRelto, new Result <Exporter>()));
            }
            else
            {
                yield return(exporterResult = Exporter.CreateAsync(dekiApi, exports, exportReltoPath, new Result <Exporter>()));
            }
            Exporter          exporter = exporterResult.Value;
            Result <Importer> importerResult;

            if (string.IsNullOrEmpty(importReltoPath))
            {
                yield return(importerResult = Importer.CreateAsync(dekiApi, exporter.Manifest, importRelto, forceOverwrite, new Result <Importer>()));
            }
            else
            {
                yield return(importerResult = Importer.CreateAsync(dekiApi, exporter.Manifest, importReltoPath, forceOverwrite, new Result <Importer>()));
            }
            BulkCopy bulkCopy = new BulkCopy(exporter, importerResult.Value);

            result.Return(bulkCopy);
        }
Пример #2
0
        private static Yield Create_Helper(Plug dekiApi, int relto, string reltopath, IPackageReader packager, Result <ImportManager> result)
        {
            Result <XDoc> manifestResult;

            yield return(manifestResult = packager.ReadManifest(new Result <XDoc>()));

            Result <Importer> importerResult;

            if (string.IsNullOrEmpty(reltopath))
            {
                yield return(importerResult = Importer.CreateAsync(dekiApi, manifestResult.Value, relto, new Result <Importer>()));
            }
            else
            {
                yield return(importerResult = Importer.CreateAsync(dekiApi, manifestResult.Value, reltopath, new Result <Importer>()));
            }
            result.Return(new ImportManager(importerResult.Value, packager));
            yield break;
        }