private void CompressFile()
{
bool islarger = false;
Util.OriginalSize = Util.file1TargetFileOutput.Length;
string byteSource = Util.file1TargetFileOutput;
//Compress the target file
Util.file1TargetFileOutput = Encoding.Default.GetString(
Compress.CompressData(Encoding.Default.GetBytes(Util.file1TargetFileOutput)));
Util.PackedSize = Util.file1TargetFileOutput.Length;
decimal csize = ((decimal)Util.PackedSize / (decimal)Util.OriginalSize) * 100;
//If it's bigger after compressing, don't use the compressed string & use the original
if (Convert.ToInt64(Strings.Split(Convert.ToString(csize), ".", -1, CompareMethod.Text)[0]) > 100)
{ islarger = true; }
if (islarger)
{
Util.compressed = false;
Util.file1TargetFileOutput = byteSource;
//Skipped file compression on the target file as it would make the file larger than the original
DebugLBL1.Text += FromBase64("U2tpcHBlZCBmaWxlIGNvbXByZXNzaW9uIG9uIHRoZSB0YXJnZXQgZmlsZSBhcyBpdCB3b3VsZCBtYWtlIHRoZSBmaWxlIGxhcmdlciB0aGFuIHRoZSBvcmlnaW5hbA==") + '\n';
}
else
{
Util.compressed = true;
//Target file size after compressing:
DebugLBL1.Text += FromBase64("VGFyZ2V0IGZpbGUgc2l6ZSBhZnRlciBjb21wcmVzc2luZzog") +
CodeDOMCompiler.SetBytes(Encoding.Default.GetBytes(Util.file1TargetFileOutput), false) + '\n';
}
}