• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IFolderInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IFolderInfo的典型用法代码示例。如果您正苦于以下问题:C# IFolderInfo类的具体用法?C# IFolderInfo怎么用?C# IFolderInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IFolderInfo类属于命名空间,在下文中一共展示了IFolderInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RenameFiles

 private void RenameFiles(IFolderInfo folder, string newFolderPath)
 {
     var files = FolderManager.Instance.GetFiles(folder);
     foreach (var file in files)
     {
         file.Folder = newFolderPath;
         FileManager.Instance.UpdateFile(file);
     }
 }
开发者ID:jsheely,项目名称:DotNetNuke-FileWatcher,代码行数:9,代码来源:CustomFolderManager.cs


示例2: Folder

        /// <summary>
        /// Get the folder specified in App.Settings (BasePath) combined with the module's ID
        /// Will create the folder if it does not exist
        /// </summary>
        private IFolderInfo Folder(Guid entityGuid, string fieldName)
        {
            if (_folder == null)
            {
                var folderManager = FolderManager.Instance;

                var basePath = AdamAppRootFolder.Replace("[AppFolder]", App.Folder);

                var path = AdamFolderMask
                    .Replace("[AppFolder]", App.Folder)
                    .Replace("[Guid22]", GuidHelpers.Compress22(entityGuid))
                    .Replace("[FieldName]", fieldName);

                // create all folders to ensure they exist. Must do one-by-one because dnn must have it in the catalog
                var pathParts = path.Split('/');
                var pathToCheck = ""; // pathParts[0];
                for (var i = 0; i < pathParts.Length; i++) {
                    pathToCheck += pathParts[i] + "/";
                    if (!folderManager.FolderExists(Dnn.Portal.PortalId, pathToCheck))
                        folderManager.AddFolder(Dnn.Portal.PortalId, pathToCheck);
                }

                _folder = folderManager.GetFolder(Dnn.Portal.PortalId, path);
            }

            return _folder;
        }
开发者ID:BravoSierra,项目名称:2sxc,代码行数:31,代码来源:AdamController.cs


示例3: CreateFile

        private static string CreateFile(IFolderInfo folder, string fileName, string contentType, Stream fileContent, bool unzip, bool overwrite, bool checkPermissions)
        {
            var strMessage = "";
            var fileManager = FileManager.Instance;

            try
            {
                var file = fileManager.AddFile(folder, fileName, fileContent, overwrite, checkPermissions, contentType);
                if (unzip && file.Extension == "zip")
                {
                    fileManager.UnzipFile(file, folder);
                }
            }
            catch (PermissionsNotMetException)
            {
                strMessage += "<br />" + string.Format(Localization.GetString("InsufficientFolderPermission"), folder.FolderPath);
            }
            catch (NoSpaceAvailableException)
            {
                strMessage += "<br />" + string.Format(Localization.GetString("DiskSpaceExceeded"), fileName);
            }
            catch (InvalidFileExtensionException)
            {
                strMessage += "<br />" + string.Format(Localization.GetString("RestrictedFileType"), fileName, Host.AllowedExtensionWhitelist.ToDisplayString());
            }
            catch (Exception ex)
            {
                DnnLog.Error(ex);

                strMessage += "<br />" + string.Format(Localization.GetString("SaveFileError"), fileName);
            }

            return strMessage;
        }
开发者ID:biganth,项目名称:Curt,代码行数:34,代码来源:FileSystemUtils.cs


