command Unupbyte(myreceivebitobj funobj)
        {
            try
            {
lb0x99:
                int bytesRead = alldata.Length;

                if (bytesRead == 0)
                {
                    return(null);
                }

                byte[] tempbtye = new byte[bytesRead];

                Array.Copy(alldata, tempbtye, tempbtye.Length);


                if (bytesRead > 2)
                {
                    int a = tempbtye[1];
                    if (a == 0)
                    {
                    }
                    if (bytesRead > 4 + a)
                    {
                        int len = 0;

                        byte[] bbcrc = new byte[4 + a];
                        Array.Copy(tempbtye, 0, bbcrc, 0, 4 + a);
                        if (CRC.DataCRC(ref bbcrc, 4 + a))
                        {
                            byte[] bb = new byte[a];
                            Array.Copy(tempbtye, 2, bb, 0, a);
                            len = ConvertToInt(bb);
                        }
                        else
                        {
                            byte[] temps = new byte[tempbtye.Length - 1];
                            Array.Copy(tempbtye, 1, temps, 0, temps.Length);
                            alldata = temps;
                            //return;
                            goto lb0x99;
                        }
                        try
                        {
                            if ((len + 4 + a) > tempbtye.Length)
                            {
                                return(null);
                            }
                            else if (tempbtye.Length > (len + 4 + a))
                            {
                                byte[] temps = new byte[tempbtye.Length - (len + 4 + a)];
                                Array.Copy(tempbtye, (len + 4 + a), temps, 0, temps.Length);
                                alldata = temps;
                                //return;
                                //  goto lb0x99;
                            }
                            else if (tempbtye.Length == (len + 4 + a))
                            {
                                alldata = new byte[0];
                            }
                        }
                        catch (Exception e)
                        {
                            // ErrorMge?.Invoke(3, e.StackTrace + "unup001:" + e.Message + "2 + a" + 2 + a + "---len" + len + "--tempbtye" + tempbtye.Length);
                            alldata = new byte[0];
                        }
                        try
                        {
                            byte[] bs = new byte[len];
                            Array.Copy(tempbtye, (4 + a), bs, 0, bs.Length);
                            if (tempbtye[0] == 0x99)
                            {
                                return(null);
                            }

                            funobj?.Invoke(tempbtye[0], bs, this);
                            command command = new command();
                            command.comand = tempbtye[0];
                            command.data   = bs;
                            if (command.comand == 0)
                            {
                            }
                            return(command);
                        }
                        catch (Exception e)
                        {
                            //  ErrorMge?.Invoke(3, e.StackTrace + "unup122:" + e.Message);
                            alldata = new byte[0];
                        }
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                alldata = new byte[0];
                return(null);
            }
            return(null);
        }