Exemple #1
0
        internal ApolloResult SendNotice(TalkerCommand command, IPackable request)
        {
            ADebug.Log("SendNotice:" + request);
            ApolloMessage message = new ApolloMessage();

            return(this.Send(TalkerMessageType.Notice, command, request, message));
        }
Exemple #2
0
        private ApolloResult SendNotice(IPackable request)
        {
            ADebug.Log("SendNotice:" + request);
            ApolloMessage message = new ApolloMessage();

            return(this.Send(TalkerMessageType.Notice, new TalkerCommand(TalkerCommand.CommandDomain.App, request), request, message));
        }
        private static bool s_GetWakeupInfo(out ApolloWakeupInfo wakeupInfo)
        {
            wakeupInfo = null;
            StringBuilder pAccountInfo = new StringBuilder(0x5000);
            bool          flag         = apollo_account_GetWakeupInfo(pAccountInfo, 0x5000);

            ADebug.Log("s_GetWakeupInfo : " + flag);
            if (flag)
            {
                string src = pAccountInfo.ToString();
                ADebug.Log("s_GetWakeupInfo: " + src);
                if ((src != null) && (src.Length > 0))
                {
                    ApolloStringParser parser = new ApolloStringParser(src);
                    if (parser != null)
                    {
                        wakeupInfo = parser.GetObject <ApolloWakeupInfo>("WakeupInfo");
                        if (wakeupInfo != null)
                        {
                            ADebug.Log("s_GetWakeupInfo parser.GetObject success");
                            return(true);
                        }
                        ADebug.Log("s_GetWakeupInfo parser.GetObject error");
                    }
                    else
                    {
                        ADebug.Log("GetWakeupInfo parser.GetObjec error");
                    }
                }
            }
            return(false);
        }
Exemple #4
0
 public ApolloResult Send(TalkerMessageType type, TalkerCommand command, IPackable request, ApolloMessage message)
 {
     if (command == null || request == null)
     {
         return(ApolloResult.InvalidArgument);
     }
     byte[] array = null;
     if (message == null)
     {
         message = new ApolloMessage();
     }
     if (message.PackRequestData(command, request, out array, type))
     {
         ADebug.Log(string.Concat(new object[]
         {
             "Sending:",
             command,
             " data size:",
             array.Length
         }));
         ApolloResult apolloResult = this.connector.WriteData(array, -1);
         if (apolloResult == ApolloResult.Success && message.Handler != null)
         {
             ApolloMessageManager.Instance.SeqMessageCollection.Add(message.SeqNum, message);
         }
         return(apolloResult);
     }
     ADebug.LogError("Send: " + command + " msg.PackRequestDat error");
     return(ApolloResult.InnerError);
 }
Exemple #5
0
 public ApolloResult Send(TalkerMessageType type, TalkerCommand command, byte[] bodyData, int usedSize, ApolloMessage message)
 {
     if (command == null || bodyData == null || usedSize <= 0)
     {
         return(ApolloResult.InvalidArgument);
     }
     byte[] array = null;
     if (message == null)
     {
         message = new ApolloMessage();
     }
     if (message.PackRequestData(command, bodyData, usedSize, out array, type))
     {
         ADebug.Log(string.Concat(new object[]
         {
             "Sending:",
             command,
             " data size:",
             array.Length
         }));
         return(this.connector.WriteData(array, -1));
     }
     ADebug.LogError("Send: " + command + " msg.PackRequestData error");
     return(ApolloResult.InnerError);
 }
Exemple #6
0
        private void OnReconnectProc(string msg)
        {
            ADebug.Log("c#:OnReconnectProc: " + msg);
            ApolloStringParser apolloStringParser = new ApolloStringParser(msg);
            ApolloResult       @int = (ApolloResult)apolloStringParser.GetInt("Result", 6);

            if (@int == ApolloResult.Success)
            {
                this.Connected = true;
            }
            else
            {
                this.Connected = false;
            }
            if (this.ReconnectEvent != null)
            {
                try
                {
                    this.ReconnectEvent(@int);
                }
                catch (Exception exception)
                {
                    ADebug.LogException(exception);
                }
            }
            else
            {
                ADebug.Log("OnReconnectProc ReconnectEvent is null");
            }
        }
