public static LdapPath Parse(string path) { int index = 0; int max = path.Length; LdapPath result = new LdapPath(); while (index < path.Length) { result._items.AddLast(LdapPathItem.Parse(path, ref index)); } return(result); }
internal static LdapPathItem Parse(string path, ref int index) { LdapPathItem item = new LdapPathItem(); StringBuilder str = new StringBuilder(); int max = path.Length; SkipSpaces(path, ref index); while (index < max && path[index] != '=') { str.Append(path[index]); ++index; } if (index == max) { return LdapPathItem.Invalid; } item.Prefix = str.ToString().Trim(); str.Length = 0; ++index; // skip equals SkipSpaces(path, ref index); while (index < max && path[index] != ',') { str.Append(path[index]); ++index; } item.Name = str.ToString().Trim(); if (index < max) { ++index; // skip comma } SkipSpaces(path, ref index); return item; }
internal static LdapPathItem Parse(string path, ref int index) { LdapPathItem item = new LdapPathItem(); StringBuilder str = new StringBuilder(); int max = path.Length; SkipSpaces(path, ref index); while (index < max && path[index] != '=') { str.Append(path[index]); ++index; } if (index == max) { return(LdapPathItem.Invalid); } item.Prefix = str.ToString().Trim(); str.Length = 0; ++index; // skip equals SkipSpaces(path, ref index); while (index < max && path[index] != ',') { str.Append(path[index]); ++index; } item.Name = str.ToString().Trim(); if (index < max) { ++index; // skip comma } SkipSpaces(path, ref index); return(item); }