/// <summary> /// Exports a single data-class. /// </summary> /// <param name="cmdLine"></param> private void ExportOneClass(ExportCommandLine cmdLine) { IXmlDataImex imex = ImexUtils.FindImexForDataClass(cmdLine.DataClass); int itemsPerFile = cmdLine.ItemsPerFile > 0 ? cmdLine.ItemsPerFile : ImexUtils.GetDefaultItemsPerFile(imex.GetType()); string directory; string baseFileName; // if the path has no extension, assume it specifies a directory if (string.IsNullOrEmpty(Path.GetExtension(cmdLine.Path))) { // use the name of the dataclass as a base filename directory = cmdLine.Path; baseFileName = cmdLine.DataClass; } else { // use the specified file name as the base filename directory = Path.GetDirectoryName(cmdLine.Path); baseFileName = Path.GetFileNameWithoutExtension(cmdLine.Path); } ImexUtils.Export(imex, directory, baseFileName, itemsPerFile); }
/// <summary> /// Executes the action specified by the command line arguments. /// </summary> /// <param name="cmdLine"></param> protected override void Execute(ImportCommandLine cmdLine) { IXmlDataImex imex = ImexUtils.FindImexForDataClass(cmdLine.DataClass); ImexUtils.Import(imex, cmdLine.Path); }