// Envia pacote public void Send <T> (T o) { if (o == null) { throw new Exception(""); } else { byte [] send = PConvert.ToByteArray(o); Log.Snd(this, PConvert.ToStruct <SHeader> (send)); PSecurity.Encrypt(ref send); this.Socket.BeginSend(send, 0, send.Length, SocketFlags.None, null, null); } }
// Carrega a ItemList.bin public static void LoadItemlist( ) { DateTime start = Time; byte [] read = File.ReadAllBytes($"{Dir}ItemList.bin"); int size = read.Length / Marshal.SizeOf <SItemList> ( ); Itemlist = new SItemList [size]; for (int i = 0; i < read.Length; i++) { read [i] ^= 0x5A; } for (int i = 0; i < Itemlist.Length; i++) { Itemlist [i] = PConvert.ToStruct <SItemList> (read, i * 140); } read = null; Log.Information($"ItemList, com {size:N0} itens, carregada em [{Time - start}]"); }