Exemplo n.º 1
0
        private void OnUpdateShellBatch(object sender, RoutedEventArgs e)
        {
            string list = null;

            foreach (string ep in SelectRobotInfoList)
            {
                if (!Tool.RobotsHome.RobotInfoCollect.GetInstance().IsConnectedHost(ep))
                {
                    continue;
                }
                list += Tool.RobotsHome.RobotInfoCollect.GetInstance().FindNetId(ep) + "|";
            }

            if (null == list)
            {
                this.ShowNotify("请选择需要一键升级的车辆", "提示");
                return;
            }

            Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog();
            ofd.DefaultExt = ".tar";
            ofd.Filter     = "tar file|*.tar";
            ofd.ShowDialog();

            if (ofd.FileName == string.Empty)
            {
                return;
            }

            NetInterface.NetUpdateAgvShell(list, ofd.FileName);
            WinShellProcessPercService.Show(this);
        }
Exemplo n.º 2
0
        ////////////////////////////////备份文件操作///////////////////////////////////
        private void BackUpFiles(List <string> list)
        {
            System.Windows.Forms.FolderBrowserDialog folder = new System.Windows.Forms.FolderBrowserDialog();

            folder.ShowDialog();

            if ("" == folder.SelectedPath)
            {
                return;
            }


            Tool.Proto.ProtoBackup Msg = new Proto.ProtoBackup();
            Msg.MSG.value_ = folder.SelectedPath;

            foreach (string ep in list)
            {
                if (ep == String.Empty)
                {
                    continue;
                }
                if (!Tool.RobotsHome.RobotInfoCollect.GetInstance().IsConnectedHost(ep))
                {
                    continue;
                }
                int net_id = Tool.RobotsHome.RobotInfoCollect.GetInstance().FindNetId(ep);
                int car_id = Tool.RobotsHome.RobotInfoCollect.GetInstance().FindCarId(ep);
                Tool.Proto.ProtoObj value = new Proto.ProtoObj();
                value.ID.value_    = net_id;
                value.CarID.value_ = car_id;
                Msg.ObjList.Add(value);
            }

            byte[] b_msg  = new byte[Msg.length()];
            Int32  offset = 0;

            Msg.serialize(b_msg, ref offset);

            unsafe
            {
                fixed(byte *l_msg = b_msg)
                {
                    NetInterface.NetPostBackupFile(l_msg, Msg.length());
                }
            }

            WinShellProcessPercService.Show(this);
        }