当前位置: 首页>>代码示例>>C#>>正文


C# IFolderInfo类代码示例

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


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


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