1
- using System ;
2
- using System . Text ;
3
- using System . Diagnostics ;
4
- using System . Globalization ;
5
- using System . Runtime . InteropServices ;
6
- using System . Runtime . CompilerServices ;
7
-
8
- using UELib . Core ;
9
- using UELib . Decoding ;
10
- using UELib . Annotations ;
1
+ using UELib . Decoding ;
11
2
12
3
namespace UELib . Branch . UE3 . HUXLEY
13
4
{
14
5
public class CryptoDecoderHuxley : IBufferDecoder
15
6
{
16
- private uint Key ;
7
+ private readonly uint _Key ;
17
8
18
9
public CryptoDecoderHuxley ( string name )
19
10
{
20
- for ( var i = 0 ; i < name . Length ; i ++ )
11
+ for ( int i = 0 ; i < name . Length ; i ++ )
21
12
{
22
- Key *= 16 ;
23
- Key ^= name [ i ] ;
13
+ _Key *= 16 ;
14
+ _Key ^= name [ i ] ;
24
15
}
25
16
}
26
17
27
- public CryptoDecoderHuxley ( uint key )
28
- {
29
- Key = key ;
30
- }
18
+ public CryptoDecoderHuxley ( uint key ) => _Key = key ;
31
19
32
20
public void PreDecode ( IUnrealStream stream )
33
21
{
@@ -39,18 +27,22 @@ public void DecodeBuild(IUnrealStream stream, UnrealPackage.GameBuild build)
39
27
40
28
public void DecodeRead ( long position , byte [ ] buffer , int index , int count )
41
29
{
42
- for ( var i = index ; i + 4 <= count ; i += 4 )
30
+ for ( int i = index ; i + 4 <= count ; i += 4 )
43
31
{
44
- for ( var j = 0 ; j < 4 ; j ++ )
45
- buffer [ i + j ] = ( byte ) ( Key >> ( j * 8 ) ^ buffer [ i + j ] ) ;
46
-
47
- for ( var j = 0 ; j < 4 ; j ++ )
48
- buffer [ i + j ] = ( byte ) ( count >> ( j * 8 ) ^ buffer [ i + j ] ) ;
32
+ for ( int j = 0 ; j < 4 ; j ++ )
33
+ {
34
+ buffer [ i + j ] = ( byte ) ( ( _Key >> ( j * 8 ) ) ^ buffer [ i + j ] ) ;
35
+ }
36
+
37
+ for ( int j = 0 ; j < 4 ; j ++ )
38
+ {
39
+ buffer [ i + j ] = ( byte ) ( ( count >> ( j * 8 ) ) ^ buffer [ i + j ] ) ;
40
+ }
49
41
}
50
42
}
51
43
52
44
public unsafe void DecodeByte ( long position , byte * b )
53
45
{
54
46
}
55
47
}
56
- }
48
+ }
0 commit comments