예제 #1
0
 public void Update()
 {
     if (this.bInit && ((Time.time - this.m_LastTime) > 20f))
     {
         IntPtr ptr = TssSdk.tss_get_report_data();
         if (ptr != IntPtr.Zero)
         {
             TssSdk.AntiDataInfo info = new TssSdk.AntiDataInfo();
             if (TssSdk.Is64bit())
             {
                 short num  = Marshal.ReadInt16(ptr, 0);
                 long  num2 = Marshal.ReadInt64(ptr, 2);
                 info.anti_data_len = (ushort)num;
                 info.anti_data     = new IntPtr(num2);
             }
             else if (TssSdk.Is32bit())
             {
                 short num3 = Marshal.ReadInt16(ptr, 0);
                 int   num4 = Marshal.ReadInt32(ptr, 2);
                 info.anti_data_len = (ushort)num3;
                 info.anti_data     = new IntPtr(num4);
             }
             if (info.anti_data != IntPtr.Zero)
             {
                 CSPkg msg = NetworkModule.CreateDefaultCSPKG(0xbb8);
                 msg.stPkgData.stAntiDataReq.wLen = info.anti_data_len;
                 Marshal.Copy(info.anti_data, msg.stPkgData.stAntiDataReq.szBuff, 0, info.anti_data_len);
                 Singleton <NetworkModule> .GetInstance().SendLobbyMsg(ref msg, false);
             }
             TssSdk.tss_del_report_data(ptr);
         }
         this.m_LastTime = Time.time;
     }
 }
예제 #2
0
    public void StartSendDataToSvr()
    {
        IntPtr intPtr = TssSdk.tss_get_report_data();

        if (intPtr != IntPtr.Zero)
        {
            TssSdk.AntiDataInfo antiDataInfo = new TssSdk.AntiDataInfo();
            if (TssSdk.Is64bit())
            {
                short num   = Marshal.ReadInt16(intPtr, 0);
                long  value = Marshal.ReadInt64(intPtr, 2);
                antiDataInfo.anti_data_len = (ushort)num;
                antiDataInfo.anti_data     = new IntPtr(value);
            }
            else if (TssSdk.Is32bit())
            {
                short num2   = Marshal.ReadInt16(intPtr, 0);
                long  value2 = (long)Marshal.ReadInt32(intPtr, 2);
                antiDataInfo.anti_data_len = (ushort)num2;
                antiDataInfo.anti_data     = new IntPtr(value2);
            }
            else
            {
                Debug.LogError(this.tag + " TSSSDK NO INT TYPE");
            }
            if (this.SendDataToSvr(antiDataInfo))
            {
                TssSdk.tss_del_report_data(intPtr);
            }
        }
    }
예제 #3
0
    private void Update()
    {
        if ((Time.realtimeSinceStartup - lastTime) < interval)
        {
            return;
        }
        // 如果socket还没有连接,则不发送安全sdk数据
        if (!Capstones.UnityFramework.Network.ClientSocket.GetSocketConnectState())
        {
            return;
        }

        lastTime = Time.realtimeSinceStartup;

        IntPtr addr = TssSdk.tss_get_report_data();

        if (addr != IntPtr.Zero)
        {
            TssSdk.AntiDataInfo info = new TssSdk.AntiDataInfo();
            if (TssSdk.Is64bit())
            {
                short anti_data_len = Marshal.ReadInt16(addr, 0);
                Int64 anti_data     = Marshal.ReadInt64(addr, 2);
                info.anti_data_len = (ushort)anti_data_len;
                info.anti_data     = new IntPtr(anti_data);
            }
            else if (TssSdk.Is32bit())
            {
                short anti_data_len = Marshal.ReadInt16(addr, 0);
                Int32 anti_data     = Marshal.ReadInt32(addr, 2);
                info.anti_data_len = (ushort)anti_data_len;
                info.anti_data     = new IntPtr(anti_data);
            }

            // 数据长度大于1024的直接丢弃
            if (info.anti_data_len > 1024)
            {
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("Tsssdk上报数据长度大于1024,丢弃");
                }
                TssSdk.tss_del_report_data(addr);
                return;
            }

            if (SendDataToServer(info))
            {
                TssSdk.tss_del_report_data(addr);
            }
        }
    }
예제 #4
0
        private void OnTssCollected()
        {
            IntPtr ptr = TssSdk.tss_get_report_data();

            if (ptr != IntPtr.Zero)
            {
                TssSdk.AntiDataInfo info = new TssSdk.AntiDataInfo();
                if (TssSdk.Is64bit())
                {
                    short num  = Marshal.ReadInt16(ptr, 0);
                    long  num2 = Marshal.ReadInt64(ptr, 2);
                    info.anti_data_len = (ushort)num;
                    info.anti_data     = new IntPtr(num2);
                }
                else if (TssSdk.Is32bit())
                {
                    short num3 = Marshal.ReadInt16(ptr, 0);
                    long  num4 = Marshal.ReadInt32(ptr, 2);
                    info.anti_data_len = (ushort)num3;
                    info.anti_data     = new IntPtr(num4);
                }
                if (info.anti_data == IntPtr.Zero)
                {
                    ADebug.Log("OnTssCollected aniti data is null");
                }
                else
                {
                    ApolloTSS otss;
                    otss = new ApolloTSS {
                        wLen   = info.anti_data_len,
                        szData = new byte[otss.wLen]
                    };
                    Marshal.Copy(info.anti_data, otss.szData, 0, otss.wLen);
                    ADebug.Log("begin send tss data len:" + otss.wLen);
                    if (this.talker != null)
                    {
                        this.talker.Send(TalkerCommand.CommandDomain.TSS, otss);
                    }
                    else if (this.transfer != null)
                    {
                        this.transfer.OnTssDataCollected(otss.szData);
                    }
                    TssSdk.tss_del_report_data(ptr);
                }
            }
            else
            {
                ADebug.Log("tss tss_get_report_data addr is null");
            }
        }
