コード例 #1
0
        // 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);
            }
        }
コード例 #2
0
ファイル: Config.cs プロジェクト: theskytalos/Open-WYD-Server
        // 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}]");
        }