Example #1
0
        // 文件修改被触发两次
        public void Changed(object source, FileSystemEventArgs e)
        {
            _mainForm.Log("id[" + id + "]文件改变事件处理逻辑 " + e.ChangeType + e.FullPath);

            if (!IsSyn(e.FullPath))
            {
                return;
            }

            string linuxPath = e.FullPath.Replace(GetWindowsPath(), _linux_root_path);

            linuxPath = linuxPath.Replace("\\", "/");

            int index = linuxPath.LastIndexOf("/");

            if (index >= 0)
            {
                linuxPath = linuxPath.Substring(0, index);
            }
            _synFiles.SynFile(e.FullPath, linuxPath);
            Log("id[" + id + "]同步文件:" + e.FullPath + "->" + linuxPath);
            Log(Environment.NewLine);
            Log(Environment.NewLine);
        }
Example #2
0
        void SynListViewFile()
        {
            foreach (ListViewItem item in this.lvTask.Items)
            {
                string fileFullPath = item.Tag as string;
                string linuxDir     = item.SubItems[1].Text;

                // 判断文件有没有被修改
                if (!IsChange(fileFullPath))
                {
                    continue;
                }

                _synFiles.SynFile(fileFullPath, linuxDir);             // 同步此文件
            }
        }