Ejemplo n.º 1
0
        /*******************************主程序函数****************************************************/
        //握手协议
        private void processfind()
        {
            DissableEnableAll(false);
            byte[]  data;
            REQTYPE type;

            byte[] ret;
            byte[] temp = Utils.getRadomByte();
            byte[] key  = new byte[2];
            key[0] = (byte)~temp[0];
            key[1] = (byte)~temp[1];
            key    = Utils.changeHigh(key);
            Utils.dumpdata(key, 2, "key after");
            int status;

            data = sendReceive(ProtocolControl.Packrequest(REQTYPE.FIND, temp), out status);
            if (data == null || data.Length == 0)
            {
                return;
            }
            ret = UnpackHandShake(data, out type);
            if (ret != null && ret.Length > 0)
            {
                Utils.dumpdata(ret, ret.Length, "unpack");
                if (ret[0] == key[0] && ret[1] == key[1])
                {
                    Console.WriteLine("find machine");
                    if (type == REQTYPE.LOCALUPDATE)
                    {
                        Console.WriteLine("start local update");
                        LocalUpdateForm d = new LocalUpdateForm();
                        d.ShowDialog();
                        m_HasMachine = true;
                        timer1.Stop();
                    }
                }
                else
                {
                    if (type == REQTYPE.LOCALUPDATE)
                    {
                        Console.WriteLine("start local update");
                    }
                    Console.WriteLine("not found machine");
                }

                DissableEnableAll(true);
            }
        }
Ejemplo n.º 2
0
        private void 本地更新ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LocalUpdateForm upd = new LocalUpdateForm();

            upd.ShowDialog();
        }