public static Tags Create(string str) { if (string.IsNullOrEmpty(str)) return null; var obj = new Tags(); var location = new GeoLocation(); var regLat = new Regex(@"geo.lat=(\-){0,1}[0-9]+([.][0-9]+){0,1}"); var regLon = new Regex(@"geo.lon=(\-){0,1}[0-9]+([.][0-9]+){0,1}"); double latitude = 0, longitude = 0; if(GetValueOfLocation(regLat, str, "geo.lat=", ref latitude) || GetValueOfLocation(regLon, str, "geo.lon=", ref longitude)) { obj.Location = new GeoLocation() { Latitude = latitude, Longitude = longitude }; } var tags = SmartSplit(str); foreach(var tag in tags) { if (!regLat.IsMatch(tag) && !regLon.IsMatch(tag) && !string.IsNullOrEmpty(tag)) obj.TagList.Add(tag); } return obj; }
public Tags() { TagList = new List<string>(); Location = null; }