Some C# for processing bin files and some mod ideas for BC_VUP_V3
Visual Studio, dotPeek
Do XOR op for the bin file and convert it to hex file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace FileBin
{
internal class Program
{
static void Main(string[] args)
{
char[] ct = new char[16]
{
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'A',
'B',
'C',
'D',
'E',
'F'
};
String fileName = @"G:\temp\file.bin";
Console.WriteLine(fileName);
byte[] file = File.ReadAllBytes(fileName);
int fileSize = file.Length;
Console.WriteLine(fileSize.ToString());
byte[] fx = new byte[fileSize];
int i = 0;
int r = 0;
while (i < fileSize)
{
byte n = (byte)((uint)file[i] ^ 85U);
if ((byte)32 <= n && n <= (byte)126)
{
fx[r] = n;
r++;
}
i++;
}
StringBuilder sb = new StringBuilder();
foreach (byte n in fx)
{
if (n != 0)
{
int i1 = (int)n >> 4 & 15;
int i2 = (int)n & 15;
sb.Append(ct[i1]);
sb.Append(ct[i2]);
}
}
File.WriteAllText(@"G:\temp\bintostr.txt", sb.ToString(), Encoding.ASCII);
Console.WriteLine("Ok");
}
}
}
BC_VUP_V3 firmware update process could be modified to write the data to file
Comments
Post a Comment