Esempio n. 1
0
 public override void OnReceived(Packet thePacket)
 {
     Logger.DEBUG(string.Empty);
     try
     {
         string text    = Convert.ToBase64String(thePacket.theContent, 4, thePacket.theContent.Length - 4);
         string text2   = MinizLib.UnCompress(text.get_Length(), text);
         byte[] array   = Convert.FromBase64String(text2);
         string @string = Encoding.get_UTF8().GetString(array);
         Logger.DEBUG(@string);
         Message message = new Message();
         message.status  = 0;
         message.content = (Json.Deserialize(@string) as Dictionary <string, object>);
         message.action  = this.packetRecvdAction;
         Pandora.Instance.GetNetLogic().EnqueueResult(message);
     }
     catch (Exception ex)
     {
         Logger.ERROR(ex.get_StackTrace());
     }
 }
Esempio n. 2
0
 private void ParseActData()
 {
     try
     {
         string text    = Convert.ToBase64String(this.receivedByte, 4, this.receivedByte.Length - 4);
         string text2   = MinizLib.UnCompress(text.get_Length(), text);
         byte[] array   = Convert.FromBase64String(text2);
         string @string = Encoding.get_UTF8().GetString(array);
         Debug.Log(@string);
         Dictionary <string, object> dictionary = new Dictionary <string, object>();
         dictionary = (Json.Deserialize(@string) as Dictionary <string, object>);
         if (dictionary != null && dictionary.ContainsKey("body"))
         {
             string text3 = dictionary.get_Item("body") as string;
             Debug.Log(text3);
             Dictionary <string, object> dictionary2 = new Dictionary <string, object>();
             dictionary2 = (Json.Deserialize(text3) as Dictionary <string, object>);
             if (dictionary2 != null && dictionary2.ContainsKey("ret"))
             {
                 Debug.Log(string.Empty);
                 string text4 = dictionary2.get_Item("ret").ToString();
                 if (text4.Equals("0") && dictionary2.ContainsKey("resp"))
                 {
                     string text5 = dictionary2.get_Item("resp") as string;
                     Debug.Log(text5);
                     Dictionary <string, object> dictionary3 = new Dictionary <string, object>();
                     dictionary3 = (Json.Deserialize(text5) as Dictionary <string, object>);
                     if (dictionary3 != null && dictionary3.ContainsKey("body"))
                     {
                         string text6 = dictionary3.get_Item("body") as string;
                         Debug.Log(text6);
                         Dictionary <string, object> dictionary4 = new Dictionary <string, object>();
                         dictionary4 = (Json.Deserialize(text6) as Dictionary <string, object>);
                         if (dictionary4 != null && dictionary4.ContainsKey("online_msg_info"))
                         {
                             Dictionary <string, object> dictionary5 = dictionary4.get_Item("online_msg_info") as Dictionary <string, object>;
                             if (dictionary5 != null && dictionary5.ContainsKey("act_list"))
                             {
                                 List <object> list = dictionary5.get_Item("act_list") as List <object>;
                                 using (List <object> .Enumerator enumerator = list.GetEnumerator())
                                 {
                                     while (enumerator.MoveNext())
                                     {
                                         object current = enumerator.get_Current();
                                         Dictionary <string, object> dictionary6 = current as Dictionary <string, object>;
                                         if (dictionary6 != null && dictionary6.ContainsKey("jump_url") && !string.IsNullOrEmpty(dictionary6.get_Item("jump_url").ToString()))
                                         {
                                             Debug.Log("获取到Url: " + dictionary6.get_Item("jump_url").ToString());
                                             this.urlList.Add(dictionary6.get_Item("jump_url").ToString());
                                         }
                                     }
                                 }
                                 if (list.get_Count() > 0)
                                 {
                                     this.NotifyShowZone(true);
                                 }
                                 else
                                 {
                                     this.NotifyShowZone(false);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         this.NotifyShowZone(false);
         Debug.Log(ex.get_StackTrace());
     }
 }