Skip to main content

decoder-state

// Save and restore Decoder state with bytes
// Get byte[] of decoder state
byte[] decoderByteState = mkeDecoder.SaveState();

// Restore Decoder with byte[] state
MteStatus decoderStatus = mkeDecoder.RestoreState(decoderByteState);
if(decoderStatus != MteStatus.mte_status_success)
{
// Mte cannot continue, handle restore failure appropriately
// Below is only an example
throw new Exception("Failed to restore Decoder state. Status: "
+ mkeDecoder.GetStatusName(decoderStatus)+ " / "
+ mkeDecoder.GetStatusDescription(decoderStatus));
}
// Save and restore Decoder state with string
// Get string of Decoder state
string decoderStrState = mkeDecoder.SaveStateB64();

// Restore Decoder with string state
MteStatus decoderStatus = mkeDecoder.RestoreStateB64(decoderStrState);
if(decoderStatus != MteStatus.mte_status_success)
{
// Mte cannot continue, handle restore failure appropriately
// Below is only an example
throw new Exception("Failed to restore Decoder state. Status: "
+ mkeDecoder.GetStatusName(decoderStrStatus)+ " / "
+ mkeDecoder.GetStatusDescription(decoderStrStatus));
}