Repository: lucenenet Updated Branches: refs/heads/master 64a467ac3 -> 8866a3afd
Lucene.Net.Support.IO.FileSupport: Removed unused GetFiles(), GetLuceneIndexFiles(), and Sync() methods Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/4467e6ed Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/4467e6ed Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/4467e6ed Branch: refs/heads/master Commit: 4467e6ed7b04916dab9c937769a7f78d8dda9d70 Parents: 64a467a Author: Shad Storhaug <[email protected]> Authored: Sat Sep 23 19:27:54 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Sat Sep 23 19:27:54 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net/Support/IO/FileSupport.cs | 98 --------------------------- 1 file changed, 98 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4467e6ed/src/Lucene.Net/Support/IO/FileSupport.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Support/IO/FileSupport.cs b/src/Lucene.Net/Support/IO/FileSupport.cs index 5cfe641..bac1e5a 100644 --- a/src/Lucene.Net/Support/IO/FileSupport.cs +++ b/src/Lucene.Net/Support/IO/FileSupport.cs @@ -19,11 +19,9 @@ * */ -using Lucene.Net.Util; using System; using System.IO; using System.Linq; -using System.Runtime.CompilerServices; using System.Text; namespace Lucene.Net.Support.IO @@ -36,102 +34,6 @@ namespace Lucene.Net.Support.IO private static readonly object _lock = new object(); /// <summary> - /// Returns an array of abstract pathnames representing the files and directories of the specified path. - /// </summary> - /// <param name="path">The abstract pathname to list it childs.</param> - /// <returns>An array of abstract pathnames childs of the path specified or null if the path is not a directory</returns> - public static System.IO.FileInfo[] GetFiles(System.IO.FileInfo path) - { - if ((path.Attributes & FileAttributes.Directory) > 0) - { - String[] fullpathnames = Directory.GetFileSystemEntries(path.FullName); - System.IO.FileInfo[] result = new System.IO.FileInfo[fullpathnames.Length]; - for (int i = 0; i < result.Length; i++) - result[i] = new System.IO.FileInfo(fullpathnames[i]); - return result; - } - else - return null; - } - - // TODO: This filesupport thing is silly. Same goes with _TestUtil's RMDir. - // If we're removing a directory - public static System.IO.FileInfo[] GetFiles(System.IO.DirectoryInfo path) - { - return GetFiles(new FileInfo(path.FullName)); - } - - ///// <summary> - ///// Returns a list of files in a give directory. - ///// </summary> - ///// <param name="fullName">The full path name to the directory.</param> - ///// <param name="indexFileNameFilter"></param> - ///// <returns>An array containing the files.</returns> - //public static System.String[] GetLuceneIndexFiles(System.String fullName, - // Index.IndexFileNameFilter indexFileNameFilter) - //{ - // System.IO.DirectoryInfo dInfo = new System.IO.DirectoryInfo(fullName); - // System.Collections.ArrayList list = new System.Collections.ArrayList(); - // foreach (System.IO.FileInfo fInfo in dInfo.GetFiles()) - // { - // if (indexFileNameFilter.Accept(fInfo, fInfo.Name) == true) - // { - // list.Add(fInfo.Name); - // } - // } - // System.String[] retFiles = new System.String[list.Count]; - // list.CopyTo(retFiles); - // return retFiles; - //} - - // Disable the obsolete warning since we must use FileStream.Handle - // because Mono does not support FileSystem.SafeFileHandle at present. -#pragma warning disable 618 - - /// <summary> - /// Flushes the specified file stream. Ensures that all buffered - /// data is actually written to the file system. - /// </summary> - /// <param name="fileStream">The file stream.</param> - public static void Sync(System.IO.FileStream fileStream) - { - if (fileStream == null) - throw new ArgumentNullException("fileStream"); - - fileStream.Flush(true); - - if (Constants.WINDOWS) - { -#if NETSTANDARD - // Getting the SafeFileHandle property automatically flushes the - // stream: https://msdn.microsoft.com/en-us/library/system.io.filestream.safefilehandle(v=vs.110).aspx - var handle = fileStream.SafeFileHandle; -#else - if (!FlushFileBuffers(fileStream.Handle)) - throw new IOException(); -#endif - } - //else if (Constants.LINUX) - //{ - // if (fsync(fileStream.Handle) != IntPtr.Zero) - // throw new System.IO.IOException(); - //} - //else - //{ - // throw new NotImplementedException(); - //} - } - -#pragma warning restore 618 - - //[System.Runtime.InteropServices.DllImport("libc")] - //extern static IntPtr fsync(IntPtr fd); - - [System.Runtime.InteropServices.DllImport("kernel32.dll")] - extern static bool FlushFileBuffers(IntPtr hFile); - - - /// <summary> /// Creates a new empty file in the specified directory, using the given prefix and suffix strings to generate its name. /// If this method returns successfully then it is guaranteed that: /// <list type="number">
