protected virtual async Task <ILocalizedTemplateContentReader> CreateInternalAsync(
            TemplateDefinition templateDefinition)
        {
            var virtualPath = templateDefinition.GetVirtualFilePathOrNull();

            if (virtualPath == null)
            {
                return(NullLocalizedTemplateContentReader.Instance);
            }

            var fileInfo = VirtualFileProvider.GetFileInfo(virtualPath);

            if (!fileInfo.Exists)
            {
                throw new AbpException("Could not find a file/folder at the location: " + virtualPath);
            }

            if (fileInfo.IsDirectory)
            {
                var folderReader = new VirtualFolderLocalizedTemplateContentReader();
                await folderReader.ReadContentsAsync(VirtualFileProvider, virtualPath);

                return(folderReader);
            }
            else //File
            {
                var singleFileReader = new FileInfoLocalizedTemplateContentReader();
                await singleFileReader.ReadContentsAsync(fileInfo);

                return(singleFileReader);
            }
        }
        protected virtual async Task <ILocalizedTemplateContentReader> CreateInternalAsync(
            TemplateDefinition templateDefinition)
        {
            var virtualPath = templateDefinition.GetVirtualFilePathOrNull();

            if (virtualPath == null)
            {
                return(NullLocalizedTemplateContentReader.Instance);
            }

            var fileInfo = VirtualFileProvider.GetFileInfo(virtualPath);

            if (!fileInfo.Exists)
            {
                var directoryContents = VirtualFileProvider.GetDirectoryContents(virtualPath);
                if (!directoryContents.Exists)
                {
                    throw new AbpException("Could not find a file/folder at the location: " + virtualPath);
                }

                fileInfo = new VirtualDirectoryFileInfo(virtualPath, virtualPath, DateTimeOffset.UtcNow);
            }

            if (fileInfo.IsDirectory)
            {
                //TODO: Configure file extensions.
                var folderReader = new VirtualFolderLocalizedTemplateContentReader(new[] { ".tpl", ".cshtml" });
                await folderReader.ReadContentsAsync(VirtualFileProvider, virtualPath);

                return(folderReader);
            }
            else //File
            {
                var singleFileReader = new FileInfoLocalizedTemplateContentReader();
                await singleFileReader.ReadContentsAsync(fileInfo);

                return(singleFileReader);
            }
        }