예제 #5
0
    public static byte[] TssSdkGetSdkReportData2()
    {
        IntPtr addr = tss_get_report_data2();

        if (addr == IntPtr.Zero)
        {
            return(null);
        }
        ushort anti_data_len = 0;
        IntPtr anti_data     = IntPtr.Zero;

        if (TssSdk.Is32bit())
        {
            //FileLog.Log("c#.32bit");

            anti_data_len = (ushort)Marshal.ReadInt16(addr, 0);

            Int32 anti_data_addr = Marshal.ReadInt32(addr, 2);
            if (anti_data_addr == 0)
            {
                return(null);
            }
            anti_data = new IntPtr(anti_data_addr);
        }
        else if (TssSdk.Is64bit())
        {
            //FileLog.Log("c#.64bit");

            anti_data_len = (ushort)Marshal.ReadInt16(addr, 0);

            Int64 anti_data_addr = Marshal.ReadInt64(addr, 2);
            if (anti_data_addr == 0)
            {
                return(null);
            }
            anti_data = new IntPtr(anti_data_addr);
        }
        //
        if (anti_data == IntPtr.Zero)
        {
            return(null);
        }
        //
        byte[] data = new byte[anti_data_len];
        Marshal.Copy(anti_data, data, 0, anti_data_len);
        return(data);
    }
        private void OnTssCollected()
        {
            IntPtr intPtr = TssSdk.tss_get_report_data();

            if (intPtr != IntPtr.Zero)
            {
                TssSdk.AntiDataInfo antiDataInfo = new TssSdk.AntiDataInfo();
                if (TssSdk.Is64bit())
                {
                    short num  = Marshal.ReadInt16(intPtr, 0);
                    long  num2 = Marshal.ReadInt64(intPtr, 2);
                    antiDataInfo.anti_data_len = (ushort)num;
                    antiDataInfo.anti_data     = new IntPtr(num2);
                }
                else if (TssSdk.Is32bit())
                {
                    short num3 = Marshal.ReadInt16(intPtr, 0);
                    long  num4 = (long)Marshal.ReadInt32(intPtr, 2);
                    antiDataInfo.anti_data_len = (ushort)num3;
                    antiDataInfo.anti_data     = new IntPtr(num4);
                }
                if (antiDataInfo.anti_data == IntPtr.Zero)
                {
                    ADebug.Log("OnTssCollected aniti data is null");
                    return;
                }
                ApolloTSS apolloTSS = new ApolloTSS();
                apolloTSS.wLen   = antiDataInfo.anti_data_len;
                apolloTSS.szData = new byte[(int)apolloTSS.wLen];
                Marshal.Copy(antiDataInfo.anti_data, apolloTSS.szData, 0, (int)apolloTSS.wLen);
                ADebug.Log("begin send tss data len:" + apolloTSS.wLen);
                if (this.talker != null)
                {
                    this.talker.Send(TalkerCommand.CommandDomain.TSS, apolloTSS);
                }
                else if (this.transfer != null)
                {
                    this.transfer.OnTssDataCollected(apolloTSS.szData);
                }
                TssSdk.tss_del_report_data(intPtr);
            }
            else
            {
                ADebug.Log("tss tss_get_report_data addr is null");
            }
        }
예제 #7
0
 public void Update()
 {
     if (!this.bInit || !this.bEnableTSS)
     {
         return;
     }
     if (Time.time - this.m_LastTime > 20f)
     {
         IntPtr intPtr = TssSdk.tss_get_report_data();
         if (intPtr != IntPtr.Zero)
         {
             TssSdk.AntiDataInfo antiDataInfo = new TssSdk.AntiDataInfo();
             if (TssSdk.Is64bit())
             {
                 short num  = Marshal.ReadInt16(intPtr, 0);
                 long  num2 = Marshal.ReadInt64(intPtr, 2);
                 antiDataInfo.anti_data_len = (ushort)num;
                 antiDataInfo.anti_data     = new IntPtr(num2);
             }
             else if (TssSdk.Is32bit())
             {
                 short num3 = Marshal.ReadInt16(intPtr, 0);
                 int   num4 = Marshal.ReadInt32(intPtr, 2);
                 antiDataInfo.anti_data_len = (ushort)num3;
                 antiDataInfo.anti_data     = new IntPtr(num4);
             }
             if (antiDataInfo.anti_data != IntPtr.Zero)
             {
                 CSPkg cSPkg = NetworkModule.CreateDefaultCSPKG(3000u);
                 cSPkg.stPkgData.stAntiDataReq.wLen = antiDataInfo.anti_data_len;
                 Marshal.Copy(antiDataInfo.anti_data, cSPkg.stPkgData.stAntiDataReq.szBuff, 0, (int)antiDataInfo.anti_data_len);
                 Singleton <NetworkModule> .GetInstance().SendLobbyMsg(ref cSPkg, false);
             }
             TssSdk.tss_del_report_data(intPtr);
         }
         this.m_LastTime = Time.time;
     }
 }