Exemple #7
0
 private void setUserInfo(ApolloAccountInfo accountInfo, uint worldId, string roleId)
 {
     if (accountInfo == null)
     {
         ADebug.Log("TssService account info is null");
     }
     else
     {
         TssSdk.EENTRYID entryId = TssSdk.EENTRYID.ENTRY_ID_OTHERS;
         string          openId  = accountInfo.OpenId;
         string          appId   = null;
         if (accountInfo != null)
         {
             if (accountInfo.Platform == ApolloPlatform.Wechat)
             {
                 entryId = TssSdk.EENTRYID.ENTRY_ID_MM;
                 appId   = ApolloCommon.ApolloInfo.WXAppId;
             }
             else
             {
                 entryId = TssSdk.EENTRYID.ENTRY_ID_QZONE;
                 appId   = ApolloCommon.ApolloInfo.QQAppId;
             }
         }
         TssSdk.TssSdkSetUserInfoEx(entryId, openId, appId, worldId, roleId);
     }
 }
 private static void onSendMessage(ulong objectId, [MarshalAs(UnmanagedType.LPStr)] string function, [MarshalAs(UnmanagedType.LPStr)] string param)
 {
     if (!Instance.dictObjectCollection.ContainsKey(objectId))
     {
         ADebug.LogError(string.Concat(new object[] { "onSendMessage not exist: ", objectId, " function:", function, " param:", param }));
     }
     else
     {
         ApolloObject obj2 = Instance.dictObjectCollection[objectId];
         if ((obj2 != null) && (function != null))
         {
             System.Type[] types = new System.Type[] { typeof(string) };
             MethodInfo    info  = obj2.GetType().GetMethod(function, BindingFlags.IgnoreReturn | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance, null, types, null);
             if (info != null)
             {
                 object[] parameters = new object[] { param };
                 info.Invoke(obj2, parameters);
             }
             else
             {
                 ADebug.LogError("onSendMessage not exist method:" + function);
             }
         }
         else
         {
             ADebug.Log("onSendMessage:" + objectId + " do not exist");
         }
     }
 }
Exemple #9
0
 private void onRecvedData()
 {
     ADebug.Log("onRecvedData OnDataRecvedProc");
     while (true)
     {
         int    num;
         byte[] buffer = null;
         if (this.connector.ReadData(out buffer, out num) != ApolloResult.Success)
         {
             return;
         }
         try
         {
             ApolloMessage message = ApolloMessageManager.Instance.UnpackResponseData(buffer, num);
             if (message != null)
             {
                 ADebug.Log(string.Concat(new object[] { "Recved:", message.Command, " and resp is:", message.Response }));
                 ADebug.Log(string.Concat(new object[] { "OnDataRecvedProc: apolloMessage.Handler != null?: ", message.Handler != null, " apolloMessage.HandlerWithReceipt != null?: ", message.HandlerWithReceipt != null, " apolloMessage.HandlerWithoutReceipt != null?: ", message.HandlerWithoutReceipt != null }));
                 message.HandleMessage();
             }
             else
             {
                 ADebug.LogError("OnDataRecvedProc UnpackResponseData error");
             }
         }
         catch (Exception exception)
         {
             ADebug.LogException(exception);
         }
     }
 }
Exemple #10
0
        private static bool s_GetWakeupInfo(out ApolloWakeupInfo wakeupInfo)
        {
            wakeupInfo = null;
            StringBuilder stringBuilder = new StringBuilder(20480);
            bool          flag          = ApolloQuickLoginService.apollo_account_GetWakeupInfo(stringBuilder, 20480);

            ADebug.Log("s_GetWakeupInfo : " + flag);
            if (flag)
            {
                string text = stringBuilder.ToString();
                ADebug.Log("s_GetWakeupInfo: " + text);
                if (text != null && text.get_Length() > 0)
                {
                    ApolloStringParser apolloStringParser = new ApolloStringParser(text);
                    if (apolloStringParser != null)
                    {
                        wakeupInfo = apolloStringParser.GetObject <ApolloWakeupInfo>("WakeupInfo");
                        if (wakeupInfo != null)
                        {
                            ADebug.Log("s_GetWakeupInfo parser.GetObject success");
                            return(true);
                        }
                        ADebug.Log("s_GetWakeupInfo parser.GetObject error");
                    }
                    else
                    {
                        ADebug.Log("GetWakeupInfo parser.GetObjec error");
                    }
                }
            }
            return(false);
        }
