<commit_before>﻿/******************************************************************************* 
  * Copyright 2018 Esri 
  *  
  *  Licensed under the Apache License, Version 2.0 (the "License"); 
  *  you may not use this file except in compliance with the License. 
  *  You may obtain a copy of the License at 
  *  
  *  http://www.apache.org/licenses/LICENSE-2.0 
  *   
  *   Unless required by applicable law or agreed to in writing, software 
  *   distributed under the License is distributed on an "AS IS" BASIS, 
  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
  *   See the License for the specific language governing permissions and 
  *   limitations under the License. 
  ******************************************************************************/ 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CoordinateConversionLibrary.Models;

namespace CoordinateConversionLibrary.Helpers
{
    public class ConversionUtils
    {
        public static CoordinateType GetCoordinateString(string input, out string formattedString)
        {
            formattedString = string.Empty;
            // DD
            CoordinateDD dd;
            if (CoordinateDD.TryParse(input, out dd))
            {
                formattedString = dd.ToString("Y0.0#N X0.0#E", new CoordinateDDFormatter());
                return CoordinateType.DD;
            }

            // DDM
            CoordinateDDM ddm;
            if (CoordinateDDM.TryParse(input, out ddm))
            {
                dd = new CoordinateDD(ddm);
                formattedString = ddm.ToString("", new CoordinateDDMFormatter());
                return CoordinateType.DDM;
            }
            // DMS
            CoordinateDMS dms;
            if (CoordinateDMS.TryParse(input, out dms))
            {
                dd = new CoordinateDD(dms);
                formattedString = dms.ToString("A0°B0'C0.0##\"N X0°Y0'Z0.0##\"E", new CoordinateDMSFormatter());
                return CoordinateType.DMS;
            }

            CoordinateGARS gars;
            if (CoordinateGARS.TryParse(input, out gars))
            {
                formattedString = gars.ToString("", new CoordinateGARSFormatter());
                return CoordinateType.GARS;
            }

            CoordinateMGRS mgrs;
            if (CoordinateMGRS.TryParse(input, out mgrs))
            {
                formattedString = mgrs.ToString("ZSX00000Y00000", new CoordinateMGRSFormatter());
                return CoordinateType.MGRS;
            }

            CoordinateUSNG usng;
            if (CoordinateUSNG.TryParse(input, out usng))
            {
                formattedString = usng.ToString("ZSX00000Y00000", new CoordinateMGRSFormatter());
                return CoordinateType.USNG;
            }

            CoordinateUTM utm;
            if (CoordinateUTM.TryParse(input, out utm))
            {
                formattedString = utm.ToString("", new CoordinateUTMFormatter());
                return CoordinateType.UTM;
            }

            return CoordinateType.Unknown;
        }
    }
}<commit_msg>Fixed if statement<commit_after>﻿/******************************************************************************* 
  * Copyright 2018 Esri 
  *  
  *  Licensed under the Apache License, Version 2.0 (the "License"); 
  *  you may not use this file except in compliance with the License. 
  *  You may obtain a copy of the License at 
  *  
  *  http://www.apache.org/licenses/LICENSE-2.0 
  *   
  *   Unless required by applicable law or agreed to in writing, software 
  *   distributed under the License is distributed on an "AS IS" BASIS, 
  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
  *   See the License for the specific language governing permissions and 
  *   limitations under the License. 
  ******************************************************************************/ 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CoordinateConversionLibrary.Models;

namespace CoordinateConversionLibrary.Helpers
{
    public class ConversionUtils
    {
        public static CoordinateType GetCoordinateString(string input, out string formattedString)
        {
            formattedString = string.Empty;
            // DD
            CoordinateDD dd;
            if (CoordinateDD.TryParse(input, out dd) == true)
            {
                formattedString = dd.ToString("Y0.0#N X0.0#E", new CoordinateDDFormatter());
                return CoordinateType.DD;
            }

            // DDM
            CoordinateDDM ddm;
            if (CoordinateDDM.TryParse(input, out ddm) == true)
            {
                dd = new CoordinateDD(ddm);
                formattedString = ddm.ToString("", new CoordinateDDMFormatter());
                return CoordinateType.DDM;
            }
            // DMS
            CoordinateDMS dms;
            if (CoordinateDMS.TryParse(input, out dms) == true)
            {
                dd = new CoordinateDD(dms);
                formattedString = dms.ToString("A0°B0'C0.0##\"N X0°Y0'Z0.0##\"E", new CoordinateDMSFormatter());
                return CoordinateType.DMS;
            }

            CoordinateGARS gars;
            if (CoordinateGARS.TryParse(input, out gars) == true)
            {
                formattedString = gars.ToString("", new CoordinateGARSFormatter());
                return CoordinateType.GARS;
            }

            CoordinateMGRS mgrs;
            if (CoordinateMGRS.TryParse(input, out mgrs) == true)
            {
                formattedString = mgrs.ToString("ZSX00000Y00000", new CoordinateMGRSFormatter());
                return CoordinateType.MGRS;
            }

            CoordinateUSNG usng;
            if (CoordinateUSNG.TryParse(input, out usng) == true)
            {
                formattedString = usng.ToString("ZSX00000Y00000", new CoordinateMGRSFormatter());
                return CoordinateType.USNG;
            }

            CoordinateUTM utm;
            if (CoordinateUTM.TryParse(input, out utm) == true)
            {
                formattedString = utm.ToString("", new CoordinateUTMFormatter());
                return CoordinateType.UTM;
            }

            return CoordinateType.Unknown;
        }
    }
}
{'fraction_non_alphanumeric': 0.12859139617953097, 'fraction_numerical': 0.012424289485945022, 'mean_word_length': 1.9995342338146251, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1894497', 'n_tokens_mistral': 1800, 'n_tokens_neox': 1666, 'n_words': 421}