示例#1
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            string name = toolStripTextBox1.Text;

            Profiles.Refresh();
            Profiles.Create(name);
            Profiles.Refresh();
            RefreshProfiles();
        }
        private static void PreAuth(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
        {
            List <Blaze.Tdf> input = Blaze.ReadPacketContent(p);

            Blaze.TdfStruct  CDAT = (Blaze.TdfStruct)input[0];
            Blaze.TdfInteger TYPE = (Blaze.TdfInteger)CDAT.Values[3];
            pi.isServer = TYPE.Value != 0;
            if (pi.isServer)
            {
                pi.game    = new GameInfo();
                pi.profile = Profiles.Create("test-server", 999);
                pi.userId  = 999;
            }
            Blaze.TdfStruct  CINF = (Blaze.TdfStruct)input[1];
            Blaze.TdfString  CVER = (Blaze.TdfString)CINF.Values[4];
            Blaze.TdfInteger LOC  = (Blaze.TdfInteger)CINF.Values[7];
            pi.loc     = LOC.Value;
            pi.version = CVER.Value;
            BlazeServer.Log("[CLNT] #" + pi.userId + " is a " + (pi.isServer ? "server" : "client"), System.Drawing.Color.Blue);
            List <Blaze.Tdf> Result = new List <Blaze.Tdf>();

            Result.Add(Blaze.TdfInteger.Create("ANON", 0));
            Result.Add(Blaze.TdfString.Create("ASRC", "300294"));
            List <string> t  = Helper.ConvertStringList("{1} {25} {4} {27} {28} {6} {7} {9} {10} {11} {30720} {30721} {30722} {30723} {20} {30725} {30726} {2000}");
            List <long>   t2 = new List <long>();

            foreach (string v in t)
            {
                t2.Add(Convert.ToInt64(v));
            }
            Result.Add(Blaze.TdfList.Create("CIDS", 0, t2.Count, t2));
            t = new List <string>();
            List <string> t3 = new List <string>();

            Helper.ConvertDoubleStringList("{connIdleTimeout ; 90s} {defaultRequestTimeout ; 60s} {pingPeriod ; 20s} {voipHeadsetUpdateRate ; 1000} {xlspConnectionIdleTimeout ; 300}", out t, out t3);
            Blaze.TdfDoubleList conf2 = Blaze.TdfDoubleList.Create("CONF", 1, 1, t, t3, t.Count);
            List <Blaze.Tdf>    t4    = new List <Blaze.Tdf>();

            t4.Add(conf2);
            Result.Add(Blaze.TdfStruct.Create("CONF", t4));
            Result.Add(Blaze.TdfString.Create("INST", "battlefield-assault-pc"));
            Result.Add(Blaze.TdfInteger.Create("MINR", 0));
            Result.Add(Blaze.TdfString.Create("NASP", "cem_ea_id"));
            Result.Add(Blaze.TdfString.Create("PILD", ""));
            Result.Add(Blaze.TdfString.Create("PLAT", "pc"));
            List <Blaze.Tdf> QOSS = new List <Blaze.Tdf>();
            List <Blaze.Tdf> BWPS = new List <Blaze.Tdf>();

            BWPS.Add(Blaze.TdfString.Create("PSA\0", ProviderInfo.QOS_IP));
            BWPS.Add(Blaze.TdfInteger.Create("PSP\0", ProviderInfo.QOS_Port));
            BWPS.Add(Blaze.TdfString.Create("SNA\0", ProviderInfo.QOS_Name));
            QOSS.Add(Blaze.TdfStruct.Create("BWPS", BWPS));
            QOSS.Add(Blaze.TdfInteger.Create("LNP\0", 0xA));
            List <Blaze.Tdf> LTPS1 = new List <Blaze.Tdf>();

            LTPS1.Add(Blaze.TdfString.Create("PSA\0", ProviderInfo.QOS_IP));
            LTPS1.Add(Blaze.TdfInteger.Create("PSP\0", ProviderInfo.QOS_Port));
            LTPS1.Add(Blaze.TdfString.Create("SNA\0", ProviderInfo.QOS_Name));
            List <Blaze.TdfStruct> LTPS = new List <Blaze.TdfStruct>();

            LTPS.Add(Blaze.CreateStructStub(LTPS1));
            t = Helper.ConvertStringList("{" + ProviderInfo.QOS_SName + "}");
            QOSS.Add(Blaze.TdfDoubleList.Create("LTPS", 1, 3, t, LTPS, 1));
            QOSS.Add(Blaze.TdfInteger.Create("SVID", 0x45410805));
            Result.Add(Blaze.TdfStruct.Create("QOSS", QOSS));
            Result.Add(Blaze.TdfString.Create("RSRC", "300294"));
            Result.Add(Blaze.TdfString.Create("SVER", "WV Server"));
            byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result);
            ns.Write(buff, 0, buff.Length);
            ns.Flush();
        }