public int ClientRun(ClientInfo cInfo, int pid, string[] args) { Options options = cInfo.Options; IOStream f = cInfo.IoStream; FileList fList; ArrayList fileList; MainClass.SetupProtocol(cInfo); if(options.protocolVersion >= 23 && !options.readBatch) f.IOStartMultiplexIn(); if(options.amSender) { f.IOStartBufferingOut(); if (options.deleteMode && !options.deleteExcluded) { Exclude excl = new Exclude(options); excl.SendExcludeList(f); } if (options.verbose > 3) Log.Write("File list sent\n"); f.Flush(); fList = new FileList(options); fileList = fList.sendFileList(cInfo, args); if(options.verbose > 3) Log.WriteLine("file list sent"); f.Flush(); Sender sender = new Sender(options); sender.SendFiles(fileList, cInfo); f.Flush(); f.writeInt(-1); return -1; } options.dir = args[0]; if(options.dir.CompareTo("") != 0 && options.dir.IndexOf(':') == -1) { if(options.dir[0] == '/') options.dir = "c:" + options.dir; else if(options.dir.IndexOf('/') != -1) { options.dir = options.dir.Insert(options.dir.IndexOf('/') - 1,":"); } } if(!options.readBatch) { Exclude excl = new Exclude(options); excl.SendExcludeList(f); } fList = new FileList(options); fileList = fList.receiveFileList(cInfo); return Daemon.DoReceive(cInfo,fileList,null); }
static void DoServerSender(ClientInfo clientInfo, string[] args) { string dir = args[0]; IOStream ioStream = clientInfo.IoStream; Options options = clientInfo.Options; if (options.verbose > 2) { Log.Write("Server sender starting"); } if (options.amDaemon && config.ModuleIsWriteOnly(options.ModuleId)) { MainClass.Exit("ERROR: module " + config.GetModuleName(options.ModuleId) + " is write only", clientInfo); return; } if (!options.relativePaths && !Util.pushDir(dir)) { MainClass.Exit("Push_dir#3 " + dir + "failed", clientInfo); return; } FileList fList = new FileList(options); List <FileStruct> fileList = fList.sendFileList(clientInfo, args); if (options.verbose > 3) { Log.WriteLine("File list sent"); } if (fileList.Count == 0) { MainClass.Exit("File list is empty", clientInfo); return; } ioStream.IOStartBufferingIn(); ioStream.IOStartBufferingOut(); Sender sender = new Sender(options); sender.SendFiles(fileList, clientInfo); ioStream.Flush(); MainClass.Report(clientInfo); if (options.protocolVersion >= 24) { ioStream.readInt(); } ioStream.Flush(); }
public void DeleteFiles(List <FileStruct> fileList) { string[] argv = new string[1]; List <FileStruct> localFileList = null; if (options.cvsExclude) { Exclude.AddCvsExcludes(); } for (int j = 0; j < fileList.Count; j++) { if ((fileList[j].mode & Options.FLAG_TOP_DIR) == 0 || !Util.S_ISDIR(fileList[j].mode)) { continue; } argv[0] = options.dir + fileList[j].GetFullName(); FileList fList = new FileList(options); if ((localFileList = fList.sendFileList(null, argv)) == null) { continue; } for (int i = localFileList.Count - 1; i >= 0; i--) { if (localFileList[i].baseName == null) { continue; } localFileList[i].dirName = localFileList[i].dirName.Substring(options.dir.Length); if (FileList.fileListFind(fileList, (localFileList[i])) < 0) { localFileList[i].dirName = options.dir + localFileList[i].dirName; deleteOne(localFileList[i].GetFullName(), Util.S_ISDIR(localFileList[i].mode)); } } } }
public void DeleteFiles(ArrayList fileList) { string[] argv = new string[1]; ArrayList localFileList = null; if (options.cvsExclude) { Exclude.AddCvsExcludes(); } for (int j = 0; j < fileList.Count; j++) { if ((((FileStruct)fileList[j]).mode & Options.FLAG_TOP_DIR) == 0 || !Util.S_ISDIR(((FileStruct)fileList[j]).mode)) { continue; } argv[0] = options.dir + ((FileStruct)fileList[j]).FNameTo(); FileList fList = new FileList(options); if ((localFileList = fList.sendFileList(null, argv)) == null) { continue; } for (int i = localFileList.Count - 1; i >= 0; i--) { if (((FileStruct)localFileList[i]).baseName == null) { continue; } ((FileStruct)localFileList[i]).dirName = ((FileStruct)localFileList[i]).dirName.Substring(options.dir.Length); if (FileList.fileListFind(fileList, ((FileStruct)localFileList[i])) < 0) { ((FileStruct)localFileList[i]).dirName = options.dir + ((FileStruct)localFileList[i]).dirName; deleteOne(((FileStruct)localFileList[i]).FNameTo(), Util.S_ISDIR(((FileStruct)localFileList[i]).mode)); } } } }
public void DeleteFiles(List<FileStruct> fileList) { string[] argv = new string[1]; List<FileStruct> localFileList = null; if (options.cvsExclude) { Exclude.AddCvsExcludes(); } for (int j = 0; j < fileList.Count; j++) { if ((fileList[j].mode & Options.FLAG_TOP_DIR) == 0 || !Util.S_ISDIR(fileList[j].mode)) { continue; } argv[0] = options.dir + fileList[j].GetFullName(); FileList fList = new FileList(options); if ((localFileList = fList.sendFileList(null, argv)) == null) { continue; } for (int i = localFileList.Count - 1; i >= 0; i--) { if (localFileList[i].baseName == null) { continue; } localFileList[i].dirName = localFileList[i].dirName.Substring(options.dir.Length); if (FileList.fileListFind(fileList, (localFileList[i])) < 0) { localFileList[i].dirName = options.dir + localFileList[i].dirName; deleteOne(localFileList[i].GetFullName(), Util.S_ISDIR(localFileList[i].mode)); } } } }
public int ClientRun(ClientInfo clientInfo, int pid, string[] args) { Options options = clientInfo.Options; IOStream ioStream = clientInfo.IoStream; FileList fList; List <FileStruct> fileList; MainClass.SetupProtocol(clientInfo); if (options.protocolVersion >= 23 && !options.readBatch) { ioStream.IOStartMultiplexIn(); } if (options.amSender) { ioStream.IOStartBufferingOut(); if (options.deleteMode && !options.deleteExcluded) { Exclude excl = new Exclude(options); excl.SendExcludeList(ioStream); } if (options.verbose > 3) { Log.Write("File list sent\n"); } ioStream.Flush(); fList = new FileList(options); fileList = fList.sendFileList(clientInfo, args); if (options.verbose > 3) { Log.WriteLine("file list sent"); } ioStream.Flush(); Sender sender = new Sender(options); sender.SendFiles(fileList, clientInfo); ioStream.Flush(); ioStream.writeInt(-1); return(-1); } options.dir = args[0]; if (options.dir.CompareTo(String.Empty) != 0 && options.dir.IndexOf(':') == -1) { if (options.dir[0] == '/') { options.dir = "c:" + options.dir; } else if (options.dir.IndexOf('/') != -1) { options.dir = options.dir.Insert(options.dir.IndexOf('/') - 1, ":"); } } if (!options.readBatch) { Exclude excl = new Exclude(options); excl.SendExcludeList(ioStream); } fList = new FileList(options); fileList = fList.receiveFileList(clientInfo); return(Daemon.DoReceive(clientInfo, fileList, null)); }
public void DeleteFiles(ArrayList fileList) { string[] argv = new string[1]; ArrayList localFileList = null; if(options.cvsExclude) Exclude.AddCvsExcludes(); for(int j=0; j<fileList.Count; j++) { if((((FileStruct)fileList[j]).mode & Options.FLAG_TOP_DIR) == 0 || !Util.S_ISDIR(((FileStruct)fileList[j]).mode)) continue; argv[0] = options.dir +((FileStruct)fileList[j]).FNameTo(); FileList fList = new FileList(options); if((localFileList = fList.sendFileList(null, argv)) == null) continue; for (int i = localFileList.Count-1; i >= 0; i--) { if(((FileStruct)localFileList[i]).baseName == null) continue; ((FileStruct)localFileList[i]).dirName = ((FileStruct)localFileList[i]).dirName.Substring(options.dir.Length); if (FileList.fileListFind(fileList,((FileStruct)localFileList[i])) < 0) { ((FileStruct)localFileList[i]).dirName = options.dir + ((FileStruct)localFileList[i]).dirName; deleteOne(((FileStruct)localFileList[i]).FNameTo(),Util.S_ISDIR(((FileStruct)localFileList[i]).mode)); } } } }
static void DoServerSender(ClientInfo clientInfo, string[] args) { string dir = args[0]; IOStream ioStream = clientInfo.IoStream; Options options = clientInfo.Options; if (options.verbose > 2) { Log.Write("Server sender starting"); } if (options.amDaemon && config.ModuleIsWriteOnly(options.ModuleId)) { MainClass.Exit("ERROR: module " + config.GetModuleName(options.ModuleId) + " is write only", clientInfo); return; } if (!options.relativePaths && !Util.pushDir(dir)) { MainClass.Exit("Push_dir#3 " + dir + "failed", clientInfo); return; } FileList fList = new FileList(options); List<FileStruct> fileList = fList.sendFileList(clientInfo, args); if (options.verbose > 3) { Log.WriteLine("File list sent"); } if (fileList.Count == 0) { MainClass.Exit("File list is empty", clientInfo); return; } ioStream.IOStartBufferingIn(); ioStream.IOStartBufferingOut(); Sender sender = new Sender(options); sender.SendFiles(fileList, clientInfo); ioStream.Flush(); MainClass.Report(clientInfo); if (options.protocolVersion >= 24) { ioStream.readInt(); } ioStream.Flush(); }