Exemplo n.º 1
0
 public void sendDirectory(IOStream f, ArrayList fileList, string dir)
 {
     FileSystem.DirectoryInfo di = new FileSystem.DirectoryInfo(dir);
     if (di.Exists)
     {
         if (options.cvsExclude)
         {
             Exclude excl = new Exclude(options);
             excl.AddExcludeFile(ref options.localExcludeList, dir, (int)(Options.XFLG_WORD_SPLIT & Options.XFLG_WORDS_ONLY));
         }
         FileSystem.FileInfo[] files = di.GetFiles();
         for (int i = 0; i < files.Length; i++)
         {
             // TODO: path length
             sendFileName(f, fileList, files[i].FullName.Replace("\\", "/"), options.recurse, 0);
         }
         FileSystem.DirectoryInfo[] dirs = di.GetDirectories();
         for (int i = 0; i < dirs.Length; i++)
         {
             // TODO: path length
             sendFileName(f, fileList, dirs[i].FullName.Replace("\\", "/"), options.recurse, 0);
         }
     }
     else
     {
         Log.WriteLine("Can't find directory '" + Util.fullFileName(dir) + "'");
         return;
     }
 }
Exemplo n.º 2
0
		public void sendDirectory(IOStream f, ArrayList fileList, string dir)
		{
			FileSystem.DirectoryInfo di = new FileSystem.DirectoryInfo(dir);
			if(di.Exists)
			{
				if(options.cvsExclude)
				{
					Exclude excl = new Exclude(options);
					excl.AddExcludeFile(ref options.localExcludeList, dir, (int)(Options.XFLG_WORD_SPLIT & Options.XFLG_WORDS_ONLY));
				}
				FileSystem.FileInfo[] files = di.GetFiles();
				for(int i=0; i< files.Length; i++)
					// TODO: path length
					sendFileName(f, fileList,files[i].FullName.Replace("\\", "/"), options.recurse,0);
				FileSystem.DirectoryInfo[] dirs = di.GetDirectories();
				for(int i=0; i< dirs.Length; i++)
					// TODO: path length
					sendFileName(f, fileList,dirs[i].FullName.Replace("\\", "/"), options.recurse,0);
			} 
			else
			{
				Log.WriteLine("Can't find directory '" + Util.fullFileName(dir) + "'");
				return;
			}
		}
Exemplo n.º 3
0
		public FileStruct makeFile(string fileName, ArrayList fileList, int excludeLevel)
		{
			if(fileName == null || fileName.CompareTo("") == 0) return null;
			string thisName = Util.cleanFileName(fileName,false);
			if(options.sanitizePath)
				thisName = Util.sanitizePath(thisName, "", 0);
			FileStruct fs = new FileStruct();
			// TODO: path length
			if(FileSystem.Directory.Exists(thisName))
			{									
				if(thisName.LastIndexOf('/') != -1)
				{
					thisName = thisName.TrimEnd('/');
					fs.dirName = thisName.Substring(0,thisName.LastIndexOf('/')).Replace(@"\","/");
					fs.baseName = thisName.Substring(thisName.LastIndexOf('/') + 1);				
					fs.gid = 0;
					fs.uid = 0;
					fs.mode = 0x4000 | 0x16B ;
					// TODO: path length
					FileSystem.DirectoryInfo di = new FileSystem.DirectoryInfo(thisName);
					if((di.Attributes & FileAttributes.ReadOnly) != FileAttributes.ReadOnly)
						fs.mode |= 0x92;
				}

			}
			// TODO: path length
			if(FileSystem.File.Exists(thisName))
			{
				
				if (excludeLevel != Options.NO_EXCLUDES && checkExcludeFile(thisName, 0, excludeLevel))
					return null;				
				fs.baseName = Path.GetFileName(thisName);
				fs.dirName = FileSystem.Directory.GetDirectoryName(thisName).Replace(@"\","/").TrimEnd('/');				
				FileSystem.FileInfo fi = new FileSystem.FileInfo(thisName);
				
				// TODO: path length
				fs.length = (int)fi.Length;
				// TODO: path length
				fs.modTime = fi.LastWriteTime;	
				fs.mode = 0x8000 | 0x1A4 ; 
				// TODO: path length
				if((FileSystem.File.GetAttributes(thisName) & FileAttributes.ReadOnly) != FileAttributes.ReadOnly)
				   fs.mode |= 0x92;
				fs.gid = 0;
				fs.uid = 0;
				
				int sum_len = options.alwaysChecksum ? CheckSum.MD4_SUM_LENGTH : 0;				
				if(sum_len != 0)
					if(!checkSum.FileCheckSum(thisName, ref fs.sum, fs.length))
					{
						Log.Write("Skipping file " + thisName);
						return null;
					}

				Options.stats.totalSize += fs.length;

			}
			fs.baseDir = fileListDir;			
			return fs;
		}
Exemplo n.º 4
0
        public FileStruct makeFile(string fileName, ArrayList fileList, int excludeLevel)
        {
            if (fileName == null || fileName.CompareTo("") == 0)
            {
                return(null);
            }
            string thisName = Util.cleanFileName(fileName, false);

            if (options.sanitizePath)
            {
                thisName = Util.sanitizePath(thisName, "", 0);
            }
            FileStruct fs = new FileStruct();

            // TODO: path length
            if (FileSystem.Directory.Exists(thisName))
            {
                if (thisName.LastIndexOf('/') != -1)
                {
                    thisName    = thisName.TrimEnd('/');
                    fs.dirName  = thisName.Substring(0, thisName.LastIndexOf('/')).Replace(@"\", "/");
                    fs.baseName = thisName.Substring(thisName.LastIndexOf('/') + 1);
                    fs.gid      = 0;
                    fs.uid      = 0;
                    fs.mode     = 0x4000 | 0x16B;
                    // TODO: path length
                    FileSystem.DirectoryInfo di = new FileSystem.DirectoryInfo(thisName);
                    if ((di.Attributes & FileAttributes.ReadOnly) != FileAttributes.ReadOnly)
                    {
                        fs.mode |= 0x92;
                    }
                }
            }
            // TODO: path length
            if (FileSystem.File.Exists(thisName))
            {
                if (excludeLevel != Options.NO_EXCLUDES && checkExcludeFile(thisName, 0, excludeLevel))
                {
                    return(null);
                }
                fs.baseName = Path.GetFileName(thisName);
                fs.dirName  = FileSystem.Directory.GetDirectoryName(thisName).Replace(@"\", "/").TrimEnd('/');
                FileSystem.FileInfo fi = new FileSystem.FileInfo(thisName);

                // TODO: path length
                fs.length = (int)fi.Length;
                // TODO: path length
                fs.modTime = fi.LastWriteTime;
                fs.mode    = 0x8000 | 0x1A4;
                // TODO: path length
                if ((FileSystem.File.GetAttributes(thisName) & FileAttributes.ReadOnly) != FileAttributes.ReadOnly)
                {
                    fs.mode |= 0x92;
                }
                fs.gid = 0;
                fs.uid = 0;

                int sum_len = options.alwaysChecksum ? CheckSum.MD4_SUM_LENGTH : 0;
                if (sum_len != 0)
                {
                    if (!checkSum.FileCheckSum(thisName, ref fs.sum, fs.length))
                    {
                        Log.Write("Skipping file " + thisName);
                        return(null);
                    }
                }

                Options.stats.totalSize += fs.length;
            }
            fs.baseDir = fileListDir;
            return(fs);
        }