-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
40 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,60 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System; | ||
using static System.IO.Path; | ||
|
||
namespace SL3Reader | ||
{ | ||
public static class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
if (args.Length != 2) | ||
{ | ||
Console.WriteLine(@"Usage example: SL3Reader.exe C:\input.sl3 D:\output.csv"); | ||
namespace SL3Reader { | ||
|
||
public static class Program { | ||
public static void Main(string[] args) { | ||
if (args.Length != 3) { | ||
PrintUsage(); | ||
return; | ||
} | ||
|
||
string input = GetFullPath(args[0]); | ||
if(!Exists(input)) | ||
{ | ||
if (!Exists(input)) { | ||
Console.WriteLine("Input file not found!"); | ||
PrintUsage(); | ||
return; | ||
} | ||
|
||
string output = GetFullPath(args[1]); | ||
if (!Exists(GetDirectoryName(output))) | ||
{ | ||
if (!Exists(GetDirectoryName(output))) { | ||
Console.WriteLine("Directory not found for the output file!"); | ||
PrintUsage(); | ||
return; | ||
} | ||
|
||
using SL3Reader sl3reader = new(input); | ||
|
||
sl3reader.Export3D(output); | ||
//sl3reader.ExportImagery(@"F:\SS\", SurveyType.DownScan); | ||
//sl3reader.ExamineUnknown8Datasets(); | ||
string expSelector = args[2].Trim().ToLowerInvariant(); | ||
switch (expSelector) { | ||
case "-3d": | ||
sl3reader.Export3D(output); | ||
break; | ||
case "-route": | ||
sl3reader.ExportToCSV(output); | ||
break; | ||
default: | ||
Console.WriteLine("Invalid third argument (" + expSelector + ")."); | ||
PrintUsage(); | ||
return; | ||
} | ||
|
||
PrintSummary(); | ||
|
||
return; | ||
|
||
//sl3reader.ExportToCSV(output); | ||
static void PrintUsage() { | ||
Console.WriteLine("Usage examples:"); | ||
Console.WriteLine("To export 3D points: SL3Reader.exe \"C:\\input.sl3\" \"D:\\output.csv\" -3d"); | ||
Console.WriteLine("To export route: SL3Reader.exe \"C:\\input.sl3\" \"D:\\output.csv\" -route"); | ||
} | ||
|
||
void PrintSummary() { | ||
Console.WriteLine("Number of frames: " + sl3reader.Frames.Count.ToString()); | ||
Console.WriteLine("Number of 3D frames: " + sl3reader.IndexByType[SurveyType.ThreeDimensional].Count.ToString()); | ||
Console.WriteLine("\nExport finished successfully."); | ||
} | ||
} | ||
} | ||
} | ||
} |