04-10-2019, 12:55 AM
(Сообщение последний раз редактировалось: 04-10-2019, 04:12 PM bmzproject.)
Help me please
Shift(Enc, i, 2048, 3);
@Awiion, @PROGRAMMATOR
[SRC="csharp"]
//old
public static void Shift ( byte [ ] buffer, int bits )
{
int length = buffer . Length ;
byte first = buffer [ 0 ] ;
byte current ;
for ( int i = 0 ; i < length ; i ++ )
{
if ( i > = ( length - 1 ) )
{
current = first ;
}
else
{
current = buffer [ i + 1 ] ;
}
buffer [ i ] = ( byte ) ( current >> ( 8 - bits ) | ( buffer [ i ] << bits ) ) ;
}
}
//new
public void Shift(byte[] data, int start, int length, int bits)
{
var to = start - length;
if (data.Length > to) to = data.Length;
var last = data[0];
for (int i = 0; i < to; i++)
{
var current = i >= start ? last : data[i + 1];
data[i] = (byte)(current >> (8 - bits) | (data[i] << bits));
}
txt_output.AppendText(Encoding.Unicode.GetString(data));
}
[/SRC]
not working
how to fix
@PROGRAMMATOR
Shift(Enc, i, 2048, 3);
@Awiion, @PROGRAMMATOR
[SRC="csharp"]
//old
public static void Shift ( byte [ ] buffer, int bits )
{
int length = buffer . Length ;
byte first = buffer [ 0 ] ;
byte current ;
for ( int i = 0 ; i < length ; i ++ )
{
if ( i > = ( length - 1 ) )
{
current = first ;
}
else
{
current = buffer [ i + 1 ] ;
}
buffer [ i ] = ( byte ) ( current >> ( 8 - bits ) | ( buffer [ i ] << bits ) ) ;
}
}
//new
public void Shift(byte[] data, int start, int length, int bits)
{
var to = start - length;
if (data.Length > to) to = data.Length;
var last = data[0];
for (int i = 0; i < to; i++)
{
var current = i >= start ? last : data[i + 1];
data[i] = (byte)(current >> (8 - bits) | (data[i] << bits));
}
txt_output.AppendText(Encoding.Unicode.GetString(data));
}
[/SRC]
not working
how to fix
@PROGRAMMATOR