Exemple #1
0
        internal static IFileInfo[] ConvertFileInfoArrayIntoIFileInfoWrapArray(FileInfo[] fileInfos)
        {
            var fileInfoWraps = new FileInfoWrap[fileInfos.Length];

            for (int i = 0; i < fileInfos.Length; i++)
            {
                fileInfoWraps[i] = new FileInfoWrap(fileInfos[i]);
            }
            return(fileInfoWraps);
        }
 /// <summary>
 /// Gets the directory full path of a given file path.
 /// </summary>
 /// <param name="filePath">input file path.</param>
 /// <returns>string representation of the directory full path.</returns>
 public string GetDirectoryFullPath(string filePath)
 {
     var fileInfo = new FileInfoWrap(filePath);
     return fileInfo.DirectoryName;
 }
Exemple #3
0
 /// <inheritdoc />
 public IFileInfo[] GetFiles(string searchPattern, SearchOption searchOption)
 {
     FileInfo[] fileInfos = DirectoryInfo.GetFiles(searchPattern, searchOption);
     return(FileInfoWrap.ConvertFileInfoArrayIntoIFileInfoWrapArray(fileInfos));
 }
Exemple #4
0
 /// <inheritdoc />
 public IFileInfo[] GetFiles()
 {
     FileInfo[] fileInfos = DirectoryInfo.GetFiles();
     return(FileInfoWrap.ConvertFileInfoArrayIntoIFileInfoWrapArray(fileInfos));
 }
        private void SaveResourceAsFile(string resourceName, string filename)
        {
            var fullPath = Path.Combine(BasePath, filename);
            var resourceBytes = ResourceHelpers.GetFileBytesFromResource(GetType(), resourceName);
            var info = new FileInfoWrap(fullPath);

            if (!info.Directory.Exists)
                Directory.CreateDirectory(info.Directory.FullName);

            using (var fileStream = File.Create(fullPath))
            {
                fileStream.Write(resourceBytes, 0, resourceBytes.Length);
                fileStream.Close();
            }
        }
 internal static IFileInfo[] ConvertFileInfoArrayIntoIFileInfoWrapArray(FileInfo[] fileInfos)
 {
     var fileInfoWraps = new FileInfoWrap[fileInfos.Length];
     for (int i = 0; i < fileInfos.Length; i++)
         fileInfoWraps[i] = new FileInfoWrap(fileInfos[i]);
     return fileInfoWraps;
 }