protected string ValidateEnumMembersPath(string path) { if (string.IsNullOrEmpty(path.Trim())) { this.ReportError(this.currentElement.Location, EdmErrorCode.InvalidEnumMemberPath, Edm.Strings.CsdlParser_InvalidEnumMemberPath(path)); } string[] enumValues = path.Split(' ').Where(s => !string.IsNullOrEmpty(s)).ToArray(); string enumType = null; foreach (var enumValue in enumValues) { string[] segments = enumValue.Split('/'); if (!(segments.Count() == 2 && EdmUtil.IsValidDottedName(segments[0]) && EdmUtil.IsValidUndottedName(segments[1]))) { this.ReportError(this.currentElement.Location, EdmErrorCode.InvalidEnumMemberPath, Edm.Strings.CsdlParser_InvalidEnumMemberPath(path)); } if (enumType != null && segments[0] != enumType) { this.ReportError(this.currentElement.Location, EdmErrorCode.InvalidEnumMemberPath, Edm.Strings.CsdlParser_InvalidEnumMemberPath(path)); } enumType = segments[0]; } return(string.Join(" ", enumValues)); }
private string ValidateEnumMemberPath(string path) { char[] chrArray = new char[1]; chrArray[0] = '/'; string[] strArrays = path.Split(chrArray); if (strArrays.Count <string>() != 2 || !EdmUtil.IsValidDottedName(strArrays[0]) || !EdmUtil.IsValidUndottedName(strArrays[1])) { base.ReportError(this.currentElement.Location, EdmErrorCode.InvalidEnumMemberPath, Strings.CsdlParser_InvalidEnumMemberPath(path)); } return(path); }
private string ValidateEnumMemberPath(string path) { string[] segments = path.Split('/'); if (!(segments.Count() == 2 && EdmUtil.IsValidDottedName(segments[0]) && EdmUtil.IsValidUndottedName(segments[1]))) { this.ReportError(this.currentElement.Location, EdmErrorCode.InvalidEnumMemberPath, Edm.Strings.CsdlParser_InvalidEnumMemberPath(path)); } return(path); }