static void Main(string[] args) { Console.WriteLine("Starting ADAPT conversion"); DateTime startTime = DateTime.Now; // Initialise ADAPT Convertor AdaptConverter converter = new AdaptConverter(args); if (!converter.IsInitialised) { Console.WriteLine($"Could not initialise conversion settings, stopped"); return; } // Start ADAPT Conversion if (converter.Convert()) { Console.WriteLine($"Conversion successful!"); } else { Console.WriteLine($"Conversion not successful!"); return; } TimeSpan conversionTime = DateTime.Now.Subtract(startTime); Console.WriteLine($"Completed ADAPT conversion in {conversionTime}"); Console.ReadKey(); }
static void Main(string[] args) { if (!CheckImportDataPathAndExportDataPath(args, out string error, out string importDataPath, out string exportDataPath)) { Console.WriteLine(error); WaitForUserInputThenExit(); } if (importDataPath == "" || exportDataPath == "") { Console.WriteLine("importDataPath == '' || exportDataPath == ''"); WaitForUserInputThenExit(); } var rootFolders = GetListOfTaskdataFolders(importDataPath); if (rootFolders == null) { Console.WriteLine("rootFolders == null"); WaitForUserInputThenExit(); } int count = 0; int totalFolders = rootFolders.Count(); AdaptConverter converter; foreach (var folder in rootFolders) { count++; Console.WriteLine($"Starting ADAPT conversion for folder {Path.GetFileName(folder)} ({count}/{totalFolders})"); // Only ImportDataPath and ExportDataPath needed var consoleParameters = new ConsoleParameters(); var root = Directory.GetCurrentDirectory(); consoleParameters.PluginsFolderPath = Path.Combine(root, "Resources\\adapt2.0.4plugins"); consoleParameters.ImportDataPath = folder; consoleParameters.ImportPluginName = "ISOv4Plugin"; consoleParameters.ExportPluginName = "WorkRecordPlugin"; consoleParameters.ExportDataPath = exportDataPath; converter = new AdaptConverter(consoleParameters); try { if (converter.Convert()) { Console.WriteLine("Successfull ADAPT conversion"); continue; } } catch (Exception e) { Console.WriteLine("Exception: " + e.Message + " InnerException: " + e.InnerException?.Message); } Console.WriteLine($"ADAPT conversion unsuccesfull for folder {Path.GetFileName(folder)}"); } Console.WriteLine($"ADAPT conversion succesfull for folders in {importDataPath}"); WaitForUserInputThenExit(); }
static void Main(string[] args) { if (!CheckImportDataPathAndExportDataPath(args, out string error, out string importDataPath, out string exportDataPath)) { Console.WriteLine(error); WaitForUserInputThenExit(); } if (importDataPath == "" || exportDataPath == "") { Console.WriteLine("importDataPath == '' || exportDataPath == ''"); WaitForUserInputThenExit(); } var rootFolders = GetListOfTaskdataFolders(importDataPath); if (rootFolders == null) { Console.WriteLine("rootFolders == null"); WaitForUserInputThenExit(); } int count = 0; int totalFolders = rootFolders.Count(); foreach (var folder in rootFolders) { count++; Console.WriteLine($"Starting ADAPT conversion for folder {Path.GetFileName(folder)} ({count}/{totalFolders})"); // Selecting import and export plugin // Using Nuget package var isoxmlPlugin = new AgGateway.ADAPT.ISOv4Plugin.Plugin(); // Using reference to project var geoJsonPlugin = new GeoJSONPlugin.Plugin(); try { if (AdaptConverter.Convert(isoxmlPlugin, geoJsonPlugin, folder, exportDataPath)) { Console.WriteLine($"Successfull ADAPT conversion for folder {folder}"); continue; } } catch (Exception e) { Console.WriteLine($"Unsuccesfull conversion for folder {Path.GetFileName(folder)}"); Console.WriteLine($"Exception: {e.Message} InnerException: {e.InnerException?.Message}"); } } Console.WriteLine($"ADAPT conversion succesfull for folders in {importDataPath} to folder {exportDataPath}"); WaitForUserInputThenExit(); }