Example #1
0
        static void Main(string[] args)
        {
            using var parser = new CommandLineParser.CommandLineParser();

            args = args.Select(s => s.ToLower()).ToArray();

            try
            {
                var argParser = new H3ToLocalIjArguments();
                parser.ExtractArgumentAttributes(argParser);
                parser.ParseCommandLine(args);
                ProcessArguments(argParser);
            }
            catch (Exception)
            {
                Console.WriteLine("Unable to parse input.");
                parser.ShowUsage();
            }
        }
Example #2
0
        private static void ProcessArguments(H3ToLocalIjArguments argParser)
        {
            var origin = new H3Index(argParser.OriginH3);
            var index  = new H3Index(argParser.IndexH3);

            if (!origin.IsValid())
            {
                Console.WriteLine("Origin is invalid.");
                return;
            }

            (int status, var result) = origin.ToLocalIjExperimental(index);

            Console.WriteLine
            (
                status != 0
                     ? "NA"
                     : $"{result.I} {result.J}"
            );
        }