public map(List<string> msg) { if (msg.Count <= 1) { gMapType = G_MAP.G_Unknown; } else { for (int i = 1; i < msg.Count; i++ ) uMsg += msg[i]+" "; gMapType = CheckInputType(); } }
public map(List <string> msg) { if (msg.Count <= 1) { gMapType = G_MAP.G_Unknown; } else { for (int i = 1; i < msg.Count; i++) { uMsg += msg[i] + " "; } gMapType = CheckInputType(); } }
/// <summary> /// Smart check the input type /// </summary> /// <returns></returns> private G_MAP CheckInputType() { G_MAP type = G_MAP.G_Unknown; /* * Rules: * Coordinates must be separated by ',' and * */ string tmpMsg = uMsg.Replace('+', '0').Replace('-', '0').Replace(' ', '0').Replace(',', '0').Replace('.', '0'); if (Regex.IsMatch(tmpMsg, @"^[0-9]+$")) { type = G_MAP.G_GetAddress; } else { type = G_MAP.G_GetCoordinates; } return(type); }