本文整理汇总了C#中DotNetNuke.Services.FileSystem.FolderMappingInfo类的典型用法代码示例。如果您正苦于以下问题:C# FolderMappingInfo类的具体用法?C# FolderMappingInfo怎么用?C# FolderMappingInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FolderMappingInfo类属于DotNetNuke.Services.FileSystem命名空间,在下文中一共展示了FolderMappingInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CopyFile
/// <summary>
/// Copies the specified file to the destination folder.
/// </summary>
public virtual void CopyFile(string folderPath, string fileName, string newFolderPath, FolderMappingInfo folderMapping)
{
Requires.NotNull("folderPath", folderPath);
Requires.NotNullOrEmpty("fileName", fileName);
Requires.NotNull("newFolderPath", newFolderPath);
Requires.NotNull("folderMapping", folderMapping);
if (folderPath == newFolderPath) return;
var sourceFolder = new FolderInfo { FolderPath = folderPath, FolderMappingID = folderMapping.FolderMappingID, PortalID = folderMapping.PortalID };
var destinationFolder = new FolderInfo { FolderPath = newFolderPath, FolderMappingID = folderMapping.FolderMappingID, PortalID = folderMapping.PortalID };
using (var fileContent = GetFileStream(sourceFolder, fileName))
{
if (!fileContent.CanSeek)
{
using (var seekableStream = FileManager.Instance.GetSeekableStream(fileContent))
{
AddFile(destinationFolder, fileName, seekableStream);
}
}
else
{
AddFile(destinationFolder, fileName, fileContent);
}
}
}
开发者ID:biganth,项目名称:Curt,代码行数:30,代码来源:FolderProvider.cs
示例2: CopyFile
public override void CopyFile(string folderPath, string fileName, string newFolderPath, FolderMappingInfo folderMapping)
{
Requires.NotNull("folderPath", folderPath);
Requires.NotNullOrEmpty("fileName", fileName);
Requires.NotNull("newFolderPath", newFolderPath);
Requires.NotNull("folderMapping", folderMapping);
if (folderPath == newFolderPath) return;
var filePath = GetActualPath(folderMapping, folderPath, fileName);
var newFilePath = GetActualPath(folderMapping, newFolderPath, fileName);
if (FileWrapper.Instance.Exists(filePath))
{
FileWrapper.Instance.Copy(filePath, newFilePath, true);
}
}
开发者ID:rjallepalli,项目名称:PIX_CMS,代码行数:17,代码来源:StandardFolderProvider.cs
示例3: DeleteFile_Calls_FolderProviderDeleteFile
public void DeleteFile_Calls_FolderProviderDeleteFile()
{
//Arrange
var fileInfo = new FileInfoBuilder().Build();
_fileVersionController.Setup(fv => fv.DeleteAllUnpublishedVersions(fileInfo, false));
var folderMapping = new FolderMappingInfo { FolderProviderType = Constants.FOLDER_ValidFolderProviderType };
_folderMappingController.Setup(fmc => fmc.GetFolderMapping(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidFolderMappingID)).Returns(folderMapping);
_mockData.Setup(md => md.DeleteFile(It.IsAny<int>(), It.IsAny<string>(), It.IsAny<int>()));
_mockFolderProvider.Setup(mf => mf.DeleteFile(fileInfo)).Verifiable();
string someString;
_mockFileLockingController.Setup(mflc => mflc.IsFileLocked(fileInfo, out someString)).Returns(false);
//Act
FileDeletionController.Instance.DeleteFile(fileInfo);
//Assert
_mockFolderProvider.Verify();
}
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:22,代码来源:FileDeletionControllerTests.cs
示例4: RenameFile_Calls_FolderProvider_RenameFile_When_FileNames_Are_Distinct_And_NewFileName_Does_Not_Exist
public void RenameFile_Calls_FolderProvider_RenameFile_When_FileNames_Are_Distinct_And_NewFileName_Does_Not_Exist()
{
_fileInfo.Setup(fi => fi.FileName).Returns(Constants.FOLDER_ValidFileName);
_fileInfo.Setup(fi => fi.PortalId).Returns(Constants.CONTENT_ValidPortalId);
_fileInfo.Setup(fi => fi.FolderId).Returns(Constants.FOLDER_ValidFolderId);
_fileInfo.Setup(fi => fi.FolderMappingID).Returns(Constants.FOLDER_ValidFolderMappingID);
_folderManager.Setup(fm => fm.GetFolder(Constants.FOLDER_ValidFolderId)).Returns(_folderInfo.Object);
_mockFileManager.Setup(mfm => mfm.FileExists(_folderInfo.Object, Constants.FOLDER_OtherValidFileName, It.IsAny<bool>())).Returns(false);
_mockFileManager.Setup(mfm => mfm.UpdateFile(_fileInfo.Object));
var folderMapping = new FolderMappingInfo();
folderMapping.FolderProviderType = Constants.FOLDER_ValidFolderProviderType;
_folderMappingController.Setup(fmc => fmc.GetFolderMapping(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidFolderMappingID)).Returns(folderMapping);
_mockFileManager.Object.RenameFile(_fileInfo.Object, Constants.FOLDER_OtherValidFileName);
_mockFolder.Verify(mf => mf.RenameFile(_fileInfo.Object, Constants.FOLDER_OtherValidFileName), Times.Once());
}
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:21,代码来源:FileManagerTests.cs
示例5: RenameFile_Throws_When_FolderProvider_Throws
public void RenameFile_Throws_When_FolderProvider_Throws()
{
_fileInfo.Setup(fi => fi.FileName).Returns(Constants.FOLDER_ValidFileName);
_fileInfo.Setup(fi => fi.PortalId).Returns(Constants.CONTENT_ValidPortalId);
_fileInfo.Setup(fi => fi.FolderId).Returns(Constants.FOLDER_ValidFolderId);
_fileInfo.Setup(fi => fi.FolderMappingID).Returns(Constants.FOLDER_ValidFolderMappingID);
_folderManager.Setup(fm => fm.GetFolder(Constants.FOLDER_ValidFolderId)).Returns(_folderInfo.Object);
_mockFileManager.Setup(mfm => mfm.FileExists(_folderInfo.Object, Constants.FOLDER_OtherValidFileName, It.IsAny<bool>())).Returns(false);
_mockFileManager.Setup(mfm => mfm.UpdateFile(_fileInfo.Object));
var folderMapping = new FolderMappingInfo();
folderMapping.FolderProviderType = Constants.FOLDER_ValidFolderProviderType;
_folderMappingController.Setup(fmc => fmc.GetFolderMapping(Constants.FOLDER_ValidFolderMappingID)).Returns(folderMapping);
_mockFolder.Setup(mf => mf.RenameFile(_fileInfo.Object, Constants.FOLDER_OtherValidFileName)).Throws<Exception>();
_mockFileManager.Object.RenameFile(_fileInfo.Object, Constants.FOLDER_OtherValidFileName);
}
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:21,代码来源:FileManagerTests.cs
示例6: GetFolderMappingViewModel
private FolderMappingViewModel GetFolderMappingViewModel(FolderMappingInfo folderMapping)
{
return new FolderMappingViewModel
{
Id = folderMapping.FolderMappingID,
FolderTypeName = folderMapping.FolderProviderType,
Name = folderMapping.MappingName
};
}
开发者ID:rjallepalli,项目名称:PIX_CMS,代码行数:9,代码来源:DigitalAssetsController.cs
示例7: GetSubFolders
/// <summary>
/// Gets the list of subfolders for the specified folder.
/// </summary>
public abstract IEnumerable<string> GetSubFolders(string folderPath, FolderMappingInfo folderMapping);
开发者ID:rrsc,项目名称:Dnn.Platform,代码行数:4,代码来源:FolderProvider.cs
示例8: GetActualPath
/// <summary>
/// Get actual path to a folder in the specified folder mapping
/// </summary>
/// <param name="folderMapping">The folder mapping</param>
/// <param name="folderPath">The folder path</param>
/// <returns>A windows supported path to the folder</returns>
protected virtual string GetActualPath(FolderMappingInfo folderMapping, string folderPath)
{
return PathUtils.Instance.GetPhysicalPath(folderMapping.PortalID, folderPath);
}
开发者ID:rjallepalli,项目名称:PIX_CMS,代码行数:10,代码来源:StandardFolderProvider.cs
示例9: ExistsFolder_Throws_On_Null_FolderPath
public void ExistsFolder_Throws_On_Null_FolderPath()
{
var folderMapping = new FolderMappingInfo();
_sfp.FolderExists(null, folderMapping);
}
开发者ID:biganth,项目名称:Curt,代码行数:6,代码来源:StandardFolderProviderTests.cs
示例10: FolderExists
public override bool FolderExists(string folderPath, FolderMappingInfo folderMapping)
{
Requires.NotNull("folderPath", folderPath);
Requires.NotNull("folderMapping", folderMapping);
return DirectoryWrapper.Instance.Exists(GetActualPath(folderMapping, folderPath));
}
开发者ID:rjallepalli,项目名称:PIX_CMS,代码行数:7,代码来源:StandardFolderProvider.cs
示例11: GetSubFolders_Throws_On_Null_FolderPath
public void GetSubFolders_Throws_On_Null_FolderPath()
{
var folderMapping = new FolderMappingInfo();
_sfp.GetSubFolders(null, folderMapping).ToList();
}
开发者ID:biganth,项目名称:Curt,代码行数:6,代码来源:StandardFolderProviderTests.cs
示例12: AddFile_Throws_When_Portal_Has_No_Space_Available
public void AddFile_Throws_When_Portal_Has_No_Space_Available()
{
_folderInfo.Setup(fi => fi.PortalID).Returns(Constants.CONTENT_ValidPortalId);
_folderInfo.Setup(fi => fi.PhysicalPath).Returns(Constants.FOLDER_ValidFolderPath);
_folderInfo.Setup(fi => fi.PhysicalPath).Returns(Constants.FOLDER_ValidFolderPath);
_folderInfo.Setup(fi => fi.FolderMappingID).Returns(Constants.FOLDER_ValidFolderMappingID);
_mockData.Setup(c => c.GetProviderPath()).Returns(String.Empty);
var fileContent = new MemoryStream();
_globals.Setup(g => g.GetSubFolderPath(Constants.FOLDER_ValidFilePath, Constants.CONTENT_ValidPortalId)).Returns(Constants.FOLDER_ValidFolderRelativePath);
var folderMapping = new FolderMappingInfo { FolderProviderType = Constants.FOLDER_ValidFolderProviderType };
_folderMappingController.Setup(fmc => fmc.GetFolderMapping(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidFolderMappingID)).Returns(folderMapping);
_portalController.Setup(pc => pc.HasSpaceAvailable(Constants.CONTENT_ValidPortalId, fileContent.Length)).Returns(false);
_mockFileManager.Setup(fm => fm.CreateFileContentItem()).Returns(new ContentItem());
_mockFileManager.Object.AddFile(_folderInfo.Object, Constants.FOLDER_ValidFileName, fileContent, false, false, Constants.CONTENTTYPE_ValidContentType);
}
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:23,代码来源:FileManagerTests.cs
示例13: AddFile_Checks_Space_For_Stream_Length
public void AddFile_Checks_Space_For_Stream_Length()
{
//Arrange
_folderInfo.Setup(fi => fi.PortalID).Returns(Constants.CONTENT_ValidPortalId);
_folderInfo.Setup(fi => fi.FolderID).Returns(Constants.FOLDER_ValidFolderId);
_folderInfo.Setup(fi => fi.PhysicalPath).Returns(Constants.FOLDER_ValidFolderPath);
_folderInfo.Setup(fi => fi.FolderMappingID).Returns(Constants.FOLDER_ValidFolderMappingID);
_folderInfo.Setup(fi => fi.WorkflowID).Returns(Null.NullInteger);
var fileContent = new MemoryStream(Encoding.ASCII.GetBytes("some data here"));
_portalController.Setup(pc => pc.HasSpaceAvailable(It.IsAny<int>(), It.IsAny<long>())).Returns(true);
_globals.Setup(g => g.GetSubFolderPath(Constants.FOLDER_ValidFilePath, Constants.CONTENT_ValidPortalId)).Returns(Constants.FOLDER_ValidFolderRelativePath);
var folderMapping = new FolderMappingInfo { FolderProviderType = Constants.FOLDER_ValidFolderProviderType };
_folderMappingController.Setup(fmc => fmc.GetFolderMapping(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidFolderMappingID)).Returns(folderMapping);
_mockFolder.Setup(mf => mf.FileExists(_folderInfo.Object, Constants.FOLDER_ValidFileName)).Returns(false);
_mockFolder.Setup(mf => mf.AddFile(_folderInfo.Object, Constants.FOLDER_ValidFileName, fileContent)).Verifiable();
_mockFileManager.Setup(mfm => mfm.IsAllowedExtension(Constants.FOLDER_ValidFileName)).Returns(true);
_mockFileManager.Setup(mfm => mfm.CreateFileContentItem()).Returns(new ContentItem());
_contentWorkflowController.Setup(wc => wc.GetWorkflowByID(It.IsAny<int>())).Returns((ContentWorkflow)null);
//Act
_mockFileManager.Object.AddFile(_folderInfo.Object, Constants.FOLDER_ValidFileName, fileContent, true, false, Constants.CONTENTTYPE_ValidContentType);
//Assert
_portalController.Verify(pc => pc.HasSpaceAvailable(Constants.CONTENT_ValidPortalId, fileContent.Length));
}
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:34,代码来源:FileManagerTests.cs
示例14: GetSubFolders_Returns_Valid_SubFolders_When_Folder_Is_Not_Empty
public void GetSubFolders_Returns_Valid_SubFolders_When_Folder_Is_Not_Empty()
{
var expectedSubFolders = new[] {
Constants.FOLDER_ValidSubFolderRelativePath,
Constants.FOLDER_OtherValidSubFolderRelativePath
};
var folderMapping = new FolderMappingInfo { PortalID = Constants.CONTENT_ValidPortalId };
_pathUtils.Setup(pu => pu.GetPhysicalPath(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidFolderRelativePath)).Returns(Constants.FOLDER_ValidFolderPath);
_pathUtils.Setup(pu => pu.GetRelativePath(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidSubFolderPath)).Returns(Constants.FOLDER_ValidSubFolderRelativePath);
_pathUtils.Setup(pu => pu.GetRelativePath(Constants.CONTENT_ValidPortalId, Constants.FOLDER_OtherValidSubFolderPath)).Returns(Constants.FOLDER_OtherValidSubFolderRelativePath);
var subFolders = new[] {
Constants.FOLDER_ValidSubFolderPath,
Constants.FOLDER_OtherValidSubFolderPath
};
_directoryWrapper.Setup(dw => dw.GetDirectories(Constants.FOLDER_ValidFolderPath)).Returns(subFolders);
var result = _sfp.GetSubFolders(Constants.FOLDER_ValidFolderRelativePath, folderMapping).ToList();
CollectionAssert.AreEqual(expectedSubFolders, result);
}
开发者ID:biganth,项目名称:Curt,代码行数:24,代码来源:StandardFolderProviderTests.cs
示例15: GetSubFolders_Count_Equals_DirectoryWrapper_GetDirectories_Count
public void GetSubFolders_Count_Equals_DirectoryWrapper_GetDirectories_Count()
{
var folderMapping = new FolderMappingInfo { PortalID = Constants.CONTENT_ValidPortalId };
_pathUtils.Setup(pu => pu.GetPhysicalPath(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidFolderRelativePath)).Returns(Constants.FOLDER_ValidFolderPath);
_pathUtils.Setup(pu => pu.GetRelativePath(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidSubFolderPath)).Returns(Constants.FOLDER_ValidSubFolderRelativePath);
_pathUtils.Setup(pu => pu.GetRelativePath(Constants.CONTENT_ValidPortalId, Constants.FOLDER_OtherValidSubFolderPath)).Returns(Constants.FOLDER_OtherValidSubFolderRelativePath);
var subFolders = new[] {
Constants.FOLDER_ValidSubFolderPath,
Constants.FOLDER_OtherValidSubFolderPath
};
_directoryWrapper.Setup(dw => dw.GetDirectories(Constants.FOLDER_ValidFolderPath)).Returns(subFolders);
var result = _sfp.GetSubFolders(Constants.FOLDER_ValidFolderRelativePath, folderMapping).ToList();
Assert.AreEqual(subFolders.Length, result.Count);
}
开发者ID:biganth,项目名称:Curt,代码行数:19,代码来源:StandardFolderProviderTests.cs
示例16: GetSubFolders_Calls_DirectoryWrapper_GetDirectories
public void GetSubFolders_Calls_DirectoryWrapper_GetDirectories()
{
var folderMapping = new FolderMappingInfo { PortalID = Constants.CONTENT_ValidPortalId };
_pathUtils.Setup(pu => pu.GetPhysicalPath(folderMapping.PortalID, Constants.FOLDER_ValidFolderRelativePath)).Returns(Constants.FOLDER_ValidFolderPath);
_sfp.GetSubFolders(Constants.FOLDER_ValidFolderRelativePath, folderMapping).ToList();
_directoryWrapper.Verify(dw => dw.GetDirectories(Constants.FOLDER_ValidFolderPath), Times.Once());
}
开发者ID:biganth,项目名称:Curt,代码行数:10,代码来源:StandardFolderProviderTests.cs
示例17: DeleteFile_Throws_WhenFolderProviderThrows
public void DeleteFile_Throws_WhenFolderProviderThrows()
{
//Arrange
var fileInfo = new FileInfoBuilder().Build();
_fileVersionController.Setup(fv => fv.DeleteAllUnpublishedVersions(fileInfo, false));
var folderMapping = new FolderMappingInfo { FolderProviderType = Constants.FOLDER_ValidFolderProviderType };
_folderMappingController.Setup(fmc => fmc.GetFolderMapping(Constants.FOLDER_ValidFolderMappingID)).Returns(folderMapping);
string someString;
_mockFileLockingController.Setup(mflc => mflc.IsFileLocked(fileInfo, out someString)).Returns(false);
_mockFolderProvider.Setup(mf => mf.DeleteFile(fileInfo)).Throws<Exception>();
FileDeletionController.Instance.DeleteFile(fileInfo);
}
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:19,代码来源:FileDeletionControllerTests.cs
示例18: MoveFolder
public override void MoveFolder(string folderPath, string newFolderPath, FolderMappingInfo folderMapping)
{
// The folder has already been moved in filesystem
}
开发者ID:rjallepalli,项目名称:PIX_CMS,代码行数:4,代码来源:StandardFolderProvider.cs
示例19: AddFile_Does_Not_Call_FolderProvider_AddFile_When_Not_Overwritting_And_File_Exists
public void AddFile_Does_Not_Call_FolderProvider_AddFile_When_Not_Overwritting_And_File_Exists()
{
_folderInfo.Setup(fi => fi.PortalID).Returns(Constants.CONTENT_ValidPortalId);
_folderInfo.Setup(fi => fi.FolderID).Returns(Constants.FOLDER_ValidFolderId);
_folderInfo.Setup(fi => fi.PhysicalPath).Returns(Constants.FOLDER_ValidFolderPath);
_folderInfo.Setup(fi => fi.FolderMappingID).Returns(Constants.FOLDER_ValidFolderMappingID);
_folderInfo.Setup(fi => fi.WorkflowID).Returns(Null.NullInteger);
var fileContent = new MemoryStream();
_portalController.Setup(pc => pc.HasSpaceAvailable(Constants.CONTENT_ValidPortalId, fileContent.Length)).Returns(true);
_globals.Setup(g => g.GetSubFolderPath(Constants.FOLDER_ValidFilePath, Constants.CONTENT_ValidPortalId)).Returns(Constants.FOLDER_ValidFolderRelativePath);
var folderMapping = new FolderMappingInfo { FolderProviderType = Constants.FOLDER_ValidFolderProviderType };
_folderMappingController.Setup(fmc => fmc.GetFolderMapping(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidFolderMappingID)).Returns(folderMapping);
_mockFolder.Setup(mf => mf.FileExists(_folderInfo.Object, Constants.FOLDER_ValidFileName)).Returns(true);
_mockFolder.Setup(mf => mf.AddFile(_folderInfo.Object, Constants.FOLDER_ValidFileName, fileContent));
_mockFileManager.Setup(mfm => mfm.IsAllowedExtension(Constants.FOLDER_ValidFileName)).Returns(true);
_mockFileManager.Setup(mfm => mfm.UpdateFile(It.IsAny<IFileInfo>(), It.IsAny<Stream>()));
_mockFileManager.Setup(mfm => mfm.CreateFileContentItem()).Returns(new ContentItem());
_contentWorkflowController.Setup(wc => wc.GetWorkflowByID(It.IsAny<int>())).Returns((ContentWorkflow)null);
_mockData.Setup(
md =>
md.AddFile(It.IsAny<int>(),
It.IsAny<Guid>(),
It.IsAny<Guid>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<long>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<string>(),
It.IsAny<DateTime>(),
It.IsAny<string>(),
It.IsAny<DateTime>(),
It.IsAny<DateTime>(),
It.IsAny<bool>(),
It.IsAny<int>()))
.Returns(Constants.FOLDER_ValidFileId);
_mockData.Setup(md => md.UpdateFileLastModificationTime(It.IsAny<int>(), It.IsAny<DateTime>()));
_mockFileManager.Object.AddFile(_folderInfo.Object, Constants.FOLDER_ValidFileName, fileContent, false, false, Constants.CONTENTTYPE_ValidContentType);
_mockFolder.Verify(mf => mf.AddFile(It.IsAny<IFolderInfo>(), It.IsAny<string>(), It.IsAny<Stream>()), Times.Never());
}
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:56,代码来源:FileManagerTests.cs
示例20: ExistsFolder_Returns_False_When_Folder_Does_Not_Exist
public void ExistsFolder_Returns_False_When_Folder_Does_Not_Exist()
{
var folderMapping = new FolderMappingInfo { PortalID = Constants.CONTENT_ValidPortalId };
_pathUtils.Setup(pu => pu.GetPhysicalPath(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidFolderRelativePath)).Returns(Constants.FOLDER_ValidFolderPath);
_directoryWrapper.Setup(dw => dw.Exists(Constants.FOLDER_ValidFolderPath)).Returns(false);
var result = _sfp.FolderExists(Constants.FOLDER_ValidFolderRelativePath, folderMapping);
Assert.IsFalse(result);
}
开发者ID:biganth,项目名称:Curt,代码行数:12,代码来源:StandardFolderProviderTests.cs
注:本文中的DotNetNuke.Services.FileSystem.FolderMappingInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论