Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="inputBuffer"></param>
 /// <param name="outputBuffer"></param>
 /// <returns></returns>
 /// <exception cref="NotImplementedException"></exception>
 public static int Decompress(byte[] inputBuffer, byte[] outputBuffer)
 {
     if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
     {
         return(OodleNative.OodleLZ_Decompress(inputBuffer, inputBuffer.Length, outputBuffer,
                                               outputBuffer.Length, OodleNative.OodleLZ_FuzzSafe.No, OodleNative.OodleLZ_CheckCRC.No,
                                               OodleNative.OodleLZ_Verbosity.None, 0, 0, 0, 0, 0, 0, OodleNative.OodleLZ_Decode.Unthreaded));
     }
     else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
     {
         return(OozNative.Kraken_Decompress(inputBuffer, inputBuffer.Length, outputBuffer,
                                            outputBuffer.Length));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Пример #2
0
 /// <summary>
 /// Gets the max buffer size needed for oodle compression
 /// </summary>
 /// <param name="count"></param>
 /// <returns></returns>
 /// <exception cref="NotImplementedException"></exception>
 public static int GetCompressedBufferSizeNeeded(int count)
 {
     if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
     {
         return((int)OodleNative.GetCompressedBufferSizeNeeded((long)count));
     }
     else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
     {
         try
         {
             return(OozNative.GetCompressedBufferSizeNeeded(count));
         }
         catch (Exception e)
         {
             Console.WriteLine(e);
             throw;
         }
     }
     else
     {
         throw new NotImplementedException();
     }
 }