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


C# DirectoryInfo.Remove方法代码示例

本文整理汇总了C#中System.IO.DirectoryInfo.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# DirectoryInfo.Remove方法的具体用法?C# DirectoryInfo.Remove怎么用?C# DirectoryInfo.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.DirectoryInfo的用法示例。


在下文中一共展示了DirectoryInfo.Remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddFolder

 /// <summary>
 /// Adds a folder to the zip file
 /// </summary>
 /// <param name="Folder">Folder to add</param>
 public virtual void AddFolder(string Folder)
 {
     Folder.ThrowIfNullOrEmpty("Folder");
     Folder = new DirectoryInfo(Folder).FullName;
     if (Folder.EndsWith(@"\"))
         Folder = Folder.Remove(Folder.Length - 1);
     using (Package Package = ZipPackage.Open(ZipFileStream, FileMode.OpenOrCreate))
     {
         new DirectoryInfo(Folder)
             .GetFiles()
             .ForEach(x => AddFile(x.FullName.Replace(Folder, ""), x, Package));
     }
 }
开发者ID:summer-breeze,项目名称:ChengGouHui,代码行数:17,代码来源:ZipFile.cs

示例2: InitLogger

        public static void InitLogger()
        {
            if (!Directory.Exists(LogFolder))
                Directory.CreateDirectory(LogFolder);

            var logs = new DirectoryInfo(LogFolder).GetFiles().OrderBy(s => s.LastWriteTime).ToList();
            while (logs.Count() >= ServerMain.settings.maximumLogs)
            {
                var first = logs.First();
                first.Delete();
                logs.Remove(first);
            }
        }
开发者ID:Josvth,项目名称:KerbalMultiPlayer,代码行数:13,代码来源:Logger.cs

示例3: AddFolder

 public virtual void AddFolder(string Folder)
 {
     Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(Folder), "Folder");
     Folder = new DirectoryInfo(Folder).FullName;
     if (Folder.EndsWith(@"\", StringComparison.InvariantCulture))
         Folder = Folder.Remove(Folder.Length - 1);
     using (Package Package = ZipPackage.Open(ZipFileStream, FileMode.OpenOrCreate))
     {
         new DirectoryInfo(Folder)
             .GetFiles()
             .ForEach(x => AddFile(x.FullName.Replace(Folder, ""), x, Package));
     }
 }
开发者ID:kaytie,项目名称:Craig-s-Utility-Library,代码行数:13,代码来源:ZipFile.cs

示例4: DeleteGallery

        /// <summary>
        /// Deletes gallery
        /// </summary>
        /// <param name="id">Gallery identifier</param>
        public static bool DeleteGallery(int id)
        {
            lock (GetGallerySyncRoot(id))
            {
                OperationResult<OperationResults, Nullable<bool>> rslt = null;

                try
                {
                    rslt = GalleryRepository.DeleteGallery(id);
                }
                catch (Exception ex)
                {
                    Logger.WriteError(ex);
                    throw;
                }

                switch (rslt.Result)
                {
                    case OperationResults.Success:
                    case OperationResults.NotFound:
                        {
                            var dir = new DirectoryInfo(GetGalleryDevPath(id));

                            if (dir.Exists)
                            {
                                try
                                {
                                    dir.Remove();
                                }
                                catch (Exception ex)
                                {
                                    Logger.WriteError(ex);
                                }
                            }

                            RemoveGallerySyncRoot(id);

                            return true;
                        }
                    case OperationResults.Failure:
                        return false;
                    default:
                        throw new NotImplementedException();
                }
            }
        }
开发者ID:spbuksh,项目名称:CuratedGalleries,代码行数:50,代码来源:GalleryRuntime.Gallery.cs


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