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);
        }
        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);
        }
        public ApolloServerRouteInfo FromString(string data)
        {
            ApolloStringParser apolloStringParser = new ApolloStringParser(data);

            this.ServerId = (ulong)apolloStringParser.GetUInt32("ServerId");
            return(this);
        }
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
 public override ApolloToken FromString(string src)
 {
     char[] separator = new char[] { '&' };
     foreach (string str in src.Split(separator, StringSplitOptions.RemoveEmptyEntries))
     {
         char[]   chArray2  = new char[] { '=' };
         string[] strArray3 = str.Split(chArray2);
         if (strArray3.Length > 1)
         {
             if (strArray3[0].CompareTo("Type") == 0)
             {
                 this.Type = (ApolloTokenType)int.Parse(strArray3[1]);
             }
             else if (strArray3[0].CompareTo("Value") == 0)
             {
                 this.Value = ApolloStringParser.ReplaceApolloString(strArray3[1]);
             }
             else if (strArray3[0].CompareTo("Expire") == 0)
             {
                 this.Expire = long.Parse(strArray3[1]);
             }
         }
     }
     return(this);
 }
Example #6
0
 public override ApolloGroupResult FromString(string src)
 {
     char[] separator = new char[] { '&' };
     foreach (string str in src.Split(separator))
     {
         char[]   chArray2  = new char[] { '=' };
         string[] strArray3 = str.Split(chArray2);
         if (strArray3.Length > 1)
         {
             if (strArray3[0].CompareTo("Result") == 0)
             {
                 this.result = (ApolloResult)int.Parse(strArray3[1]);
             }
             else if (strArray3[0].CompareTo("ErrorCode") == 0)
             {
                 this.errorCode = int.Parse(strArray3[1]);
             }
             else if (strArray3[0].CompareTo("szDescription") == 0)
             {
                 this.desc = strArray3[1];
             }
             else if (strArray3[0].CompareTo("GroupInfo") == 0)
             {
                 string str2 = ApolloStringParser.ReplaceApolloString(strArray3[1]);
                 this.groupInfo = new ApolloGroupInfo();
                 this.groupInfo.FromString(str2);
             }
         }
     }
     return(this);
 }
Example #7
0
 public override PictureData FromString(string src)
 {
     string[] array = src.Split(new char[]
     {
         '&'
     });
     string[] array2 = array;
     for (int i = 0; i < array2.Length; i++)
     {
         string   text   = array2[i];
         string[] array3 = text.Split(new char[]
         {
             '='
         });
         if (array3.Length > 1)
         {
             if (array3[0].CompareTo("PicPath") == 0)
             {
                 this.PicPath = ApolloStringParser.ReplaceApolloString(array3[1]);
             }
             else if (array3[0].CompareTo("HashValue") == 0)
             {
                 this.HashValue = ApolloStringParser.ReplaceApolloString(array3[1]);
             }
         }
     }
     this.Dump();
     return(this);
 }
Example #8
0
 internal override bool Pack(out string buffer)
 {
     base.Pack(out buffer);
     buffer = buffer + "&name=" + this.Name;
     buffer = buffer + "&webUrl=" + ApolloStringParser.ReplaceApolloString(this.WebUrl);
     return(true);
 }
Example #9
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 #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);
        }
 internal override bool Pack(out string buffer)
 {
     base.Pack(out buffer);
     buffer = buffer + "&picUrl=" + ApolloStringParser.ReplaceApolloString(this.PicUrl);
     buffer = buffer + "&targetUrl=" + ApolloStringParser.ReplaceApolloString(this.TargetUrl);
     return(true);
 }
Example #12
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 #13
0
 public override ApolloToken FromString(string src)
 {
     string[] array = src.Split(new char[]
     {
         '&'
     }, 1);
     string[] array2 = array;
     for (int i = 0; i < array2.Length; i++)
     {
         string   text   = array2[i];
         string[] array3 = text.Split(new char[]
         {
             '='
         });
         if (array3.Length > 1)
         {
             if (array3[0].CompareTo("Type") == 0)
             {
                 this.Type = (ApolloTokenType)int.Parse(array3[1]);
             }
             else if (array3[0].CompareTo("Value") == 0)
             {
                 this.Value = ApolloStringParser.ReplaceApolloString(array3[1]);
             }
             else if (array3[0].CompareTo("Expire") == 0)
             {
                 this.Expire = long.Parse(array3[1]);
             }
         }
     }
     return(this);
 }
