static Exception GetError(LzmaReturn ret) { switch (ret) { case LzmaReturn.LzmaMemError: return(new InsufficientMemoryException("Memory allocation failed")); case LzmaReturn.LzmaOptionsError: return(new ArgumentException("Specified preset is not supported")); case LzmaReturn.LzmaUnsupportedCheck: return(new Exception("Specified integrity check is not supported")); case LzmaReturn.LzmaDataError: return(new InvalidDataException("File size limits exceeded")); default: return(new Exception("Unknown error, possibly a bug: " + ret)); } }
static Exception GetDecodingError(LzmaReturn ret) { switch (ret) { case LzmaReturn.LzmaMemError: return(new InsufficientMemoryException("Memory allocation failed")); case LzmaReturn.LzmaFormatError: return(new InvalidDataException("The input is not in the .xz format")); case LzmaReturn.LzmaOptionsError: return(new Exception("Unsupported compression options")); case LzmaReturn.LzmaDataError: return(new InvalidDataException("Compressed file is corrupt")); case LzmaReturn.LzmaBufError: return(new InvalidDataException("Compressed file is truncated or otherwise corrupt")); default: return(new Exception("Unknown error, possibly a bug: " + ret)); } }
Exception ThrowError(LzmaReturn ret) { Native.lzma_end(ref _lzmaStream); return(GetError(ret)); }
static Exception IndexDecodingError(LzmaReturn ret) => new InvalidDataException("Index decoding failed: " + ret);