private void _CreateDir_Click(object sender, EventArgs e) { NewDir tmp = new NewDir(); tmp.ShowDialog(); if (!string.IsNullOrEmpty(tmp.DirName)) { string fullname = CurrentDir + tmp.DirName; if (CurrentDir[CurrentDir.Length - 1] != '\\') { fullname = CurrentDir + "\\" + tmp.DirName; } PackHandler.NewDir ndir = new PackHandler.NewDir() { DirName = fullname }; SocketManager.Send(BufferFormatV2.FormatFCA(ndir, Deflate.Compress)); } }
private void UpFileEx(string cudir, string name) { FileInfo file = new FileInfo(name); if (file.Exists) { FileStream stream = new FileStream(name, FileMode.Open, FileAccess.Read); Re: long key = DateTime.Now.Ticks; if (UpFileList.ContainsKey(key)) { System.Threading.Thread.Sleep(1); goto Re; } UpFileList.Add(key, stream); string upfilename = System.IO.Path.Combine(cudir, file.Name); UpFile upfile = new UpFile() { FullName = upfilename, Size = stream.Length, UpKey = key, }; SocketManager.Send(BufferFormatV2.FormatFCA(upfile, Deflate.Compress)); } else { DirectoryInfo dir = new DirectoryInfo(name); if (dir.Exists) { string fullname = System.IO.Path.Combine(cudir, dir.Name); PackHandler.NewDir ndir = new PackHandler.NewDir() { DirName = fullname }; SocketManager.Send(BufferFormatV2.FormatFCA(ndir, Deflate.Compress)); foreach (var item in dir.GetFileSystemInfos()) { UpFileEx(fullname, item.FullName); } } } }
private void _CreateDir_Click(object sender, EventArgs e) { NewDir tmp = new NewDir(); tmp.ShowDialog(); if (!string.IsNullOrEmpty(tmp.DirName)) { string fullname = System.IO.Path.Combine(CurrentDir, tmp.DirName); PackHandler.NewDir ndir = new PackHandler.NewDir() { DirName = fullname }; SocketManager.Send(BufferFormatV2.FormatFCA(ndir, Deflate.Compress)); } }
private void _CreateDir_Click(object sender, EventArgs e) { NewDir tmp = new NewDir(); tmp.ShowDialog(); if (!string.IsNullOrEmpty(tmp.DirName)) { string fullname = CurrentDir + tmp.DirName; if(CurrentDir[CurrentDir.Length-1]!='\\') fullname = CurrentDir+"\\"+ tmp.DirName; PackHandler.NewDir ndir = new PackHandler.NewDir() { DirName = fullname }; SocketManager.Send(BufferFormatV2.FormatFCA(ndir, Deflate.Compress)); } }
private void UpFileEx(string cudir,string name) { FileInfo file = new FileInfo(name); if (file.Exists) { FileStream stream = new FileStream(name, FileMode.Open, FileAccess.Read); Re: long key = DateTime.Now.Ticks; if (UpFileList.ContainsKey(key)) { System.Threading.Thread.Sleep(1); goto Re; } UpFileList.Add(key, stream); string upfilename = System.IO.Path.Combine(cudir,file.Name); UpFile upfile = new UpFile() { FullName = upfilename, Size = stream.Length, UpKey = key, }; SocketManager.Send(BufferFormatV2.FormatFCA(upfile, Deflate.Compress)); } else { DirectoryInfo dir = new DirectoryInfo(name); if (dir.Exists) { string fullname =System.IO.Path.Combine(cudir,dir.Name); PackHandler.NewDir ndir = new PackHandler.NewDir() { DirName = fullname }; SocketManager.Send(BufferFormatV2.FormatFCA(ndir, Deflate.Compress)); foreach (var item in dir.GetFileSystemInfos()) { UpFileEx(fullname, item.FullName); } } } }