using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
return (Value ^ (key + 123456)) + (key + 78910);
public void Set(int Value, int key)
this.Value = (Value - (key + 78910)) ^ (key + 123456);
public ObfInt(int Value, int key)
public byte[] Serialize()
BinaryFormatter formatter = new BinaryFormatter();
MemoryStream stream = new MemoryStream();
formatter.Serialize(stream, this);
public static T Deserialize(byte[] pack)
MemoryStream stream = new MemoryStream(pack);
BinaryFormatter formatter = new BinaryFormatter();
return (T)formatter.Deserialize(stream);
class PlayerValue : Pack<PlayerValue>
ObfInt _Index = new ObfInt();
public int Index { get { return _Index.Get(453453); } set { _Index.Set(value, 453453); } }
ObfInt _Level = new ObfInt();
public int Level { get { return _Level.Get(782578278); } set { _Level.Set(value, 782578278); } }
class TestPack : Pack<TestPack>
ObfInt _Index = new ObfInt();
public int Index { get { return _Index.Get(2147483640); } set { _Index.Set(value, 2147483640); } }
ObfInt _A = new ObfInt();
public int A { get { return _A.Get(-188637837); } set { _A.Set(value, -188637837); } }
ObfInt _B = new ObfInt();
public int B { get { return _B.Get(7867865); } set { _B.Set(value, 7867865); } }
public List<int> Test1 = new List<int>();
public List<PlayerValue> Test2 = new List<PlayerValue>();
private ObfInt _Value = new ObfInt();
public static implicit operator IntA(int v)
obj._Value.Set(v, -123456);
public static implicit operator int(IntA v)
return v._Value.Get(-123456);
public List<IntA> Test3 = new List<IntA>();
public static void Main()
var test = new TestPack();
test.Test2.Add(new PlayerValue() { Index = 5, Level = 6 });
test.Test2.Add(new PlayerValue() { Index = 7, Level = 8 });
test.Test2.Add(new PlayerValue() { Index = 9, Level = 10 });
byte[] data = test.Serialize();
var test2 = TestPack.Deserialize(data);
Console.WriteLine(test.Index);
Console.WriteLine(test.A);
Console.WriteLine(test.B);
foreach (var i in test.Test1) Console.WriteLine(i);
foreach (var i in test.Test2) Console.WriteLine(i.Index + " " + i.Level);
foreach (var i in test.Test3) Console.WriteLine((int)i);