Exemple #11
0
        private void onAccessTokenRefresedProc(string msg)
        {
            ADebug.Log("onAccessTokenRefresedProc: " + msg);
            ApolloStringParser     parser    = new ApolloStringParser(msg);
            ListView <ApolloToken> tokenList = null;
            ApolloResult           @int      = (ApolloResult)parser.GetInt("Result");

            if (@int == ApolloResult.Success)
            {
                string src = parser.GetString("tokens");
                if (src != null)
                {
                    src = ApolloStringParser.ReplaceApolloString(src);
                    ADebug.Log("onAccessTokenRefresedProc tokens:" + src);
                    if ((src != null) && (src.Length > 0))
                    {
                        char[]   separator = new char[] { ',' };
                        string[] strArray  = src.Split(separator);
                        tokenList = new ListView <ApolloToken>();
                        foreach (string str2 in strArray)
                        {
                            string      str3 = ApolloStringParser.ReplaceApolloString(ApolloStringParser.ReplaceApolloString(str2));
                            ApolloToken item = new ApolloToken();
                            item.FromString(str3);
                            ADebug.Log(string.Format("onAccessTokenRefresedProc str:{0} |||||| {1}   |||||{2}", str3, item.Type, item.Value));
                            tokenList.Add(item);
                        }
                    }
                }
            }
            if (this.RefreshAtkEvent != null)
            {
                this.RefreshAtkEvent(@int, tokenList);
            }
        }
 public bool SendToQQGameFriend(int act, string fopenid, string title, string summary, string targetUrl, string imgUrl, string previewText, string gameTag, string msdkExtInfo)
 {
     ADebug.Log(string.Concat(new object[]
     {
         "CApolloSnsService::SendToQQGameFriend act:",
         act,
         "fopenid:",
         fopenid,
         "title:",
         title,
         "summary:",
         summary,
         "targetUrl:",
         targetUrl,
         "imgUrl:",
         imgUrl,
         "previewText:",
         previewText,
         "gameTag:",
         gameTag,
         "msdkExtInfo:",
         msdkExtInfo
     }));
     return(ApolloSnsService.Apollo_Sns_SendToQQGameFriend(base.ObjectId, act, fopenid, title, summary, targetUrl, imgUrl, previewText, gameTag, msdkExtInfo));
 }
Exemple #13
0
        private void OnConnectProc(string msg)
        {
            ADebug.Log("c#:OnConnectProc: " + msg);
            if (string.IsNullOrEmpty(msg))
            {
                ADebug.LogError("OnConnectProc msg is null");
                return;
            }
            ApolloStringParser apolloStringParser = new ApolloStringParser(msg);
            ApolloResult       @int = (ApolloResult)apolloStringParser.GetInt("Result", 6);

            this.LoginInfo = apolloStringParser.GetObject <ApolloLoginInfo>("LoginInfo");
            if (@int == ApolloResult.Success)
            {
                this.Connected = true;
            }
            else
            {
                this.Connected = false;
            }
            ADebug.Log(string.Concat(new object[]
            {
                "c#:OnConnectProc: ",
                @int,
                " loginfo:",
                this.LoginInfo
            }));
            if (this.LoginInfo != null && this.LoginInfo.AccountInfo != null && this.LoginInfo.AccountInfo.TokenList != null)
            {
                ADebug.Log(string.Concat(new object[]
                {
                    "C# logininfo| platform:",
                    this.LoginInfo.AccountInfo.Platform,
                    " openid:",
                    this.LoginInfo.AccountInfo.OpenId,
                    " tokensize:",
                    this.LoginInfo.AccountInfo.TokenList.Count,
                    " pf:",
                    this.LoginInfo.AccountInfo.Pf,
                    " pfkey:",
                    this.LoginInfo.AccountInfo.PfKey
                }));
            }
            if (this.ConnectEvent != null)
            {
                try
                {
                    this.ConnectEvent(@int, this.LoginInfo);
                }
                catch (Exception exception)
                {
                    ADebug.LogException(exception);
                }
            }
            else
            {
                ADebug.Log("OnConnectProc ConnectEvent is null");
            }
        }
