Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateDeflater()

ZLibNative.ZLibStreamHandle System.Net.WebSockets.Compression.WebSocketDeflater.CreateDeflater ( )
inlineprivate

Definition at line 154 of file WebSocketDeflater.cs.

155 {
156 ZLibNative.ErrorCode errorCode;
157 ZLibNative.ZLibStreamHandle zLibStreamHandle;
158 try
159 {
160 errorCode = ZLibNative.CreateZLibStreamForDeflate(out zLibStreamHandle, ZLibNative.CompressionLevel.DefaultCompression, _windowBits, 8, ZLibNative.CompressionStrategy.DefaultStrategy);
161 }
162 catch (Exception innerException)
163 {
164 throw new WebSocketException(System.SR.ZLibErrorDLLLoadError, innerException);
165 }
166 if (errorCode == ZLibNative.ErrorCode.Ok)
167 {
168 return zLibStreamHandle;
169 }
170 zLibStreamHandle.Dispose();
171 string message = ((errorCode == ZLibNative.ErrorCode.MemError) ? System.SR.ZLibErrorNotEnoughMemory : string.Format(System.SR.ZLibErrorUnexpected, (int)errorCode));
172 throw new WebSocketException(message);
173 }
static ErrorCode CreateZLibStreamForDeflate(out ZLibStreamHandle zLibStreamHandle, CompressionLevel level, int windowBits, int memLevel, CompressionStrategy strategy)
static string ZLibErrorNotEnoughMemory
Definition SR.cs:46
static string ZLibErrorDLLLoadError
Definition SR.cs:40
Definition SR.cs:7

References System.Net.WebSockets.Compression.WebSocketDeflater._windowBits, System.IO.Compression.ZLibNative.CreateZLibStreamForDeflate(), System.Runtime.InteropServices.SafeHandle.Dispose(), System.SR.ZLibErrorDLLLoadError, System.SR.ZLibErrorNotEnoughMemory, and System.SR.ZLibErrorUnexpected.

Referenced by System.Net.WebSockets.Compression.WebSocketDeflater.DeflatePrivate().