private static bool MatchesElements(ProjectViewRow row, string networkElement, string recordingElement) { string functionalUnit; bool haveFU = UriTemplates.TryExtractFunctionalUnit(networkElement, out networkElement, out functionalUnit); bool matchesNetworkElement = (networkElement == UriTemplates.MatchAll) || (URLSafeString(row.NetworkElementName) == URLSafeString(networkElement)); bool satisfiesFU = !haveFU || (URLSafeString(row.WaterFeatureType) == URLSafeString(functionalUnit)); bool matchesRecordingElement = (recordingElement == UriTemplates.MatchAll) || (URLSafeString(row.ElementName) == URLSafeString(recordingElement)); return(matchesNetworkElement && matchesRecordingElement && satisfiesFU); }
public TimeSeriesLink Parse(string partialURL) { string[] bits = partialURL.Split('/'); var result = new TimeSeriesLink { NetworkElement = bits[1], RecordingElement = bits[3], RecordingVariable = bits[5] }; bool haveFU = UriTemplates.TryExtractFunctionalUnit(result.NetworkElement, out result.NetworkElement, out result.FunctionalUnit); if (!haveFU && (bits.Length >= 8)) { result.FunctionalUnit = bits[7]; } return(result); }