Exemple #14
0
 public bool Initialize(ApolloBufferBase registerInfo)
 {
     byte[] buffer;
     ADebug.Log("ApolloPayService Initialize!");
     this.inited = true;
     registerInfo.Encode(out buffer);
     return(apollo_pay_Initialize(buffer, buffer.Length));
 }
 public void OnApplicationPause(bool pauseStatus)
 {
     ADebug.Log("ObjectManager OnApplicationPause:" + pauseStatus);
     for (int i = 0; i < this.acceptUpdatedObjectList.Count; i++)
     {
         this.acceptUpdatedObjectList[i].OnApplicationPause(pauseStatus);
     }
 }
Exemple #16
0
 public ApolloResult Initialize(ApolloPlatform platform, uint permission, string url)
 {
     ADebug.Log(string.Concat(new object[] { "Connector Initialize:", platform, " url:", url }));
     if (platform == ApolloPlatform.WTLogin)
     {
     }
     return((ApolloResult)apollo_connector_Initialize(base.ObjectId, platform, permission, url));
 }
 private void onNetworkStateChanged(NetworkState state)
 {
     ADebug.Log("C# ApolloNetworkService onNetworkStateChanged state:" + state);
     if (this.NetworkChangedEvent != null)
     {
         this.NetworkChangedEvent(state);
     }
 }
 public bool Initialize(ApolloBufferBase registerInfo)
 {
     ADebug.Log("ApolloPayService Initialize!");
     this.inited = true;
     byte[] array;
     registerInfo.Encode(out array);
     return(ApolloPayService.apollo_pay_Initialize(array, array.Length));
 }
 public void OnDisable()
 {
     ADebug.Log("ObjectManager OnDisable");
     for (int i = 0; i < this.acceptUpdatedObjectList.Count; i++)
     {
         this.acceptUpdatedObjectList[i].OnDisable();
     }
     this.acceptUpdatedObjectList.Clear();
 }
Exemple #20
0
        public void OnApolloPayActionProc(int ret, byte[] data)
        {
            ADebug.Log("OnApolloPayActionProc!");
            PluginBase currentPlugin = PluginManager.Instance.GetCurrentPlugin();

            if (currentPlugin == null)
            {
                ADebug.LogError("OnApolloPayActionProc plugin is null");
            }
            else
            {
                ApolloAction action = new ApolloAction();
                if (!action.Decode(data))
                {
                    ADebug.LogError("OnApolloPayActionProc Action Decode failed");
                }
                else if (this.actionCallbackCollection.ContainsKey(action.Action))
                {
                    ApolloActionBufferBase base3 = currentPlugin.CreatePayResponseAction(action.Action);
                    if (base3 != null)
                    {
                        if (!base3.Decode(data))
                        {
                            ADebug.LogError("OnApolloPayActionProc Decode failed");
                        }
                        else
                        {
                            ApolloActionDelegate delegate2 = this.actionCallbackCollection[action.Action];
                            if (delegate2 != null)
                            {
                                try
                                {
                                    delegate2((ApolloResult)ret, base3);
                                }
                                catch (Exception exception)
                                {
                                    ADebug.LogError("OnApolloPayActionProc exception:" + exception);
                                }
                            }
                            else
                            {
                                ADebug.LogError("OnApolloPayActionProc callback is null while action == " + action.Action);
                            }
                        }
                    }
                    else
                    {
                        ADebug.LogError("OnApolloPayActionProc info is null");
                    }
                }
                else
                {
                    ADebug.LogError("OnApolloPayActionProc not exist action:" + action.Action);
                }
            }
        }
 public void OnApplicationQuit()
 {
     ADebug.Log("ObjectManager OnApplicationQuit");
     for (int i = 0; i < this.acceptUpdatedObjectList.Count; i++)
     {
         this.acceptUpdatedObjectList[i].OnApplicationQuit();
     }
     this.acceptUpdatedObjectList.Clear();
     this.ClearObjects();
     apollo_quit();
 }
