Example #1
0
        public override ApolloWakeupInfo FromString(string src)
        {
            ApolloStringParser parser = new ApolloStringParser(src);

            this.state        = (ApolloWakeState)parser.GetInt("State");
            this.Platform     = (ApolloPlatform)parser.GetInt("Platform");
            this.MediaTagName = parser.GetString("MediaTagName");
            this.OpenId       = parser.GetString("OpenId");
            this.Lang         = parser.GetString("Lang");
            this.Country      = parser.GetString("Country");
            this.MessageExt   = parser.GetString("MessageExt");
            string str = parser.GetString("ExtInfo");

            if ((str != null) && (string.Empty != str))
            {
                char[]   separator = new char[] { ',' };
                string[] strArray  = str.Split(separator);
                this.ExtensionInfo.Clear();
                foreach (string str2 in strArray)
                {
                    string       str3 = ApolloStringParser.ReplaceApolloString(ApolloStringParser.ReplaceApolloString(str2));
                    ApolloKVPair item = new ApolloKVPair();
                    item.FromString(str3);
                    this.ExtensionInfo.Add(item);
                }
            }
            return(this);
        }
Example #2
0
        public override ApolloWakeupInfo FromString(string src)
        {
            Debug.Log("WakeUpInfo:" + src);
            ApolloStringParser apolloStringParser = new ApolloStringParser(src);

            this.state        = (ApolloWakeState)apolloStringParser.GetInt("State");
            this.Platform     = (ApolloPlatform)apolloStringParser.GetInt("Platform");
            this.MediaTagName = apolloStringParser.GetString("MediaTagName");
            this.OpenId       = apolloStringParser.GetString("OpenId");
            this.Lang         = apolloStringParser.GetString("Lang");
            this.Country      = apolloStringParser.GetString("Country");
            this.MessageExt   = apolloStringParser.GetString("MessageExt");
            string @string = apolloStringParser.GetString("ExtInfo");

            if (@string != null && string.Empty != @string)
            {
                string[] array = @string.Split(new char[]
                {
                    ','
                });
                this.ExtensionInfo.Clear();
                string[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    string src2 = array2[i];
                    string src3 = ApolloStringParser.ReplaceApolloString(src2);
                    src3 = ApolloStringParser.ReplaceApolloString(src3);
                    ApolloKVPair apolloKVPair = new ApolloKVPair();
                    apolloKVPair.FromString(src3);
                    this.ExtensionInfo.Add(apolloKVPair);
                }
            }
            return(this);
        }
Example #3
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");
            }
        }
Example #4
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);
            }
        }
Example #5
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");
            }
        }
Example #6
0
 private void onLoginProc(string msg)
 {
     BugLocateLogSys.Log("ApolloAccountService onLoginProc:" + msg);
     if (!string.IsNullOrEmpty(msg))
     {
         ApolloStringParser apolloStringParser = new ApolloStringParser(msg);
         ApolloAccountInfo  apolloAccountInfo  = null;
         ApolloResult       @int = (ApolloResult)apolloStringParser.GetInt("Result");
         BugLocateLogSys.Log("ApolloAccountService onLoginProc: result" + @int);
         if (@int == ApolloResult.Success)
         {
             apolloAccountInfo = apolloStringParser.GetObject <ApolloAccountInfo>("AccountInfo");
             if (apolloAccountInfo != null && apolloAccountInfo.TokenList != null)
             {
                 BugLocateLogSys.Log(string.Concat(new object[]
                 {
                     "C# onLoginProc|",
                     @int,
                     " platform:",
                     apolloAccountInfo.Platform,
                     " openid:",
                     apolloAccountInfo.OpenId,
                     " tokensize:",
                     apolloAccountInfo.TokenList.Count,
                     " pf:",
                     apolloAccountInfo.Pf,
                     " pfkey:",
                     apolloAccountInfo.PfKey
                 }));
             }
             else
             {
                 BugLocateLogSys.Log("parser.GetObject<ApolloAccountInfo>() return null");
                 Debug.LogError("parser.GetObject<ApolloAccountInfo>() return null");
             }
         }
         else
         {
             BugLocateLogSys.Log("C# onLoginProc error:" + @int);
             DebugHelper.Assert(false, "C# onLoginProc error:" + @int);
         }
         Debug.LogWarning(string.Format("LoginEvent:{0}", this.LoginEvent));
         if (this.LoginEvent != null)
         {
             try
             {
                 this.LoginEvent(@int, apolloAccountInfo);
             }
             catch (Exception ex)
             {
                 DebugHelper.Assert(false, "onLoginProc:" + ex);
                 BugLocateLogSys.Log("onLoginProc catch exception :" + ex.get_Message() + "|" + ex.ToString());
             }
         }
     }
 }
 private void OnFeedbackNotify(string msg)
 {
     ADebug.Log("onFeedbackEvent:" + msg);
     if (this.onFeedbackEvent != null)
     {
         ApolloStringParser apolloStringParser = new ApolloStringParser(msg);
         int    @int    = apolloStringParser.GetInt("Flag");
         string @string = apolloStringParser.GetString("Desc");
         try
         {
             this.onFeedbackEvent(@int, @string);
         }
         catch (Exception ex)
         {
             ADebug.Log("onFeedbackEvent:" + ex);
         }
     }
 }
