public pathFilterInstructions(string inputString) { if (string.IsNullOrEmpty(inputString)) { return; } sourcePath = inputString; var allowedMatch = regex_allowedType.Matches(inputString); inputString = regex_allowedType.Replace(inputString, ""); foreach (Match item in allowedMatch) { string relName = item.Value.Trim("[]".ToCharArray()); allowedTypeNames.Add(relName); } MatchCollection relationMatch = regex_relationType.Matches(inputString); inputString = regex_relationType.Replace(inputString, ""); foreach (Match item in relationMatch) { string relName = item.Value.Trim("<>".ToCharArray()); resourceRelationTypes rel = resourceRelationTypes.childResource; if (Enum.TryParse <resourceRelationTypes>(relName, out rel)) { allowedRelations.AddUnique(rel); } } cleanPath = inputString; }
/// <summary> /// Vraca prefix string na osnovu tipa odnosa /// </summary> /// <param name="parentRealtionType"></param> /// <param name="def"></param> /// <returns>odgovarajuci prefix string</returns> public static string toPrefixString(this resourceRelationTypes parentRealtionType, string def = imbProjectResourceBase.prefix_CHILD_PATH) { string sep = def; switch (parentRealtionType) { case resourceRelationTypes.linkedResource: sep = imbProjectResourceBase.prefix_LINKED_PROPERTY_PATH; break; case resourceRelationTypes.integratedResource: sep = imbProjectResourceBase.prefix_INTEGRATED_PATH; break; case resourceRelationTypes.nestedResource: sep = imbProjectResourceBase.prefix_INTEGRATED_PATH; break; case resourceRelationTypes.indexerItem: sep = imbProjectResourceBase.prefix_COLLECTION_INDEX_ACCESS; break; case resourceRelationTypes.integratedSimpleObject: case resourceRelationTypes.simpleProperties: case resourceRelationTypes.temporaryObjects: sep = imbProjectResourceBase.prefix_PROPERTY_PATH; break; case resourceRelationTypes.childResource: default: sep = imbProjectResourceBase.prefix_CHILD_PATH; break; } return(sep); }