Example #14
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 #15
0
 internal override bool Pack(out string buffer)
 {
     base.Pack(out buffer);
     buffer = buffer + "&url=" + ApolloStringParser.ReplaceApolloString(this.Url);
     buffer = buffer + "&width=" + this.Width;
     buffer = buffer + "&height=" + this.Height;
     return(true);
 }
Example #16
0
        public override ApolloKVPair FromString(string src)
        {
            ApolloStringParser apolloStringParser = new ApolloStringParser(src);

            this.Key   = apolloStringParser.GetString("key");
            this.Value = apolloStringParser.GetString("value");
            return(this);
        }
Example #17
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());
             }
         }
     }
 }
Example #18
0
 public override ApolloAccountInfo FromString(string src)
 {
     Console.WriteLine("ApolloLZK srccc {0}", src);
     char[] separator = new char[] { '&' };
     foreach (string str in src.Split(separator))
     {
         char[]   chArray2  = new char[] { '=' };
         string[] strArray3 = str.Split(chArray2);
         if (strArray3.Length > 1)
         {
             if (strArray3[0].CompareTo("Platform") == 0)
             {
                 this.Platform = (ApolloPlatform)int.Parse(strArray3[1]);
             }
             else if (strArray3[0].CompareTo("OpenId") == 0)
             {
                 this.OpenId = strArray3[1];
             }
             else if (strArray3[0].CompareTo("UserId") == 0)
             {
                 this.UserId = strArray3[1];
             }
             else if (strArray3[0].CompareTo("Uin") == 0)
             {
                 this.Uin = ulong.Parse(strArray3[1]);
             }
             else if (strArray3[0].CompareTo("TokenList") == 0)
             {
                 char[]   chArray3  = new char[] { ',' };
                 string[] strArray4 = strArray3[1].Split(chArray3);
                 this.TokenList.Clear();
                 foreach (string str2 in strArray4)
                 {
                     string      str3 = ApolloStringParser.ReplaceApolloString(ApolloStringParser.ReplaceApolloString(str2));
                     ApolloToken item = new ApolloToken();
                     item.FromString(str3);
                     this.TokenList.Add(item);
                 }
             }
             else if (strArray3[0].CompareTo("Pf") == 0)
             {
                 this.Pf = strArray3[1];
             }
             else if (strArray3[0].CompareTo("PfKey") == 0)
             {
                 this.PfKey = strArray3[1];
             }
             else if (strArray3[0].CompareTo("STKey") == 0)
             {
                 this.STKey = strArray3[1];
             }
         }
     }
     return(this);
 }
Example #19
0
 public override ApolloRelation FromString(string src)
 {
     string[] array = src.Split(new char[]
     {
         '&'
     });
     string[] array2 = array;
     for (int i = 0; i < array2.Length; i++)
     {
         string   text   = array2[i];
         string[] array3 = text.Split(new char[]
         {
             '='
         });
         if (array3.Length > 1)
         {
             if (array3[0].CompareTo("Result") == 0)
             {
                 this.Result = (ApolloResult)int.Parse(array3[1]);
             }
             else if (array3[0].CompareTo("Desc") == 0)
             {
                 this.Desc = array3[1];
             }
             else if (array3[0].CompareTo("InfoList") == 0)
             {
                 this.Persons.Clear();
                 if (!string.IsNullOrEmpty(array3[1]))
                 {
                     string[] array4 = array3[1].Split(new char[]
                     {
                         ','
                     });
                     string[] array5 = array4;
                     for (int j = 0; j < array5.Length; j++)
                     {
                         string src2 = array5[j];
                         string src3 = ApolloStringParser.ReplaceApolloString(src2);
                         src3 = ApolloStringParser.ReplaceApolloString(src3);
                         ApolloPerson apolloPerson = new ApolloPerson();
                         apolloPerson.FromString(src3);
                         this.Persons.Add(apolloPerson);
                     }
                 }
             }
             else if (array3[0].CompareTo("ExtInfo") == 0)
             {
                 this.ExtInfo = array3[1];
             }
         }
     }
     return(this);
 }
Example #20
0
        public override ApolloLoginInfo FromString(string src)
        {
            ApolloStringParser parser = new ApolloStringParser(src);

            this.AccountInfo = parser.GetObject <ApolloAccountInfo>("AccountInfo");
            this.WaitingInfo = parser.GetObject <ApolloWaitingInfo>("WaitingInfo");
            string data = parser.GetString("ServerInfo");

            if (data != null)
            {
                this.ServerInfo = new ApolloServerRouteInfo();
                this.ServerInfo.FromString(data);
            }
            return(this);
        }
