本文整理汇总了C#中DotNetNuke.Services.FileSystem.FolderInfo类的典型用法代码示例。如果您正苦于以下问题:C# FolderInfo类的具体用法?C# FolderInfo怎么用?C# FolderInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FolderInfo类属于DotNetNuke.Services.FileSystem命名空间,在下文中一共展示了FolderInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddFolder
public int AddFolder(FolderInfo folder)
{
var tmpFolder = FolderManager.Instance.GetFolder(folder.PortalID, folder.FolderPath);
if (tmpFolder != null && folder.FolderID == Null.NullInteger)
{
folder.FolderID = tmpFolder.FolderID;
}
if (folder.FolderID == Null.NullInteger)
{
folder = (FolderInfo)FolderManager.Instance.AddFolder(FolderMappingController.Instance.GetFolderMapping(folder.PortalID, folder.FolderMappingID), folder.FolderPath);
}
else
{
FolderManager.Instance.UpdateFolder(folder);
}
return folder.FolderID;
}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:20,代码来源:FolderController.cs
示例2: RemoveOrphanedFiles
private static void RemoveOrphanedFiles( FolderInfo folder, int PortalId )
{
FileController objFileController = new FileController();
if( folder.StorageLocation != (int)FolderController.StorageLocationTypes.DatabaseSecure )
{
foreach( Services.FileSystem.FileInfo objFile in GetFilesByFolder( PortalId, folder.FolderID ) )
{
RemoveOrphanedFile( objFile, PortalId );
}
}
}
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:12,代码来源:FileSystemUtils.cs
示例3: CollectData
public void CollectData(FolderInfo folderInfo, int startIndex, int portalId)
{
ArrayList filesWorking = FileSystemUtils.GetFilesByFolder(portalId, folderInfo.FolderID);
if (filesWorking != null)
{
foreach (DotNetNuke.Services.FileSystem.FileInfo fileInfo in filesWorking)
{
ParseCSV(fileInfo, startIndex);
}
}
ImportData(this.portalId);
}
开发者ID:EngageSoftware,项目名称:Engage-Locator,代码行数:13,代码来源:DataImportScheduler.cs
示例4: UpdateFolder
public void UpdateFolder(FolderInfo objFolderInfo)
{
FolderManager.Instance.UpdateFolder(objFolderInfo);
}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:4,代码来源:FolderController.cs
示例5: AddAllUserReadPermission
public static void AddAllUserReadPermission(FolderInfo folder, PermissionInfo permission)
{
FolderManager.Instance.AddAllUserReadPermission(folder, permission);
}
开发者ID:biganth,项目名称:Curt,代码行数:4,代码来源:FileSystemUtils.cs
示例6: RenderFolder
/// <summary>
/// Render all Directories and sub directories recursive
/// </summary>
/// <param name="folderInfo">The folder Info.</param>
/// <returns>
/// TreeNode List
/// </returns>
private RadTreeNode RenderFolder(FolderInfo folderInfo)
{
if (!FolderPermissionController.CanViewFolder(folderInfo))
{
return null;
}
RadTreeNode tnFolder = new RadTreeNode
{
Text = folderInfo.FolderName,
Value = folderInfo.PhysicalPath,
ImageUrl = "Images/folder.gif",
ExpandedImageUrl = "Images/folderOpen.gif",
ToolTip = folderInfo.FolderID.ToString()
};
if (folderInfo.StorageLocation.Equals((int)FolderController.StorageLocationTypes.SecureFileSystem))
{
tnFolder.ImageUrl = "Images/folderLocked.gif";
tnFolder.ExpandedImageUrl = "Images/folderOpenLocked.gif";
}
else if (folderInfo.StorageLocation.Equals((int)FolderController.StorageLocationTypes.DatabaseSecure))
{
tnFolder.ImageUrl = "Images/folderdb.gif";
tnFolder.ExpandedImageUrl = "Images/folderdb.gif";
}
/*ArrayList folders = FileSystemUtils.GetFoldersByParentFolder(
this._portalSettings.PortalId, folderInfo.FolderPath);*/
var folders = FolderManager.Instance.GetFolders(folderInfo).ToList();
if (folders.Any())
{
foreach (RadTreeNode node in
folders.Cast<FolderInfo>().Select(this.RenderFolder).Where(node => node != null))
{
switch (this.GetStorageLocationType(Convert.ToInt32(node.ToolTip)))
{
case FolderController.StorageLocationTypes.SecureFileSystem:
{
node.ImageUrl = "Images/folderLocked.gif";
node.ExpandedImageUrl = "Images/folderOpenLocked.gif";
}
break;
case FolderController.StorageLocationTypes.DatabaseSecure:
{
node.ImageUrl = "Images/folderdb.gif";
node.ExpandedImageUrl = "Images/folderdb.gif";
}
break;
}
tnFolder.Nodes.Add(node);
}
}
return tnFolder;
}
开发者ID:huoxudong125,项目名称:dnnckeditor,代码行数:68,代码来源:Browser.aspx.cs
示例7: CanViewFolder
/// <summary>
/// Returns a flag indicating whether the current user can view a folder or file
/// </summary>
/// <param name="folder">The page</param>
/// <returns>A flag indicating whether the user has permission</returns>
public virtual bool CanViewFolder(FolderInfo folder)
{
return HasFolderPermission(folder, ViewFolderPermissionKey);
}
开发者ID:davidsports,项目名称:Dnn.Platform,代码行数:9,代码来源:PermissionProvider.cs
示例8: OverwriteFolder_Adds_Folder_To_FoldersToDelete_If_FolderMapping_Is_Editable
public void OverwriteFolder_Adds_Folder_To_FoldersToDelete_If_FolderMapping_Is_Editable()
{
var fileManager = new Mock<IFileManager>();
FileManager.RegisterInstance(fileManager.Object);
_folderInfo.Setup(fi => fi.PortalID).Returns(Constants.CONTENT_ValidPortalId);
_folderInfo.Setup(fi => fi.FolderPath).Returns(Constants.FOLDER_ValidFolderRelativePath);
_folderInfo.Setup(fi => fi.FolderMappingID).Returns(Constants.FOLDER_ValidFolderMappingID);
var files = new List<IFileInfo>();
_mockFolderManager.Setup(mfm => mfm.GetFiles(_folderInfo.Object, It.IsAny<bool>(), It.IsAny<bool>())).Returns(files);
var destinationFolder = new FolderInfo();
_mockFolderManager.Setup(mfm => mfm.DeleteFolder(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidFolderRelativePath));
var folderMapping = new FolderMappingInfo();
_mockFolderManager.Setup(mfm => mfm.GetFolderMapping(It.IsAny<Dictionary<int, FolderMappingInfo>>(), Constants.FOLDER_ValidFolderMappingID)).Returns(folderMapping);
_mockFolderManager.Setup(mfm => mfm.IsFolderMappingEditable(folderMapping)).Returns(true);
var foldersToDelete = new SortedList<string, IFolderInfo>();
_mockFolderManager.Object.OverwriteFolder(_folderInfo.Object, destinationFolder, new Dictionary<int, FolderMappingInfo>(), foldersToDelete);
Assert.AreEqual(1, foldersToDelete.Count);
}
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:26,代码来源:FolderManagerTests.cs
示例9: OverwriteFolder_Deletes_Source_Folder_In_Database
public void OverwriteFolder_Deletes_Source_Folder_In_Database()
{
var fileManager = new Mock<IFileManager>();
FileManager.RegisterInstance(fileManager.Object);
_folderInfo.Setup(fi => fi.PortalID).Returns(Constants.CONTENT_ValidPortalId);
_folderInfo.Setup(fi => fi.FolderPath).Returns(Constants.FOLDER_ValidFolderRelativePath);
_folderInfo.Setup(fi => fi.FolderMappingID).Returns(Constants.FOLDER_ValidFolderMappingID);
var files = new List<IFileInfo>();
_mockFolderManager.Setup(mfm => mfm.GetFiles(_folderInfo.Object, It.IsAny<bool>(), It.IsAny<bool>())).Returns(files);
var destinationFolder = new FolderInfo();
_mockFolderManager.Setup(mfm => mfm.DeleteFolder(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidFolderRelativePath)).Verifiable();
var folderMapping = new FolderMappingInfo();
_mockFolderManager.Setup(mfm => mfm.GetFolderMapping(It.IsAny<Dictionary<int, FolderMappingInfo>>(), Constants.FOLDER_ValidFolderMappingID)).Returns(folderMapping);
_mockFolderManager.Setup(mfm => mfm.IsFolderMappingEditable(folderMapping)).Returns(false);
_mockFolderManager.Object.OverwriteFolder(_folderInfo.Object, destinationFolder, new Dictionary<int, FolderMappingInfo>(), new SortedList<string, IFolderInfo>());
_mockFolderManager.Verify();
}
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:25,代码来源:FolderManagerTests.cs
示例10: OverwriteFolder_Calls_MoveFile_For_Each_File_In_Source_Folder
public void OverwriteFolder_Calls_MoveFile_For_Each_File_In_Source_Folder()
{
_folderInfo.Setup(fi => fi.PortalID).Returns(Constants.CONTENT_ValidPortalId);
_folderInfo.Setup(fi => fi.FolderPath).Returns(Constants.FOLDER_ValidFolderRelativePath);
_folderInfo.Setup(fi => fi.FolderMappingID).Returns(Constants.FOLDER_ValidFolderMappingID);
var destinationFolder = new FolderInfo();
var file1 = new FileInfo();
var file2 = new FileInfo();
var file3 = new FileInfo();
var files = new List<IFileInfo> { file1, file2, file3 };
_mockFolderManager.Setup(mfm => mfm.GetFiles(_folderInfo.Object, It.IsAny<bool>(), It.IsAny<bool>())).Returns(files);
var fileManager = new Mock<IFileManager>();
FileManager.RegisterInstance(fileManager.Object);
fileManager.Setup(fm => fm.MoveFile(It.IsAny<IFileInfo>(), destinationFolder));
_mockFolderManager.Setup(mfm => mfm.DeleteFolder(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidFolderRelativePath));
var folderMapping = new FolderMappingInfo();
_mockFolderManager.Setup(mfm => mfm.GetFolderMapping(It.IsAny<Dictionary<int, FolderMappingInfo>>(), Constants.FOLDER_ValidFolderMappingID)).Returns(folderMapping);
_mockFolderManager.Setup(mfm => mfm.IsFolderMappingEditable(folderMapping)).Returns(false);
_mockFolderManager.Object.OverwriteFolder(_folderInfo.Object, destinationFolder, new Dictionary<int, FolderMappingInfo>(), new SortedList<string, IFolderInfo>());
fileManager.Verify(fm => fm.MoveFile(It.IsAny<IFileInfo>(), destinationFolder), Times.Exactly(3));
}
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:31,代码来源:FolderManagerTests.cs
示例11: MoveFolder_Throws_When_Move_Operation_Is_Not_Valid
public void MoveFolder_Throws_When_Move_Operation_Is_Not_Valid()
{
_folderInfo.Setup(fi => fi.FolderPath).Returns(Constants.FOLDER_ValidFolderRelativePath);
_folderInfo.Setup(fi => fi.FolderMappingID).Returns(Constants.FOLDER_ValidFolderMappingID);
IFolderInfo destinationFolder = new FolderInfo();
destinationFolder.FolderPath = Constants.FOLDER_OtherValidFolderRelativePath;
destinationFolder.FolderMappingID = Constants.FOLDER_ValidFolderMappingID;
_pathUtils.Setup(pu => pu.FormatFolderPath(Constants.FOLDER_OtherValidFolderRelativePath)).Returns(Constants.FOLDER_OtherValidFolderRelativePath);
_mockFolderManager.Setup(mfm => mfm.FolderExists(It.IsAny<int>(), It.IsAny<string>())).Returns(false);
_mockFolderManager.Setup(mfm => mfm.CanMoveBetweenFolderMappings(It.IsAny<FolderMappingInfo>(), It.IsAny<FolderMappingInfo>())).Returns(true);
_mockFolderManager.Setup(mfm => mfm.IsMoveOperationValid(_folderInfo.Object, destinationFolder, It.IsAny<string>())).Returns(false);
_mockFolderManager.Object.MoveFolder(_folderInfo.Object, destinationFolder);
}
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:17,代码来源:FolderManagerTests.cs
示例12: MoveFolder_Returns_The_Same_Folder_If_The_Paths_Are_The_Same
public void MoveFolder_Returns_The_Same_Folder_If_The_Paths_Are_The_Same()
{
_folderInfo.Setup(fi => fi.FolderPath).Returns(Constants.FOLDER_ValidFolderRelativePath);
IFolderInfo destinationFolder = new FolderInfo();
destinationFolder.FolderPath = Constants.FOLDER_ValidFolderRelativePath;
_pathUtils.Setup(pu => pu.FormatFolderPath(Constants.FOLDER_ValidFolderRelativePath)).Returns(Constants.FOLDER_ValidFolderRelativePath);
var movedFolder = _folderManager.MoveFolder(_folderInfo.Object, destinationFolder);
Assert.AreEqual(_folderInfo.Object, movedFolder);
}
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:13,代码来源:FolderManagerTests.cs
示例13: ParseFiles
/// <summary>
/// Processes all Files from the template
/// </summary>
/// <param name="nodeFiles">Template file node for the Files</param>
/// <param name="PortalId">PortalId of the new portal</param>
/// <history>
/// [cnurse] 11/09/2004 Created
/// </history>
private void ParseFiles( XmlNodeList nodeFiles, int PortalId, FolderInfo objFolder )
{
int FileId = 0;
FileController objController = new FileController();
FileInfo objInfo = null;
string fileName = null;
foreach( XmlNode node in nodeFiles )
{
fileName = XmlUtils.GetNodeValue( node, "filename", "" );
//First check if the file exists
objInfo = objController.GetFile( fileName, PortalId, objFolder.FolderID );
if( objInfo == null )
{
objInfo = new FileInfo();
objInfo.PortalId = PortalId;
objInfo.FileName = fileName;
objInfo.Extension = XmlUtils.GetNodeValue( node, "extension", "" );
objInfo.Size = XmlUtils.GetNodeValueInt( node, "size", 0 );
objInfo.Width = XmlUtils.GetNodeValueInt( node, "width", 0 );
objInfo.Height = XmlUtils.GetNodeValueInt( node, "height", 0 );
objInfo.ContentType = XmlUtils.GetNodeValue( node, "contenttype", "" );
objInfo.FolderId = objFolder.FolderID;
objInfo.Folder = objFolder.FolderPath;
//Save new File
FileId = objController.AddFile( objInfo );
}
else
{
//Get Id from File
FileId = objInfo.FileId;
}
}
}
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:45,代码来源:PortalController.cs
示例14: GetFiles
/// <summary>
/// Get all Files and Put them in a DataTable for the GridView
/// </summary>
/// <param name="currentFolderInfo">The current folder info.</param>
/// <returns>
/// The File Table
/// </returns>
public DataTable GetFiles(FolderInfo currentFolderInfo)
{
DataTable filesTable = new DataTable();
filesTable.Columns.Add(new DataColumn("FileName", typeof(string)));
filesTable.Columns.Add(new DataColumn("PictureURL", typeof(string)));
filesTable.Columns.Add(new DataColumn("Info", typeof(string)));
filesTable.Columns.Add(new DataColumn("FileId", typeof(int)));
HttpRequest httpRequest = HttpContext.Current.Request;
var type = "Link";
if (!string.IsNullOrEmpty(httpRequest.QueryString["Type"]))
{
type = httpRequest.QueryString["Type"];
}
// Get Folder Info Secure?
var isSecure =
this.GetStorageLocationType(currentFolderInfo.FolderID).Equals(
FolderController.StorageLocationTypes.SecureFileSystem);
var isDatabaseSecure =
this.GetStorageLocationType(currentFolderInfo.FolderID).Equals(
FolderController.StorageLocationTypes.DatabaseSecure);
var filesArrayList = FileSystemUtils.GetFilesByFolder(
this._portalSettings.PortalId, currentFolderInfo.FolderID);
var files = filesArrayList.OfType<DotNetNuke.Services.FileSystem.FileInfo>().ToList();
if (this.SortFilesDescending)
{
Utility.SortDescending(files, item => item.FileName);
}
foreach (DotNetNuke.Services.FileSystem.FileInfo fileItem in files)
{
// Check if File Exists
/*if (!File.Exists(string.Format("{0}{1}", fileItem.PhysicalPath, isSecure ? ".resources" : string.Empty)))
{
continue;
}*/
var item = fileItem;
var name = fileItem.FileName;
var extension = fileItem.Extension;
if (isSecure)
{
name = GetFileNameCleaned(name);
extension = Path.GetExtension(name);
}
switch (type)
{
case "Image":
{
// Show Images only
foreach (DataRow dr in
from sAllowExt in this.allowedImageExt
where name.ToLower().EndsWith(sAllowExt)
select filesTable.NewRow())
{
if (isSecure || isDatabaseSecure)
{
var link = string.Format("fileID={0}", fileItem.FileId);
dr["PictureURL"] = Globals.LinkClick(link, int.Parse(this.request.QueryString["tabid"]), Null.NullInteger);
}
else
{
dr["PictureURL"] = MapUrl(fileItem.PhysicalPath);
}
dr["FileName"] = name;
dr["FileId"] = item.FileId;
dr["Info"] =
string.Format(
"<span class=\"FileName\">{0}</span><br /><span class=\"FileInfo\">Size: {1}</span>",
name,
fileItem.Size);
filesTable.Rows.Add(dr);
}
}
break;
case "Flash":
{
//.........这里部分代码省略.........
开发者ID:huoxudong125,项目名称:dnnckeditor,代码行数:101,代码来源:Browser.aspx.cs
示例15: CanDeleteFolder
/// <summary>
/// Returns a flag indicating whether the current user can delete a folder or file
/// </summary>
/// <param name="folder">The page</param>
/// <returns>A flag indicating whether the user has permission</returns>
public virtual bool CanDeleteFolder(FolderInfo folder)
{
return HasFolderPermission(folder, DeleteFolderPermissionKey);
}
开发者ID:davidsports,项目名称:Dnn.Platform,代码行数:9,代码来源:PermissionProvider.cs
示例16: CanManageFolder
/// <summary>
/// Returns a flag indicating whether the current user can manage a folder's settings
/// </summary>
/// <param name="folder">The page</param>
/// <returns>A flag indicating whether the user has permission</returns>
public virtual bool CanManageFolder(FolderInfo folder)
{
return HasFolderPermission(folder, ManageFolderPermissionKey);
}
开发者ID:davidsports,项目名称:Dnn.Platform,代码行数:9,代码来源:PermissionProvider.cs
示例17: GetFolder_Returns_Valid_Folder_When_Folder_Exists_Overload
public void GetFolder_Returns_Valid_Folder_When_Folder_Exists_Overload()
{
_pathUtils.Setup(pu => pu.FormatFolderPath(Constants.FOLDER_ValidFolderRelativePath)).Returns(Constants.FOLDER_ValidFolderRelativePath);
_pathUtils.Setup(pu => pu.RemoveTrailingSlash(Constants.FOLDER_ValidFolderRelativePath)).Returns(Constants.FOLDER_ValidFolderName);
var folderDataTable = new DataTable();
folderDataTable.Columns.Add("FolderName");
folderDataTable.Rows.Add(Constants.FOLDER_ValidFolderName);
var dr = folderDataTable.CreateDataReader();
_mockData.Setup(md => md.GetFolder(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidFolderRelativePath)).Returns(dr);
var folderInfo = new FolderInfo { FolderPath = Constants.FOLDER_ValidFolderRelativePath };
_cbo.Setup(cbo => cbo.FillObject<FolderInfo>(dr)).Returns(folderInfo);
_mockFolderManager.Setup(mfm => mfm.GetFolders(Constants.CONTENT_ValidPortalId)).Returns(new List<IFolderInfo>());
var result = _mockFolderManager.Object.GetFolder(Constants.CONTENT_ValidPortalId, Constants.FOLDER_ValidFolderRelativePath);
Assert.AreEqual(Constants.FOLDER_ValidFolderName, result.FolderName);
}
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:23,代码来源:FolderManagerTests.cs
示例18: SaveFolderPermissions
/// <summary>
/// SaveFolderPermissions updates a Folder's permissions
/// </summary>
/// <param name="folder">The Folder to update</param>
public virtual void SaveFolderPermissions(FolderInfo folder)
{
SaveFolderPermissions((IFolderInfo)folder);
}
开发者ID:davidsports,项目名称:Dnn.Platform,代码行数:8,代码来源:PermissionProvider.cs
示例19: AddFolderAndMoveFiles
private static void AddFolderAndMoveFiles(string folderPath, string newFolderPath, FolderMappingInfo folderMapping)
{
var folderProvider = Instance(folderMapping.FolderProviderType);
if (!folderProvider.FolderExists(newFolderPath, folderMapping))
{
folderProvider.AddFolder(newFolderPath, folderMapping);
}
var folder = new FolderInfo { FolderPath = folderPath, FolderMappingID = folderMapping.FolderMappingID, PortalID = folderMapping.PortalID };
var newFolder = new FolderInfo { FolderPath = newFolderPath, FolderMappingID = folderMapping.FolderMappingID, PortalID = folderMapping.PortalID };
MoveFiles(folder, newFolder, folderMapping);
}
开发者ID:rrsc,项目名称:Dnn.Platform,代码行数:14,代码来源:FolderProvider.cs
示例20: RemoveOrphanedFiles
private static void RemoveOrphanedFiles(FolderInfo folder, int PortalId)
{
if (folder.FolderMappingID != FolderMappingController.Instance.GetFolderMapping(PortalId, "Database").FolderMappingID)
{
foreach (FileInfo objFile in FolderManager.Instance.GetFiles(folder))
{
RemoveOrphanedFile(objFile, PortalId);
}
}
}
开发者ID:biganth,项目名称:Curt,代码行数:10,代码来源:FileSystemUtils.cs
注:本文中的DotNetNuke.Services.FileSystem.FolderInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论