pondělí 30. března 2015

Versions 2.0.0 & 2.1.0 released

The newest versions of Base64Stream library have undergone an extensive performance tweak during the last few days, resulting in a much more faster processing.

I have been able to reach the encoding speed of about 2.2MB/s in my sample Windows Store App, compared to about 150kBps in previous release. The difference during decoding phase is even more remarkable, going to 2MB/s from something around 40 kilobytes per second in previous version, making the decoding about 5x faster!

Get it here!

This was achieved by removing redundant code parts from debugging stage and better and more efficient work with .NET streams.

Also a new static function GetLastProcessingAverageSpeed has been added, which enables you to obtain the average processing speed (in bytes/s) of the last performed operation easily.


Hope you like the news and enjoy the library! Please feel free to let me know should you have any troubles with it.

čtvrtek 26. března 2015

Version 1.1.0 released

The Base64Stream library has been updated today.

Version 1.1.0 fixes the wrapped data decoding issue and now handles wrapping automatically during decoding. Both standard wrapping modes (after 64 or 76 characters) are supported by Decode function (while any other non-standard wrapping will still result in a corrupted output).

This version also introduces encoding options that enables you to control the wrapping also during Base64 encoding. The Encode function has been extended by an optional numerical parameter.
Use EncodeOptions enumeration to set the wrapping behavior. Possible values are:
Encode_Default (0)
Encode_Wrap_64 (1)
Encode_Wrap_76 (2)

By default, the Encode_Default option is on, resulting in a single-line Base64 output.


In favor of possible future development the options parameter is processed bit-wise by the Encode function to enable setting multiple options at once, although it makes no sense at the moment - only one of the three possible options will take effect in current version (if wrapping is requested and both 64 and 76 flags are set, the 64 wrapping has a higher priority).

středa 25. března 2015

Release 1.0.0

Base64Stream is a free .NET library for Base64 stream encoding/decoding on Windows Phone 8.1 and Windows 8.1 Store Apps.

Current version provides only "single-line" encoding and decoding. Although this does not cause any problems during encoding, it will result in corrupted output when you try to decode wrapped Base64 data (e.g. 64 characters per line). I am aware of this limitation and will do my best to fix it ASAP.
Also no options are available at the moment, but hopefully will be added soon.

You can use Base64Stream library for stream encoding in following way:

private async void EncodeFile()
{
  StorageFile input = await ApplicationData.Current.LocalFolder.GetFileAsync("document.txt");
  Stream instream = await input.OpenStreamForReadAsync();

  StorageFile output = await ApplicationData.Current.LocalFolder.CreateFile("base64.txt", CreationCollisionOptions.ReplaceExisting);
  Stream outstream = await output.OpenStreamForWriteAsync();

  int nWritten = await NuGet_Base64Stream.Encode(instream, outstream);

  await outstream.FlushAsync();
  outstream.Dispose();
  instream.Dispose();
}

Decoding goes the same way using Decode function.

Both functions return number of bytes written to the output stream.