Esempio n. 1
0
        /// <summary>
        /// 处理数据包
        /// </summary>
        /// <param name="data">捕获的数据包</param>
        private void ProcessData(object data)
        {
            Session s = data as Session;

            if (s.Request.PathAndQuery.IndexOf("/api/v1/") != -1)
            {
                PacketHelper.ProcessPacket(s);
            }
            else if (DataUtil.Game.gameServer == (int)GameInfo.ServersList.Japan || DataUtil.Game.gameServer == (int)GameInfo.ServersList.JapanR18 ||
                     DataUtil.Game.gameServer == (int)GameInfo.ServersList.TradChinese || DataUtil.Game.gameServer == (int)GameInfo.ServersList.TradChineseR18)
            {
                if (s.Request.PathAndQuery.IndexOf("/social/rpc") != -1)
                {
                    PacketHelper.ProcessPacket(s);
                    if (DataUtil.Config.sysConfig.showLoginNews && !newsHadShown)
                    {
                        newsHadShown = true;
                        this.Dispatcher.Invoke(new Action(() =>
                        {
                            NewsWindow news = new NewsWindow();
                            news.Show();
                        }));
                    }
                    this.Dispatcher.Invoke(new Action(() =>
                    {
                        btnNews.Visibility = Visibility.Visible;
                    }));
                }

                /*else if (s.Request.PathAndQuery.IndexOf("/news/news_") != -1 && s.Request.PathAndQuery.IndexOf(".html?") != -1)
                 * {
                 *  if (DataUtil.Config.sysConfig.showLoginNews && !newsHadShown)
                 *  {
                 *      newsHadShown = true;
                 *      this.Dispatcher.Invoke(new Action(() =>
                 *      {
                 *          NewsWindow news = new NewsWindow();
                 *          news.Show();
                 *      }));
                 *  }
                 *  this.Dispatcher.Invoke(new Action(() =>
                 *  {
                 *      btnNews.Visibility = Visibility.Visible;
                 *  }));
                 * }*/
            }
            else if (DataUtil.Game.gameServer == (int)GameInfo.ServersList.American || DataUtil.Game.gameServer == (int)GameInfo.ServersList.AmericanR18)
            {
                if (s.Request.PathAndQuery.IndexOf("/rpc?st=") != -1)
                {
                    PacketHelper.ProcessPacket(s);
                    if (DataUtil.Config.sysConfig.showLoginNews && !newsHadShown)
                    {
                        newsHadShown = true;
                        this.Dispatcher.Invoke(new Action(() =>
                        {
                            NewsWindow news = new NewsWindow();
                            news.Show();
                        }));
                    }
                    this.Dispatcher.Invoke(new Action(() =>
                    {
                        btnNews.Visibility = Visibility.Visible;
                    }));
                }

                /*else if (s.Request.PathAndQuery.IndexOf("/news/news_") != -1 && s.Request.PathAndQuery.IndexOf(".html?") != -1 && s.Request.RequestLine.URI.IndexOf("http") != -1)
                 * {
                 *  if (DataUtil.Config.sysConfig.showLoginNews && !newsHadShown)
                 *  {
                 *      newsHadShown = true;
                 *      this.Dispatcher.Invoke(new Action(() =>
                 *      {
                 *          NewsWindow news = new NewsWindow();
                 *          news.Show();
                 *      }));
                 *  }
                 *  this.Dispatcher.Invoke(new Action(() =>
                 *  {
                 *      btnNews.Visibility = Visibility.Visible;
                 *  }));
                 * }*/
            }
        }
Esempio n. 2
0
        private void btnNews_Click(object sender, RoutedEventArgs e)
        {
            NewsWindow news = new NewsWindow();

            news.Show();
        }