Beispiel #1
0
		// Split the data into the base url for the handler to operate on, and relative
		// information required.
		// For example:
		//    zip://demo.zip       => (demo.zip, )
		//    zip:/demo.zip/docs  => (demo.zip, docs)
		//    zip://targz://http://www.go-mono.com/demo.tar.gz#mcs/file/assemblies.zip#mscorlib.dll
		//       => (targz://http://www.go-mono.com/demo.tar.gz#mcs/file/assemblies.zip, mscorlib.dll)
		//
		static VirtualEntry Activate (string urlPath, string prefix, VfsHandler handler)
		{
			string path = urlPath.Substring (prefix.Length);
			int lastHash = path.LastIndexOf ('#');
			string relativeData = lastHash == -1 ? "" : path.Substring (lastHash+1);
			if (lastHash != -1)
				path = path.Substring (0, lastHash);

			return handler (path, relativeData);
		}
Beispiel #2
0
        // Split the data into the base url for the handler to operate on, and relative
        // information required.
        // For example:
        //    zip://demo.zip       => (demo.zip, )
        //    zip:/demo.zip/docs  => (demo.zip, docs)
        //    zip://targz://http://www.go-mono.com/demo.tar.gz#mcs/file/assemblies.zip#mscorlib.dll
        //       => (targz://http://www.go-mono.com/demo.tar.gz#mcs/file/assemblies.zip, mscorlib.dll)
        //
        static VirtualEntry Activate(string urlPath, string prefix, VfsHandler handler)
        {
            string path         = urlPath.Substring(prefix.Length);
            int    lastHash     = path.LastIndexOf('#');
            string relativeData = lastHash == -1 ? "" : path.Substring(lastHash + 1);

            if (lastHash != -1)
            {
                path = path.Substring(0, lastHash);
            }

            return(handler(path, relativeData));
        }