Example #8
0
        private void OnConnectorErrorProc(string msg)
        {
            ApolloStringParser apolloStringParser = new ApolloStringParser(msg);
            ApolloResult       @int = (ApolloResult)apolloStringParser.GetInt("Result", 6);

            ADebug.LogError("OnConnectorErrorProc:" + @int);
            this.Connected = false;
            if (this.ErrorEvent != null)
            {
                try
                {
                    this.ErrorEvent(@int);
                }
                catch (Exception exception)
                {
                    ADebug.LogException(exception);
                }
            }
        }
Example #9
0
        private void OnDisconnectProc(string msg)
        {
            ApolloStringParser apolloStringParser = new ApolloStringParser(msg);
            ApolloResult       @int = (ApolloResult)apolloStringParser.GetInt("Result");

            if (@int == ApolloResult.Success)
            {
                this.Connected = false;
            }
            if (this.DisconnectEvent != null)
            {
                try
                {
                    this.DisconnectEvent(@int);
                }
                catch (Exception exception)
                {
                    ADebug.LogException(exception);
                }
            }
        }
Example #10
0
        private void onAccessTokenRefresedProc(string msg)
        {
            ADebug.Log("onAccessTokenRefresedProc: " + msg);
            ApolloStringParser     apolloStringParser = new ApolloStringParser(msg);
            ListView <ApolloToken> listView           = null;
            ApolloResult           @int = (ApolloResult)apolloStringParser.GetInt("Result");

            if (@int == ApolloResult.Success)
            {
                string text = apolloStringParser.GetString("tokens");
                if (text != null)
                {
                    text = ApolloStringParser.ReplaceApolloString(text);
                    ADebug.Log("onAccessTokenRefresedProc tokens:" + text);
                    if (text != null && text.get_Length() > 0)
                    {
                        string[] array = text.Split(new char[]
                        {
                            ','
                        });
                        listView = new ListView <ApolloToken>();
                        string[] array2 = array;
                        for (int i = 0; i < array2.Length; i++)
                        {
                            string src   = array2[i];
                            string text2 = ApolloStringParser.ReplaceApolloString(src);
                            text2 = ApolloStringParser.ReplaceApolloString(text2);
                            ApolloToken apolloToken = new ApolloToken();
                            apolloToken.FromString(text2);
                            ADebug.Log(string.Format("onAccessTokenRefresedProc str:{0} |||||| {1}   |||||{2}", text2, apolloToken.Type, apolloToken.Value));
                            listView.Add(apolloToken);
                        }
                    }
                }
            }
            if (this.RefreshAtkEvent != null)
            {
                this.RefreshAtkEvent(@int, listView);
            }
        }