Kipunji.Models.NamespaceModel.ParseRequest C# (CSharp) Method

ParseRequest() public method

public ParseRequest ( string path ) : List
path string
return List
        public List<BaseDocModel> ParseRequest(string path)
        {
            List<BaseDocModel> results = new List<BaseDocModel> ();

            // Look for an exact match
            var ns = Types.Where (p => string.Compare (p.Name, path, true) == 0).FirstOrDefault ();

            // We build a new one, as the index is shallow
            if (ns != null) {
                results.Add (ModelFactory.CreateType (Assembly, Name, path, true));
                return results;
            }

            // Not an exact match, try breaking into pieces and looking for members
            foreach (string piece in ParsePath (path)) {
                var type = Types.Where (p => string.Compare (p.Name, piece, true) == 0).FirstOrDefault ();

                if (type != null) {
                    // Index is shallow, load members
                    type = ModelFactory.CreateType (Assembly, Name, type.Name, false);
                    results.AddRange (type.FindMembers (RemovePiece (path, piece)));
                }
            }

            return results;
        }