Пример #1
0
        public override VirtualFile GetFile(string virtualPath)
        {
            if (!isInitialized)
            {
                // Initialize the library, if not yet created
                m_library     = LibraryManager.GetLibrary(null);
                isInitialized = true;
            }

            VirtualFile file;

            // If the path is virtual, get the file from the virtual file sytem.
            if (IsPathVirtual(virtualPath))
            {
                // If the file has already been created, return the existing instance.
                if (m_file != null && m_file.VirtualPath.Equals(virtualPath, StringComparison.InvariantCultureIgnoreCase))
                {
                    file = m_file;
                }
                else
                {
                    // If the file has not been created, instantiate it.
                    file = new LibraryVirtualFile(virtualPath);
                }
            }
            else
            {
                // If the file is not virtual, use the default path provider.
                file = Previous.GetFile(virtualPath);
            }

            return(file);
        }
Пример #2
0
        public override bool FileExists(string virtualPath)
        {
            bool result = false;

            // If the path is virtual, see if the file exists.
            if (IsPathVirtual(virtualPath))
            {
                // Create the file and return the value of the Exists property.
                m_file = (LibraryVirtualFile)GetFile(virtualPath);
                result = m_file.Exists;
            }
            else
            {
                m_file = null;
            }

            return(result);
        }