Exemplo n.º 1
0
 public void Send(PKG pkg)
 {
     if (mNetInterface != null)
     {
         mNetInterface.Send(pkg.GetBytes());
     }
 }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="asName"></param>
        /// <returns></returns>
        public override QView As(string asName)
        {
            this.AsName = asName;

            PKG.As(asName);
            SRC.As(asName);

            return(this);
        }
Exemplo n.º 3
0
    public void Dispatch(byte[] msg)
    {
        PKG pkg = GetPKG <PKG>(msg);

        switch (pkg.opcode)
        {
        case OPCODE.ID.ClientLogin:
        {
            switch ((OPCODE.ClientLoginType)pkg.childid)
            {
            case OPCODE.ClientLoginType.RtGameServerInfo:
            {
                ClientToLogin_RtGameServerInfo cmd = GetPKG <ClientToLogin_RtGameServerInfo>(msg);

                LoginParam param = new LoginParam();
                param.user = mLoginParam.user;
                param.psw  = mLoginParam.psw;
                param.host = cmd.host;
                param.port = cmd.port;

                ConnectGameServer(param);
            }
            break;
            }
        }
        break;

        case OPCODE.ID.CenterClient:
        {
            switch ((OPCODE.CenterClientType)pkg.childid)
            {
            case OPCODE.CenterClientType.RtAccount:
            {
            }
            break;

            case OPCODE.CenterClientType.RtLogin:
            {
                rtLoginGame cmd = GetPKG <rtLoginGame>(msg);

                if (cmd.errorCode == LoginErrorCode.Sucessed)
                {
                    Debug.Log("Server=>Connected game server successfully!");
                }
            }
            break;
            }
        }
        break;
        }
    }
Exemplo n.º 4
0
        public void loadrepo()
        {
            repo.Enabled     = false;
            packages.Enabled = false;
            loading_done     = false;
            loading_errors   = "";
            loading_warnings = "";

            toaddlist = new List <PKG>();
            packages.Items.Clear();
            packages_search.Items.Clear();
            loading_monitor.Enabled = true;

            lval            = 25;
            loading.Value   = 25;
            loading.Visible = true;

            new Task(() =>
            {
                log("Loading repo: " + repo.Text + "(" + DateTime.Now + ")");
                PKG temppkg = new PKG();
                //packages.Columns.Clear();
                //packages_search.Columns.Clear();
                RichTextBox temp = new RichTextBox();
                currentrepo      = repo.Text;
                //MessageBox.Show(test.DownloadString("https://whoer.net/"));
                clean_temp();
                if (currentrepo.ToLower().Contains("bigboss"))
                {
                    //MessageBox.Show("Hotfixed thebigboss, press OK to start.");
                    if (downloadpackagefile("http://apt.thebigboss.org/repofiles/cydia/dists/stable/main/binary-iphoneos-arm/") == false)
                    {
                        loading_errors = "Could not download Package file.";
                        loading_done   = true;
                        return;
                    }
                }
                else
                {
                    if (downloadpackagefile(currentrepo) == false)
                    {
                        loading_errors = "Could not download Package file.";
                        loading_done   = true;
                        return;
                    }
                }
                lval = 70;
                foreach (string lijn in packagefile)
                {
                    if (lijn == "")
                    {
                        //addpackage();
                        //toadd = empty;
                        //toaddcount = 0;
                        if (temppkg.package != "" && temppkg.version != "" && temppkg.name != "" && temppkg.filename != "")
                        {
                            // MessageBox.Show("Adding pkg:" + temppkg.Package);

                            /*
                             *  bool found = false;
                             *  foreach(PKG tmpcheck in toaddlist)
                             *  {
                             *      if(tmpcheck.package == temppkg.package)
                             *      {
                             *          tmpcheck.versions.Add(temppkg.version);
                             *          found = true;
                             *          break;
                             *      }
                             *  }
                             * if (found == false)
                             * {*/
                            toaddlist.Add(temppkg);
                            //}
                        }
                        temppkg = new PKG();
                        //MessageBox.Show("Done");
                        //return;
                    }
                    else
                    {
                        //toaddcount++;
                        try
                        {
                            if (lijn.Replace(": ", ":").Split(':')[0].ToLower() == "package")
                            {
                                temppkg.package = lijn.Replace(": ", ":").Split(':')[1];
                            }
                            else if (lijn.Replace(": ", ":").Split(':')[0].ToLower() == "version")
                            {
                                temppkg.version = lijn.Replace(": ", ":").Split(':')[1];
                            }
                            else if (lijn.Replace(": ", ":").Split(':')[0].ToLower() == "name")
                            {
                                temppkg.name = lijn.Replace(": ", ":").Split(':')[1];
                            }
                            else if (lijn.Replace(": ", ":").Split(':')[0].ToLower() == "filename")
                            {
                                temppkg.filename = lijn.Replace(": ", ":").Split(':')[1];
                            }
                        }
                        catch (Exception)
                        {
                            loading_warnings += "[Failed parsing] : " + lijn + "\r\nSkipped\r\n";
                        }
                        //MessageBox.Show("Found line");
                    }
                }
                //Hotfix/
                lval = 90;
                if (temppkg.package != "" && temppkg.version != "" && temppkg.name != "" && temppkg.filename != "")
                {
                    // MessageBox.Show("Adding pkg:" + temppkg.Package);
                    toaddlist.Add(temppkg);
                }
                if (currentrepo.ToLower().Contains("bigboss"))
                {
                    currentrepo = "http://apt.thebigboss.org/repofiles/cydia/";
                }
                loading_done = true;
            }).Start();
        }
Exemplo n.º 5
0
 public T GetPKG <T>(byte[] msg) where T : PKG
 {
     return((T)PKG.BytesToStruct(msg, msg.Length, typeof(T)));
 }
Exemplo n.º 6
0
        public static void SaveAs(string filename)
        {
            FileInfo fi = new FileInfo(filename);

            PKG.SaveAs(fi);
        }