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


C# GLib.Delete方法代码示例

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


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

示例1: Delete

        private void Delete(string directory, GLib.IFile dir, bool recursive)
        {
            if (!dir.Exists) {
                return;
            }

            if (dir.QueryFileType (FileQueryInfoFlags.NofollowSymlinks, null) != FileType.Directory) {
                return;
            }

            // If native, use the System.IO recursive delete
            if (dir.IsNative && !DisableNativeOptimizations) {
                System.IO.Directory.Delete (directory, recursive);
                return;
            }

            if (recursive) {
                foreach (string child in GetFiles (dir, false)) {
                    FileFactory.NewForUri (child).Delete ();
                }

                foreach (string child in GetDirectories (dir, false)) {
                    Delete (child, GetDir (child, true), true);
                }
            }

            dir.Delete ();
        }
开发者ID:kelsieflynn,项目名称:banshee,代码行数:28,代码来源:Directory.cs

示例2: DeleteEmptyDirectory

        private void DeleteEmptyDirectory(GLib.File directory)
        {
            // if the directory we're dealing with is not in the
            // F-Spot photos directory, don't delete anything,
            // even if it is empty
            string photo_uri = SafeUri.UriToFilename (Global.PhotoUri.ToString ());
            bool path_matched = directory.Path.IndexOf (photo_uri) > -1;

            if (directory.Path.Equals (photo_uri) || !path_matched)
                return;

            if (DirectoryIsEmpty (directory)) {
                try {
                    Log.DebugFormat ("Removing empty directory: {0}", directory.Path);
                    directory.Delete ();
                } catch (GLib.GException e) {
                    // silently log the exception, but don't re-throw it
                    // as to not annoy the user
                    Log.Exception (e);
                }
                // check to see if the parent is empty
                DeleteEmptyDirectory (directory.Parent);
            }
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:24,代码来源:Photo.cs

示例3: Delete

        private void Delete (string directory, GLib.File dir, bool recursive)
        {
            if (!dir.Exists) {
                Console.WriteLine ("{0} doesn't exist", directory);
                return;
            }

            if ((dir.QueryFileType (FileQueryInfoFlags.None, null) & FileType.Directory) == 0) {
                Console.WriteLine ("{0} isn't directory", directory);
                return;
            }

            // If native, use the System.IO recursive delete
            if (dir.IsNative && !DisableNativeOptimizations) {
                System.IO.Directory.Delete (directory, recursive);
                return;
            }

            if (recursive) {
                foreach (string child in GetFiles (dir, false)) {
                    FileFactory.NewForUri (child).Delete ();
                }

                foreach (string child in GetDirectories (dir, false)) {
                    Delete (child, GetDir (child, true), true);
                }
            }

            dir.Delete ();
        }
开发者ID:allquixotic,项目名称:banshee-gst-sharp-work,代码行数:30,代码来源:Directory.cs


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