diff options
Diffstat (limited to 'src/WixToolset.Core.Native/Cabinet.cs')
| -rw-r--r-- | src/WixToolset.Core.Native/Cabinet.cs | 89 |
1 files changed, 2 insertions, 87 deletions
diff --git a/src/WixToolset.Core.Native/Cabinet.cs b/src/WixToolset.Core.Native/Cabinet.cs index 7e04cbc5..9b77bd37 100644 --- a/src/WixToolset.Core.Native/Cabinet.cs +++ b/src/WixToolset.Core.Native/Cabinet.cs | |||
| @@ -8,7 +8,7 @@ namespace WixToolset.Core.Native | |||
| 8 | using WixToolset.Data; | 8 | using WixToolset.Data; |
| 9 | 9 | ||
| 10 | /// <summary> | 10 | /// <summary> |
| 11 | /// Wrapper class around interop with wixcab.dll to compress files into a cabinet. | 11 | /// Cabinet create, enumerate and extract mechanism. |
| 12 | /// </summary> | 12 | /// </summary> |
| 13 | public sealed class Cabinet | 13 | public sealed class Cabinet |
| 14 | { | 14 | { |
| @@ -16,7 +16,7 @@ namespace WixToolset.Core.Native | |||
| 16 | private static readonly char[] TextLineSplitter = new[] { '\t' }; | 16 | private static readonly char[] TextLineSplitter = new[] { '\t' }; |
| 17 | 17 | ||
| 18 | /// <summary> | 18 | /// <summary> |
| 19 | /// | 19 | /// Creates a cabinet creation, enumeration, extraction mechanism. |
| 20 | /// </summary> | 20 | /// </summary> |
| 21 | /// <param name="path">Path of cabinet</param> | 21 | /// <param name="path">Path of cabinet</param> |
| 22 | public Cabinet(string path) | 22 | public Cabinet(string path) |
| @@ -116,90 +116,5 @@ namespace WixToolset.Core.Native | |||
| 116 | var wixnative = new WixNativeExe("extractcab", this.Path, outputFolder); | 116 | var wixnative = new WixNativeExe("extractcab", this.Path, outputFolder); |
| 117 | return wixnative.Run().Where(output => !String.IsNullOrWhiteSpace(output)); | 117 | return wixnative.Run().Where(output => !String.IsNullOrWhiteSpace(output)); |
| 118 | } | 118 | } |
| 119 | |||
| 120 | #if TOOD_ERROR_HANDLING | ||
| 121 | /// <summary> | ||
| 122 | /// Adds a file to the cabinet with an optional MSI file hash. | ||
| 123 | /// </summary> | ||
| 124 | /// <param name="file">The file to add.</param> | ||
| 125 | /// <param name="token">The token for the file.</param> | ||
| 126 | /// <param name="fileHash">The MSI file hash of the file.</param> | ||
| 127 | //private void AddFile(string file, string token, MsiInterop.MSIFILEHASHINFO fileHash) | ||
| 128 | //{ | ||
| 129 | // try | ||
| 130 | // { | ||
| 131 | // NativeMethods.CreateCabAddFile(file, token, fileHash, this.handle); | ||
| 132 | // } | ||
| 133 | // catch (COMException ce) | ||
| 134 | // { | ||
| 135 | // if (0x80004005 == unchecked((uint)ce.ErrorCode)) // E_FAIL | ||
| 136 | // { | ||
| 137 | // throw new WixException(WixErrors.CreateCabAddFileFailed()); | ||
| 138 | // } | ||
| 139 | // else if (0x80070070 == unchecked((uint)ce.ErrorCode)) // ERROR_DISK_FULL | ||
| 140 | // { | ||
| 141 | // throw new WixException(WixErrors.CreateCabInsufficientDiskSpace()); | ||
| 142 | // } | ||
| 143 | // else | ||
| 144 | // { | ||
| 145 | // throw; | ||
| 146 | // } | ||
| 147 | // } | ||
| 148 | // catch (DirectoryNotFoundException) | ||
| 149 | // { | ||
| 150 | // throw new WixFileNotFoundException(file); | ||
| 151 | // } | ||
| 152 | // catch (FileNotFoundException) | ||
| 153 | // { | ||
| 154 | // throw new WixFileNotFoundException(file); | ||
| 155 | // } | ||
| 156 | //} | ||
| 157 | |||
| 158 | /// <summary> | ||
| 159 | /// Complete/commit the cabinet - this must be called before Dispose so that errors will be | ||
| 160 | /// reported on the same thread. | ||
| 161 | /// </summary> | ||
| 162 | /// <param name="newCabNamesCallBackAddress">Address of Binder's callback function for Cabinet Splitting</param> | ||
| 163 | public void Complete(IntPtr newCabNamesCallBackAddress) | ||
| 164 | { | ||
| 165 | if (IntPtr.Zero != this.handle) | ||
| 166 | { | ||
| 167 | try | ||
| 168 | { | ||
| 169 | if (newCabNamesCallBackAddress != IntPtr.Zero && this.maxSize != 0) | ||
| 170 | { | ||
| 171 | NativeMethods.CreateCabFinish(this.handle, newCabNamesCallBackAddress); | ||
| 172 | } | ||
| 173 | else | ||
| 174 | { | ||
| 175 | NativeMethods.CreateCabFinish(this.handle, IntPtr.Zero); | ||
| 176 | } | ||
| 177 | |||
| 178 | GC.SuppressFinalize(this); | ||
| 179 | this.disposed = true; | ||
| 180 | } | ||
| 181 | catch (COMException ce) | ||
| 182 | { | ||
| 183 | //if (0x80004005 == unchecked((uint)ce.ErrorCode)) // E_FAIL | ||
| 184 | //{ | ||
| 185 | // // This error seems to happen, among other situations, when cabbing more than 0xFFFF files | ||
| 186 | // throw new WixException(WixErrors.FinishCabFailed()); | ||
| 187 | //} | ||
| 188 | //else if (0x80070070 == unchecked((uint)ce.ErrorCode)) // ERROR_DISK_FULL | ||
| 189 | //{ | ||
| 190 | // throw new WixException(WixErrors.CreateCabInsufficientDiskSpace()); | ||
| 191 | //} | ||
| 192 | //else | ||
| 193 | //{ | ||
| 194 | // throw; | ||
| 195 | //} | ||
| 196 | } | ||
| 197 | finally | ||
| 198 | { | ||
| 199 | this.handle = IntPtr.Zero; | ||
| 200 | } | ||
| 201 | } | ||
| 202 | } | ||
| 203 | #endif | ||
| 204 | } | 119 | } |
| 205 | } | 120 | } |
