コード例 #1
0
 public override void Process()
 {
     if (SceneManager.Inst.CurScene.Equals(SceneEntry.Home.ToString()))
     {
         //TODO
         CExchange exchange = new CExchange();
         exchange.uid       = MainGameControler.Inst.mPlatId;
         exchange.token     = MainGameControler.Inst.mToken;
         exchange.billid    = this.billid;
         exchange.goodsid   = this.goodid;
         exchange.goodsname = this.goodname;
         exchange.goodsnum  = this.goodnum;
         exchange.price     = this.price;
         exchange.zoneid    = this.zoneid;
         IOControler.GetInstance().SendPlatform(exchange);
     }
 }
コード例 #2
0
        //VVVVVVVVVVVVV    Для передачи 8-битных данных как 7-битных    VVVVVVVVVVV
        private void B8n1To7e1_Click(object sender, EventArgs e)
        {
            //int iLastLine = TB8n1To7e1.Lines.Count () - 1;
            string asStr = GV8n1To7e1.CurrentRow.Cells[0].Value.ToString();

            byte[] btaStr;
            if (ChDataAsHex.Checked)                        // Данные в виде hex цифры
            {
                btaStr = StrHexToBytes(asStr);              // Строка остаётся неизменной
            }
            else                                            // Данные в виде строки
            {
                byte[] bta = Global.EncodingCurr.GetBytes(asStr.Substring(1, asStr.Length - 2));
                btaStr    = new byte[2 + bta.Length];
                btaStr[0] = Convert.ToByte(asStr[0]);                   // Вставляем 1-е число команды
                //btaStr[btaStr.Length - 1] = Convert.ToByte (asStr.Substring(asStr.Length - 2)); // Вставляем последнее число команды RESTORE?
                Global.Append(bta, 0, btaStr, 1, bta.Length);
            }
            int  iQuantData     = btaStr.Length;
            bool bAppendEndLine = btaStr[iQuantData - 1] == (byte)'\\';            // Какое число для \  ?

            if (bAppendEndLine)
            {               // Вставляем символы перевода каретки и конца строки, если в конце было два \\ 
                if (CB7bit.Checked)
                {
                    btaStr[iQuantData - 2] = 0x8D;
                }
                else
                {
                    btaStr[iQuantData - 2] = 0xD;
                }
                btaStr[iQuantData - 1] = 0xA;
            }
            string asBCC = "";

            if (ChCalcBCC.Checked)
            {
                byte btBCC = CExchange.CalcBCC(btaStr, 0, btaStr.Length);
                //byte btBCC = CExchange.CalcBCC (btaStr, 4, btaStr.Length - 4);
                if (CB7bit.Checked)
                {
                    btBCC = Global._7e1_to_8n1[btBCC];
                }
                asBCC = Convert.ToString(btBCC, 16);
            }
            if (CB7bit.Checked)
            {
                Global.Conv8n1To7e1(btaStr, (ushort)(iQuantData));
            }
            ;

            asStr = Global.ByteArToStr(btaStr, 0, btaStr.Length) + asBCC;
            Clipboard.SetText(asStr);
            GV8n1To7e1.CurrentRow.Cells[1].Value = asStr;

            // Запоминаем на века данные
            string asRes = "";

            foreach (DataGridViewRow item in GV8n1To7e1.Rows)
            {
                asRes += item.Cells[0].Value + ";" + item.Cells[1].Value + ";";
            }
            Properties.Settings.Default.as8n1To7e1 = asRes.Substring(0, asRes.Length - 1);
        }