Ejemplo n.º 1
0
        public int Execute(ImportPackageOptions options)
        {
            var directoryName = Path.GetDirectoryName(options.PackagePath);

            if (string.IsNullOrEmpty(directoryName))
            {
                directoryName = ".\\";
            }

            var searchPattern = Path.GetFileName(options.PackagePath);

            if (string.IsNullOrEmpty(searchPattern))
            {
                searchPattern = "*.empkg";
            }

            var packagePaths = Directory.EnumerateFiles(directoryName, searchPattern)
                               .Select(Path.GetFullPath);

            foreach (var path in packagePaths)
            {
                Console.WriteLine($"Importing Package at {path}");

                var importer = new PackageImporter(conn, PackageImportConflictOption.Overwrite);
                var package  = new ExportPackage(path);

                if (!importer.Import(package))
                {
                    throw new InvalidOperationException($"Could not import the package at {path}");
                }
            }

            return(0);
        }
Ejemplo n.º 2
0
 extern private static bool ImportPackage(string packagePath, ImportPackageOptions options);