示例4: GetFiles

        public override string[] GetFiles(IFolderInfo folder)
        {
            Requires.NotNull("folder", folder);

            var fileNames = DirectoryWrapper.Instance.GetFiles(folder.PhysicalPath);

            for (var i = 0; i < fileNames.Length; i++)
            {
                var fileName = Path.GetFileName(fileNames[i]);
                if (!fileName.EndsWith(ProtectedExtension, StringComparison.InvariantCultureIgnoreCase))
				{
                    var destFileName = fileNames[i] + ProtectedExtension;
                    if (FileWrapper.Instance.Exists(destFileName))
                        FileWrapper.Instance.Delete(destFileName);
					FileWrapper.Instance.Move(fileNames[i], destFileName);
				}
				else
				{
                    fileName = fileName.Substring(0, fileName.LastIndexOf(ProtectedExtension, StringComparison.InvariantCultureIgnoreCase));
				}

                fileNames[i] = fileName;
            }

            return fileNames;
        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:26,代码来源:SecureFolderProvider.cs


示例5: AddFile

        public override void AddFile(IFolderInfo folder, string fileName, Stream content)
        {
            Requires.NotNull("folder", folder);
            Requires.NotNullOrEmpty("fileName", fileName);
            Requires.NotNull("content", content);

            UpdateFile(folder, fileName, content);
        }
开发者ID:rrsc,项目名称:Dnn.Platform,代码行数:8,代码来源:StandardFolderProvider.cs


示例6: AddFolder

        private void AddFolder(IFolderInfo fldr)
        {
            _folderIds.Add(fldr.FolderID);  // track of the folder
            AddFilesInFolder(fldr);         // keep track of the files

            foreach (var f in _fldm.GetFolders(fldr))   // then add subfolders
                AddFolder(f);
        }
开发者ID:2sic,项目名称:2sxc,代码行数:8,代码来源:Export.cs


示例7: MoveFolders

 private void MoveFolders(IFolderInfo folder, string newFolderPath)
 {
     var folderInfos = FolderManager.Instance.GetFolders(folder.PortalID).Where(f => f.FolderPath != string.Empty && f.FolderPath.StartsWith(folder.FolderPath)).ToList();
     foreach (var folderInfo in folderInfos)
     {
         var folderPath = newFolderPath + folderInfo.FolderPath.Substring(folder.FolderPath.Length);
         MoveFolder(folderPath, folderInfo);
     }
 }
开发者ID:jsheely,项目名称:DotNetNuke-FileWatcher,代码行数:9,代码来源:CustomFolderManager.cs


示例8: GetFolderHierarchy

 public static IEnumerable<IFolderInfo> GetFolderHierarchy(IFolderInfo folderInfo)
 {
     List<IFolderInfo> res = new List<IFolderInfo>();
     while (folderInfo != null && folderInfo.Id != ""){
         res.Add(folderInfo);
         folderInfo = (folderInfo as FolderInfo).GetParent(instance.baseDir);
     }
     res.Reverse();
     return res;
 }
开发者ID:BackupTheBerlios,项目名称:molecule-svn,代码行数:10,代码来源:Service.cs


示例9: AdamItem

 public AdamItem(IFolderInfo original)
 {
     IsFolder = true;
     Id = original.FolderID;
     ParentId = original.ParentID;
     Path = original.DisplayPath;
     Name = original.DisplayName;
     Size = 0;
     Type = "folder";
 }
开发者ID:2sic,项目名称:2sxc,代码行数:10,代码来源:AdamItem.cs


示例10: MoveFolder

        public IFolderInfo MoveFolder(IFolderInfo folder, string newFolderPath)
        {
            Requires.NotNull("folder", folder);
            Requires.NotNullOrEmpty("newFolderPath", newFolderPath);

            newFolderPath = PathUtils.Instance.FormatFolderPath(newFolderPath);

            if (folder.FolderPath == newFolderPath) return folder;

            MoveFolders(folder, newFolderPath);

            return FolderManager.Instance.GetFolder(folder.FolderID);
        }
开发者ID:jsheely,项目名称:DotNetNuke-FileWatcher,代码行数:13,代码来源:CustomFolderManager.cs


示例11: checkFolderPermissions

 public static void checkFolderPermissions(int PortalId, IFolderInfo theFolder, int theUserId, List<UserInfo> approvers)
 {
     // Get the write permission
     PermissionController pc = new PermissionController();
     PermissionInfo w = (PermissionInfo)pc.GetPermissionByCodeAndKey("SYSTEM_FOLDER", "WRITE")[0];
     // Get a list of all the folderPermissions we currently have
     FolderPermissionCollection folderPermissions = theFolder.FolderPermissions;
     // Set up the first permission
     FolderPermissionInfo permission = new FolderPermissionInfo();
     // Set up some default values for the permission
     initFolderPermission(permission, theFolder.FolderID, PortalId, w.PermissionID);
     // Set the user id to be this user
     permission.UserID = theUserId;
     // Add folder permissions, with a check for duplicates.
     // This duplicate check (the 'True' parameter) will classify this as a "duplicate" if this permission
     // has the same PermissionID, UserID, and RoleID as a pre-existing one, and not add it if it is a duplicate
     folderPermissions.Add(permission, true);
     // Get all the possible approvers for this reimbursement
     try
     {
         foreach (var approver in approvers)
         {
             // Create a new permission for this approver
             permission = new FolderPermissionInfo();
             // Initialize all the variables
             initFolderPermission(permission, theFolder.FolderID, PortalId, w.PermissionID);
             // Set the userid to the approver's id
             permission.UserID = approver.UserID;
             // Add permission for approver
             folderPermissions.Add(permission, true);
         }
     }
     catch { }
     // Finally, add permissions for the accounts team:
     try
     {
         permission = new FolderPermissionInfo();
         // Initialize new folder permission
         initFolderPermission(permission, theFolder.FolderID, PortalId, w.PermissionID);
         // Set the role ID
         DotNetNuke.Security.Roles.RoleController rc = new DotNetNuke.Security.Roles.RoleController();
         permission.RoleID = rc.GetRoleByName(PortalId, "Accounts Team").RoleID;
         folderPermissions.Add(permission, true);
     }
     catch { }
     // Once we're finished adding these folder permissions, save it all
     FolderPermissionController.SaveFolderPermissions(theFolder);
 }
开发者ID:powertochange-org,项目名称:acReimbursements,代码行数:48,代码来源:Filesystem.cs


示例12: GetChildren

        // ReSharper disable LoopCanBeConvertedToQuery
        private List<Item> GetChildren(IFolderInfo folder, ICollection<string> extensions)
        {
            var everything = new List<Item>();

            var folders = _folderManager.GetFolders(folder);

            foreach (var currentFolder in folders)
            {
                everything.Add(new Item
                {
                    id = currentFolder.FolderID,
                    name = currentFolder.DisplayName ?? currentFolder.FolderName,
                    folder = true,
                    parentId = folder.FolderID,
                    children = GetChildren(currentFolder, extensions)
                });
            }

            var files = _folderManager.GetFiles(folder);

            foreach (var file in files)
            {
                // list is empty or contains the file extension in question
                if (extensions.Count == 0 || extensions.Contains(file.Extension.ToLowerInvariant()))
                {
                    everything.Add(new Item
                    {
                        id = file.FileId,
                        name = file.FileName,
                        folder = false,
                        parentId = file.FolderId,
                        thumb_url = GetThumbUrl(file),
                        type = GetTypeName(file),
                        size = GetFileSize(file.Size),
                        modified = GetModifiedTime(file.LastModificationTime)
                    });
                }
            }

            return everything;
        }
开发者ID:biganth,项目名称:Curt,代码行数:42,代码来源:UserFileController.cs


示例13: GetFiles

        public override string[] GetFiles(IFolderInfo folder)
        {
            Requires.NotNull("folder", folder);

            var fileNames = DirectoryWrapper.Instance.GetFiles(folder.PhysicalPath);

            for (var i = 0; i < fileNames.Length; i++)
            {
                var fileName = Path.GetFileName(fileNames[i]);
				if(!fileName.EndsWith(ProtectedExtension))
				{
					FileWrapper.Instance.Move(fileNames[i], fileNames[i] + ProtectedExtension);
				}
				else
				{
					fileName = fileName.Substring(0, fileName.LastIndexOf(ProtectedExtension));
				}

                fileNames[i] = fileName;
            }

            return fileNames;
        }
开发者ID:rrsc,项目名称:Dnn.Platform,代码行数:23,代码来源:SecureFolderProvider.cs


示例14: GetFolderViewModel

        protected virtual FolderViewModel GetFolderViewModel(IFolderInfo folder)
        {
            var folderName = string.IsNullOrEmpty(folder.FolderName)
                ? LocalizationHelper.GetString("RootFolder.Text")
                : folder.FolderName;

            var folderViewModel = new FolderViewModel
            {
                FolderID = folder.FolderID,
                FolderMappingID = folder.FolderMappingID,
                FolderName = folderName,
                FolderPath = folder.FolderPath,
                PortalID = folder.PortalID,
                LastModifiedOnDate = folder.LastModifiedOnDate.ToString("g"),
                IconUrl = GetFolderIconUrl(folder.PortalID, folder.FolderMappingID),
                Permissions = GetPermissionViewModelCollection(folder),
                HasChildren = folder.HasChildren
            };
            folderViewModel.Attributes.Add(new KeyValuePair<string, object>("UnlinkAllowedStatus", GetUnlinkAllowedStatus(folder)));
            return folderViewModel;
        }
开发者ID:rjallepalli,项目名称:PIX_CMS,代码行数:21,代码来源:DigitalAssetsController.cs


示例15: ShowFilesIn

        /// <summary>
        /// Shows the files in directory.
        /// </summary>
        /// <param name="currentFolderInfo">The current folder information.</param>
        /// <param name="pagerChanged">if set to <c>true</c> [pager changed].</param>
        private void ShowFilesIn(IFolderInfo currentFolderInfo, bool pagerChanged = false)
        {
            this.CheckFolderAccess(currentFolderInfo.FolderID, false);

            if (!pagerChanged)
            {
                this.FilesTable = this.GetFiles(currentFolderInfo);

                this.GetDiskSpaceUsed();
            }
            else
            {
                if (this.FilesTable == null)
                {
                    this.FilesTable = this.GetFiles(currentFolderInfo);
                }
            }

            var filesPagedDataSource = new PagedDataSource { DataSource = this.FilesTable.DefaultView };

            if (this.currentSettings.FileListPageSize > 0)
            {
                filesPagedDataSource.AllowPaging = true;
                filesPagedDataSource.PageSize = this.currentSettings.FileListPageSize;
                filesPagedDataSource.CurrentPageIndex = pagerChanged ? this.PagerFileLinks.CurrentPageIndex : 0;
            }

            this.PagerFileLinks.PageCount = filesPagedDataSource.PageCount;
            this.PagerFileLinks.RessourceFile = this.ResXFile;
            this.PagerFileLinks.LanguageCode = this.LanguageCode;

            this.PagerFileLinks.Visible = filesPagedDataSource.PageCount > 1;

            // this.FilesList.DataSource = this.GetFiles(directory);
            this.FilesList.DataSource = filesPagedDataSource;
            this.FilesList.DataBind();
        }
开发者ID:huoxudong125,项目名称:dnnckeditor,代码行数:42,代码来源:Browser.aspx.cs


示例16: SetUserFolderPermission

        /// <summary>
        /// Set Folder Permission for the Current User
        /// </summary>
        /// <param name="folderInfo">The folder info.</param>
        /// <param name="currentUserInfo">The current user info.</param>
        private void SetUserFolderPermission(IFolderInfo folderInfo, UserInfo currentUserInfo)
        {
            if (FolderPermissionController.CanManageFolder((FolderInfo)folderInfo))
            {
                return;
            }

            foreach (
                var folderPermission in from PermissionInfo permission in PermissionController.GetPermissionsByFolder()
                                        where
                                            permission.PermissionKey.ToUpper() == "READ"
                                            || permission.PermissionKey.ToUpper() == "WRITE"
                                            || permission.PermissionKey.ToUpper() == "BROWSE"
                                        select
                                            new FolderPermissionInfo(permission)
                                                {
                                                    FolderID = folderInfo.FolderID,
                                                    UserID = currentUserInfo.UserID,
                                                    RoleID = Null.NullInteger,
                                                    AllowAccess = true
                                                })
            {
                folderInfo.FolderPermissions.Add(folderPermission);
            }

            FolderPermissionController.SaveFolderPermissions((FolderInfo)folderInfo);
        }
开发者ID:huoxudong125,项目名称:dnnckeditor,代码行数:32,代码来源:Browser.aspx.cs


示例17: SetFolderPermission

 /// <summary>
 /// Set Folder Permission
 /// </summary>
 /// <param name="folderInfo">The folder info.</param>
 private void SetFolderPermission(IFolderInfo folderInfo)
 {
     FolderManager.Instance.CopyParentFolderPermissions(folderInfo);
 }
开发者ID:huoxudong125,项目名称:dnnckeditor,代码行数:8,代码来源:Browser.aspx.cs


示例18: 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(IFolderInfo currentFolderInfo)
        {
            var 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 files = (List<IFileInfo>)FolderManager.Instance.GetFiles(currentFolderInfo);

            if (this.SortFilesDescending)
            {
                Utility.SortDescending(files, item => item.FileName);
            }

            foreach (var 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":
                        {
                            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><br /><span class=\"FileInfo\">Created: {2}</span>",
                                        name,
                                        fileItem.Size,
                                        fileItem.LastModificationTime);

                                filesTable.Rows.Add(dr);
                            }
                        }

                        break;
                    case "Flash":
                        {
                            foreach (DataRow dr in
                                from sAllowExt in this.allowedFlashExt
                                where name.ToLower().EndsWith(sAllowExt)
//.........这里部分代码省略.........
开发者ID:huoxudong125,项目名称:dnnckeditor,代码行数:101,代码来源:Browser.aspx.cs


示例19: FillFolderTree

        /// <summary>
        /// Fill the Folder TreeView with all (Sub)Directories
        /// </summary>
        /// <param name="currentFolderInfo">The current folder information.</param>
        private void FillFolderTree(IFolderInfo currentFolderInfo)
        {
            this.FoldersTree.Nodes.Clear();

            DirectoryInfo dirInfo = new DirectoryInfo(currentFolderInfo.PhysicalPath);

            RadTreeNode folderNode = new RadTreeNode
            {
                Text = dirInfo.Name,
                Value = dirInfo.FullName,
                ImageUrl = "Images/folder.gif",
                ExpandedImageUrl = "Images/folderOpen.gif"
            };

            switch (this.GetStorageLocationType(currentFolderInfo.PhysicalPath))
            {
                case FolderController.StorageLocationTypes.SecureFileSystem:
                    {
                        folderNode.ImageUrl = "Images/folderLocked.gif";
                        folderNode.ExpandedImageUrl = "Images/folderOpenLocked.gif";
                    }

                    break;
                case FolderController.StorageLocationTypes.DatabaseSecure:
                    {
                        folderNode.ImageUrl = "Images/folderdb.gif";
                        folderNode.ExpandedImageUrl = "Images/folderdb.gif";
                    }

                    break;
            }

            this.FoldersTree.Nodes.Add(folderNode);

            var folders = FolderManager.Instance.GetFolders(currentFolderInfo);

            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;
                }

                folderNode.Nodes.Add(node);
            }
        }
开发者ID:huoxudong125,项目名称:dnnckeditor,代码行数:64,代码来源:Browser.aspx.cs


示例20: GetPermissionViewModelCollection

        private IEnumerable<PermissionViewModel> GetPermissionViewModelCollection(IFolderInfo folder)
        {
            // TODO Split permission between CE and PE packages
            string[] permissionKeys = { "ADD", "BROWSE", "COPY", "READ", "WRITE", "DELETE", "MANAGE", "VIEW", "FULLCONTROL" };

            return permissionKeys.Select(permissionKey => new PermissionViewModel { Key = permissionKey, Value = HasPermission(folder, permissionKey) }).ToList();
        }
开发者ID:rjallepalli,项目名称:PIX_CMS,代码行数:7,代码来源:DigitalAssetsController.cs



注:本文中的IFolderInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IFont类代码示例发布时间:2022-05-24
下一篇:
C# IFolder类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap