ok i admit it... i need more help
i'm too exited, but please "bear with me", im here to learn
i change my last code and use this
Свернуть ↑
Код:
public static void Main(string[] args)
{
// BAD CODE, DON'T TRY IT !
byte[] bin;
string inputFilename = @"E:\Goods_Indonesia.txt";
using (FileStream fs = new FileStream(inputFilename,FileMode.Open))
using (BinaryReader br = new BinaryReader(fs))
{
bin = br.ReadBytes(Convert.ToInt32(fs.Length));
}
for (var i = 0; i < bin.Length; i += 2048)
{
Unshift(bin, i, 3);
}
Process.GetCurrentProcess().WaitForExit();
}
public static void Unshift(byte[] buffer, int start, int bits)
{
int length = buffer.Length - start;
byte last = buffer[length - 1];
byte current;
for (int i = length - 1; (i & 0x80000000) == 0; i--)
{
if (i <= 0)
{
current = last;
}
else
{
current = buffer[i - 1];
}
buffer[i] = (byte)(current << (8 - bits) | buffer[i] >> bits);
}
Console.WriteLine(Encoding.UTF8.GetString(buffer));
}
Свернуть ↑Развернуть ↓
hoping it would be faster than the last one, but same result and most of the times it freeze my computer if i open bigger file, googling for hours and can't find an answer (wrong keyword perhaps)
any advice is greatly appreciated,