Example #21
0
        public override ApolloLoginInfo FromString(string src)
        {
            ApolloStringParser apolloStringParser = new ApolloStringParser(src);

            this.AccountInfo = apolloStringParser.GetObject <ApolloAccountInfo>("AccountInfo");
            this.WaitingInfo = apolloStringParser.GetObject <ApolloWaitingInfo>("WaitingInfo");
            string text = apolloStringParser.GetString("ServerInfo");

            if (text != null)
            {
                text            = ApolloStringParser.ReplaceApolloStringQuto(text);
                this.ServerInfo = new ApolloServerRouteInfo();
                this.ServerInfo.FromString(text);
            }
            return(this);
        }
Example #22
0
        private void OnRouteChangedProc(string msg)
        {
            ulong serverId = new ApolloStringParser(msg).GetUInt64("serverId");

            if (this.RouteChangedEvent != null)
            {
                try
                {
                    this.RouteChangedEvent(serverId);
                }
                catch (Exception exception)
                {
                    ADebug.LogException(exception);
                }
            }
        }
        public T GetObject <T>(string objName) where T : ApolloStruct <T>
        {
            if (objName == null || this.objectCollection.get_Count() == 0)
            {
                return((T)((object)null));
            }
            T result = (T)((object)null);

            if (this.objectCollection.ContainsKey(objName))
            {
                result = (T)((object)Activator.CreateInstance(typeof(T)));
                string src = this.objectCollection.get_Item(objName);
                src    = ApolloStringParser.ReplaceApolloString(src);
                result = (T)((object)result.FromString(src));
            }
            return(result);
        }
 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 #25
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);
                }
            }
        }
 private void OnShareNotify(string msg)
 {
     if (msg.get_Length() > 0)
     {
         ApolloStringParser apolloStringParser = new ApolloStringParser(msg);
         ApolloShareResult  @object            = apolloStringParser.GetObject <ApolloShareResult>("ShareResult");
         if (this.onShareEvent != null)
         {
             try
             {
                 this.onShareEvent(@object);
             }
             catch (Exception ex)
             {
                 ADebug.Log("onShareEvent:" + ex);
             }
         }
     }
 }
Example #27
0
 private void OnLocationGotNotify(string msg)
 {
     if (msg.get_Length() > 0)
     {
         ApolloStringParser apolloStringParser = new ApolloStringParser(msg);
         ApolloLocation     @object            = apolloStringParser.GetObject <ApolloLocation>("Location");
         if (this.onLocationGotEvent != null)
         {
             try
             {
                 this.onLocationGotEvent(@object);
             }
             catch (Exception ex)
             {
                 ADebug.Log("onLocationGotEvent:" + ex);
             }
         }
     }
 }
Example #28
0
 private void OnShareNotify(string msg)
 {
     if (msg.Length > 0)
     {
         ApolloStringParser parser            = new ApolloStringParser(msg);
         ApolloShareResult  shareResponseInfo = null;
         shareResponseInfo = parser.GetObject <ApolloShareResult>("ShareResult");
         if (this.onShareEvent != null)
         {
             try
             {
                 this.onShareEvent(shareResponseInfo);
             }
             catch (Exception exception)
             {
                 ADebug.Log("onShareEvent:" + exception);
             }
         }
     }
 }
Example #29
0
 private void OnQueryGroupKeyNotify(string msg)
 {
     ADebug.Log("OnQueryGroupKeyNotify");
     if (msg.get_Length() > 0)
     {
         ApolloStringParser apolloStringParser = new ApolloStringParser(msg);
         ApolloGroupResult  @object            = apolloStringParser.GetObject <ApolloGroupResult>("GroupResult");
         if (this.onQueryGroupKeyEvent != null)
         {
             try
             {
                 this.onQueryGroupKeyEvent(@object);
             }
             catch (Exception ex)
             {
                 ADebug.Log("OnQueryGroupKeyNotify:" + ex);
             }
         }
     }
 }
Example #30
0
 private void OnLocationNotify(string msg)
 {
     if (msg.Length > 0)
     {
         ApolloStringParser parser    = new ApolloStringParser(msg);
         ApolloRelation     aRelation = null;
         aRelation = parser.GetObject <ApolloRelation>("Relation");
         if (this.onLocationEvent != null)
         {
             try
             {
                 this.onLocationEvent(aRelation);
             }
             catch (Exception exception)
             {
                 ADebug.Log("onLocationEvent:" + exception);
             }
         }
     }
 }