Exemple #22
0
 public override void DestroyApolloConnector(IApolloConnector connector)
 {
     ADebug.Log("DestroyApolloConnector");
     if (connector != null)
     {
         ApolloConnector connector2 = connector as ApolloConnector;
         if (connector2 != null)
         {
             connector2.Destroy();
         }
     }
 }
 public void RegisterLogCallback(ApolloBuglyLogDelegate callback)
 {
     ADebug.Log("Apollo RegisterExceptionHandler");
     if (callback != null)
     {
         this.m_LogCallback = callback;
         BuglyAgent.RegisterLogCallback(new BuglyAgent.LogCallbackDelegate(this.apollo_bugly_log_callback));
     }
     else
     {
         BuglyAgent.RegisterLogCallback(null);
     }
 }
Exemple #24
0
        public ApolloResult GetRecord(ref ApolloAccountInfo pAccountInfo)
        {
            StringBuilder builder = new StringBuilder(0x1000);
            ApolloResult  result  = apollo_account_getRecord(base.ObjectId, builder, 0x1000);
            string        src     = builder.ToString();

            ADebug.Log(string.Concat(new object[] { "GetRecord:", result, ", ", src }));
            if (src.Length > 0)
            {
                pAccountInfo.FromString(src);
            }
            return(result);
        }
Exemple #25
0
 public ApolloResult SetSecurityInfo(ApolloEncryptMethod encyptMethod, ApolloKeyMaking keyMakingMethod, string dhp)
 {
     ADebug.Log(string.Concat(new object[]
     {
         "SetSecurityInfo encyptMethod:",
         encyptMethod,
         " keyMakingMethod:",
         keyMakingMethod,
         " dh:",
         dhp
     }));
     return(ApolloConnector.apollo_connector_setSecurityInfo(base.ObjectId, encyptMethod, keyMakingMethod, dhp));
 }
Exemple #26
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");
            }
        }
Exemple #27
0
        public ApolloResult SendRequest()
        {
            ADebug.Log("Send request to tconnd through talker");
            HttpReq request = this.PackRequest();

            if (request == null)
            {
                ADebug.Log("httpReq is null");
            }
            return(this.talker.Send <HttpRsp>(request, delegate(object req, TalkerEventArgs <HttpRsp> e) {
                ADebug.Log("Get Response form server");
                this.DealRsp(e.Response, e.Result);
            }, null, this.timeout));
        }
Exemple #28
0
        public override void DestroyApolloConnector(IApolloConnector connector)
        {
            ADebug.Log("DestroyApolloConnector");
            if (connector == null)
            {
                return;
            }
            ApolloConnector apolloConnector = connector as ApolloConnector;

            if (apolloConnector != null)
            {
                apolloConnector.Destroy();
            }
        }
Exemple #29
0
        private static void QuickLoginOccur()
        {
            ADebug.Log("C# Apollo pulled up by quicklogin");
            ApolloWakeupInfo wakeupInfo = new ApolloWakeupInfo();
            bool             flag       = ApolloQuickLoginService.s_GetWakeupInfo(out wakeupInfo);

            if (ApolloQuickLoginService.m_callback != null)
            {
                ApolloQuickLoginService.m_callback(wakeupInfo);
            }
            else
            {
                ADebug.Log("QuickLoginOccur m_callback is null");
            }
        }
Exemple #30
0
 public override ApolloResult Initialize(ApolloInfo platformInfo)
 {
     ApolloCommon.ApolloInfo = platformInfo;
     if (platformInfo == null)
     {
         throw new Exception("ApolloInfo could not be null!!");
     }
     ADebug.Log(string.Format("Apollo Init QQAppId:{0}, WXAppId:{1}, pluginName:{2}", platformInfo.QQAppId, platformInfo.WXAppId, platformInfo.PluginName));
     if (string.IsNullOrEmpty(platformInfo.PluginName))
     {
         ApolloCommon.ApolloInfo.PluginName = "MSDK";
     }
     MsdkAdapter.InnerInstall();
     return((ApolloResult)Apollo.apollo_init(platformInfo.ServiceId, platformInfo.MaxMessageBufferSize, ApolloCommon.ApolloInfo.PluginName));
 }