This sample encodes with the Base64 format from memory to a file and decodes the encoded data from file to memory.
C# |
Copy Code |
XceedBinaryEncodingLib.XceedBinaryEncoding encoder = new XceedBinaryEncodingLib.XceedBinaryEncodingClass();
encoder.License( @"your license key" );
try { encoder.EncodingFormat = new XceedBinaryEncodingLib.XceedBase64EncodingFormatClass();
object data = "This is the data to encode";
// Encoded the data to file encoder.WriteFile( ref data, XceedBinaryEncodingLib.EXBFileProcessing.bfpEncode, true, @"c:\test\encoded.txt", false );
object bytesRead = null;
// Decode the encoded data located in the file to memory. object decodedData = encoder.ReadFile( @"c:\test\encoded.txt" ,0,0, XceedBinaryEncodingLib.EXBFileProcessing.bfpDecode ,true, ref bytesRead );
MessageBox.Show( System.Text.Encoding.Unicode.GetString( ( byte[] )decodedData ) ); } catch( System.Runtime.InteropServices.COMException except ) { MessageBox.Show( except.ToString() ); } |