Kipunji.Models.AssemblyModel.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 = Namespaces.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.CreateNamespace (Name, path));
                return results;
            }

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

                if (ns != null)
                    results.AddRange (ns.ParseRequest (RemovePiece (path, piece)));

            }

            return results;
        }