예제 #1
0
 public P2PConfig(string ep, Proto.ProtoFolderList list, int SelectIndex)
 {
     This = this;
     InitializeComponent();
     InitEndpoint(ep);
     InitFileTree(list);
     InitOnlineList();
     RobotInfoCollect.GetInstance().AppendInitFileList(ep);
     listBoxIP.Focus();
     listBoxIP.SelectedIndex = SelectIndex;
 }
예제 #2
0
        //初始化文件树
        public void   InitFileTree(Proto.ProtoFolderList list)
        {
            String dirLocal = null;

            Tool.Setting.ConfigRead.ReadLocalDir(ref dirLocal);
            if (dirLocal == null)
            {
                return;
            }
            string pathLocal = dirLocal;

            String dirFolderSet;
            int    posStart = pathLocal.IndexOf("standard");

            dirFolderSet = pathLocal.Substring(0, posStart);

            string pathSet = dirFolderSet + "FolderSet";

            if (Directory.Exists(pathSet))
            {
                FileOperator.DelectDir(pathSet);
            }

            FileOperator.CopyDir(pathLocal, pathSet);

            for (int i = 0; i < list.FolderList.Count; i++)
            {
                string path = pathSet + list.FolderList[i].FolderName.value_;

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
            }


            FolderTree.Items.Clear();

            TreeViewItem Nodes = new TreeViewItem()
            {
                Header = CreateTreeViewItemFolder(ip, "")
            };

            Nodes.ExpandSubtree();
            GetDirectoriesList(pathSet, Nodes);
            FolderTree.Items.Add(Nodes);
        }
예제 #3
0
        private void OnClickConfigPage(object sender, MouseButtonEventArgs e)
        {
            TextBlock text  = sender as TextBlock;
            string    ftsIP = text.Tag.ToString();

            Int32 retval = -1;

            Proto.ProtoFolderList folderList = new Proto.ProtoFolderList();
            this.WaitEvent(() =>
            {
                unsafe
                {
                    void *r_data = null;
                    int r_len    = 0;
                    retval       = NetInterface.NetGetRomoteListDir(ftsIP, "./", &r_data, &r_len);

                    byte[] ack_msg = null;

                    ack_msg = new byte[r_len];
                    using (UnmanagedMemoryStream ms = new UnmanagedMemoryStream((byte *)r_data, r_len))
                    {
                        ms.Read(ack_msg, 0, ack_msg.Length);
                    }

                    Tool.Proto.Unpackage <Proto.ProtoFolderList> list = new Proto.Unpackage <Proto.ProtoFolderList>(ack_msg);
                    if (list.build())
                    {
                        folderList = list.ob;
                    }
                    NetInterface.FreeDetail(r_data);
                }
            }, true, true);

            if (retval < 0)
            {
                string str = string.Format("获取文件信息失败,错误码:{0}", retval);
                this.ShowNotify(str, "错误");
                return;
            }
            Tool.MainWindow.This.NaviToPageConfig(ftsIP, folderList, 0);
        }
예제 #4
0
        private void ChangeCarList(string ftsEndPoint, int SelectIndex)
        {
            Int32 retval = -1;

            Proto.ProtoFolderList folderList = new Proto.ProtoFolderList();
            this.WaitEvent(() =>
            {
                unsafe
                {
                    void *r_data = null;
                    int r_len    = 0;
                    retval       = NetInterface.NetGetRomoteListDir(ftsEndPoint, "./", &r_data, &r_len);

                    byte[] ack_msg = null;

                    ack_msg = new byte[r_len];
                    using (UnmanagedMemoryStream ms = new UnmanagedMemoryStream((byte *)r_data, r_len))
                    {
                        ms.Read(ack_msg, 0, ack_msg.Length);
                    }

                    Tool.Proto.Unpackage <Proto.ProtoFolderList> list = new Proto.Unpackage <Proto.ProtoFolderList>(ack_msg);
                    if (list.build())
                    {
                        folderList = list.ob;
                    }
                    NetInterface.FreeDetail(r_data);
                }
            }, true, true);

            if (retval < 0)
            {
                string str = string.Format("获取文件信息失败,错误码:{0}", retval);
                this.ShowNotify(str, "错误");
                return;
            }
            Tool.MainWindow.This.NaviToPageConfig(ftsEndPoint, folderList, SelectIndex);
        }