|
35 | 35 | // obligated to do so. If you do not wish to do so, delete this |
36 | 36 | // exception statement from your version. |
37 | 37 |
|
| 38 | +// HISTORY |
| 39 | +// 2012-11-29 Z-1684 Added MakeFileEntry(string fileName, string entryName, bool useFileSystem) |
| 40 | + |
38 | 41 | using System; |
39 | 42 | using System.IO; |
40 | 43 |
|
@@ -207,18 +210,29 @@ public bool IsUnicodeText |
207 | 210 | /// <returns>Returns a new <see cref="ZipEntry"/> based on the <paramref name="fileName"/>.</returns> |
208 | 211 | public ZipEntry MakeFileEntry(string fileName) |
209 | 212 | { |
210 | | - return MakeFileEntry(fileName, true); |
| 213 | + return MakeFileEntry(fileName, null, true); |
| 214 | + } |
| 215 | + |
| 216 | + /// <summary> |
| 217 | + /// Make a new <see cref="ZipEntry"/> for a file. |
| 218 | + /// </summary> |
| 219 | + /// <param name="fileName">The name of the file to create a new entry for.</param> |
| 220 | + /// <param name="useFileSystem">If true entry detail is retrieved from the file system if the file exists.</param> |
| 221 | + /// <returns>Returns a new <see cref="ZipEntry"/> based on the <paramref name="fileName"/>.</returns> |
| 222 | + public ZipEntry MakeFileEntry(string fileName, bool useFileSystem) { |
| 223 | + return MakeFileEntry(fileName, null, useFileSystem); |
211 | 224 | } |
212 | 225 |
|
213 | 226 | /// <summary> |
214 | 227 | /// Make a new <see cref="ZipEntry"/> from a name. |
215 | 228 | /// </summary> |
216 | 229 | /// <param name="fileName">The name of the file to create a new entry for.</param> |
| 230 | + /// <param name="entryName">An alternative name to be used for the new entry. Null if not applicable.</param> |
217 | 231 | /// <param name="useFileSystem">If true entry detail is retrieved from the file system if the file exists.</param> |
218 | 232 | /// <returns>Returns a new <see cref="ZipEntry"/> based on the <paramref name="fileName"/>.</returns> |
219 | | - public ZipEntry MakeFileEntry(string fileName, bool useFileSystem) |
| 233 | + public ZipEntry MakeFileEntry(string fileName, string entryName, bool useFileSystem) |
220 | 234 | { |
221 | | - ZipEntry result = new ZipEntry(nameTransform_.TransformFile(fileName)); |
| 235 | + ZipEntry result = new ZipEntry(nameTransform_.TransformFile(entryName != null && entryName.Length > 0 ? entryName : fileName)); |
222 | 236 | result.IsUnicodeText = isUnicodeText_; |
223 | 237 |
|
224 | 238 | int externalAttributes = 0; |
|
0 commit comments