public static void AddEntry <TEntry, TVolume>(this AbstractWritableArchive <TEntry, TVolume> writableArchive, int index, string entryPath, string filePath) where TEntry : IArchiveEntry where TVolume : IVolume { writableArchive.AddEntry(index, entryPath, new FileInfo(filePath)); }
public static TEntry AddEntry <TEntry, TVolume>(this AbstractWritableArchive <TEntry, TVolume> writableArchive, string key, FileInfo fileInfo) where TEntry : IArchiveEntry where TVolume : IVolume { if (!fileInfo.Exists) { throw new ArgumentException("FileInfo does not exist."); } return(writableArchive.AddEntry(key, fileInfo.OpenRead(), true, fileInfo.Length, fileInfo.LastWriteTime)); }
public static void AddAllFromDirectory <TEntry, TVolume>( this AbstractWritableArchive <TEntry, TVolume> writableArchive, string filePath, string searchPattern = "*.*", SearchOption searchOption = SearchOption.AllDirectories) where TEntry : IArchiveEntry where TVolume : IVolume { foreach (var path in Directory.EnumerateFiles(filePath, searchPattern, searchOption)) { var fileInfo = new FileInfo(path); writableArchive.AddEntry(path.Substring(filePath.Length), fileInfo.OpenRead(), true, fileInfo.Length, fileInfo.LastWriteTime); } }
public static void AddEntry <TEntry, TVolume>(this AbstractWritableArchive <TEntry, TVolume> writableArchive, string entryPath, string filePath) where TEntry : IArchiveEntry where TVolume : IVolume { var fileInfo = new FileInfo(filePath); if (!fileInfo.Exists) { throw new FileNotFoundException("Could not AddEntry: " + filePath); } writableArchive.AddEntry(entryPath, new FileInfo(filePath).OpenRead(), true, fileInfo.Length, fileInfo.LastWriteTime); }
public static void AddAllFromDirectory <TEntry, TVolume>(this AbstractWritableArchive <TEntry, TVolume> writableArchive, string filePath, string searchPattern = "*.*", SearchOption searchOption = SearchOption.AllDirectories) where TEntry : IArchiveEntry where TVolume : IVolume { int i = 1; #if THREEFIVE foreach (var path in Directory.GetFiles(filePath, searchPattern, searchOption)) #else foreach (var path in Directory.EnumerateFiles(filePath, searchPattern, searchOption)) #endif { writableArchive.AddEntry(i++, path.Substring(filePath.Length), new FileInfo(path)); } }