Exemple #1
0
        // Get the next item in a directory.
        private static String NextDirItem(DirScanInfo info)
        {
            // Bail out if the previous directory scan is finished.
            if (info.contents == null)
            {
                return("");
            }

            // Search for the next entry that matches the attributes.
            FileAttribute searchAttrs = info.searchAttrs;
            FileAttribute attrs;
            String        result;

            while (info.posn < info.contents.Length)
            {
                attrs = (FileAttribute)
                        (info.contents[info.posn].Attributes);
                attrs = attrs & (FileAttribute)0x3F;
                if ((searchAttrs & FileAttribute.Archive) != 0)
                {
                    // Skip entries that don't have the archive bit set.
                    if ((attrs & FileAttribute.Archive) == 0)
                    {
                        ++(info.posn);
                        continue;
                    }
                }
                if ((attrs & ~FileAttribute.Archive) ==
                    FileAttribute.Normal)
                {
                    // Normal entries are always included.
                    result = info.contents[info.posn].Name;
                    ++(info.posn);
                    return(result);
                }
                if ((searchAttrs & ~FileAttribute.Archive) ==
                    FileAttribute.Normal)
                {
                    // We don't want anything but normal entries.
                    ++(info.posn);
                    continue;
                }
                if ((attrs & searchAttrs & ~FileAttribute.Archive) != 0)
                {
                    // This entry matches the attribute conditions.
                    result = info.contents[info.posn].Name;
                    ++(info.posn);
                    return(result);
                }
            }

            // The directory scan has been completed.  Null out
            // the "contents" list to allow it to be GC'ed.
            info.contents = null;
            info.posn     = 0;
            return("");
        }
Exemple #2
0
 // Get the directory scan information block for an assembly.
 private static DirScanInfo GetScanInfo(Assembly assembly)
 {
     lock (typeof(FileSystem))
     {
         DirScanInfo info = dirScanList;
         while (info != null)
         {
             if (info.assembly == assembly)
             {
                 return(info);
             }
             info = info.next;
         }
         info        = new DirScanInfo(assembly, dirScanList);
         dirScanList = info;
         return(info);
     }
 }
	// Get the next item in a directory.
	private static String NextDirItem(DirScanInfo info)
			{
				// Bail out if the previous directory scan is finished.
				if(info.contents == null)
				{
					return "";
				}

				// Search for the next entry that matches the attributes.
				FileAttribute searchAttrs = info.searchAttrs;
				FileAttribute attrs;
				String result;
				while(info.posn < info.contents.Length)
				{
					attrs = (FileAttribute)
						(info.contents[info.posn].Attributes);
					attrs = attrs & (FileAttribute)0x3F;
					if((searchAttrs & FileAttribute.Archive) != 0)
					{
						// Skip entries that don't have the archive bit set.
						if((attrs & FileAttribute.Archive) == 0)
						{
							++(info.posn);
							continue;
						}
					}
					if((attrs & ~FileAttribute.Archive) ==
							FileAttribute.Normal)
					{
						// Normal entries are always included.
						result = info.contents[info.posn].Name;
						++(info.posn);
						return result;
					}
					if((searchAttrs & ~FileAttribute.Archive) ==
							FileAttribute.Normal)
					{
						// We don't want anything but normal entries.
						++(info.posn);
						continue;
					}
					if((attrs & searchAttrs & ~FileAttribute.Archive) != 0)
					{
						// This entry matches the attribute conditions.
						result = info.contents[info.posn].Name;
						++(info.posn);
						return result;
					}
				}

				// The directory scan has been completed.  Null out
				// the "contents" list to allow it to be GC'ed.
				info.contents = null;
				info.posn = 0;
				return "";
			}
	// Get the directory scan information block for an assembly.
	private static DirScanInfo GetScanInfo(Assembly assembly)
			{
				lock(typeof(FileSystem))
				{
					DirScanInfo info = dirScanList;
					while(info != null)
					{
						if(info.assembly == assembly)
						{
							return info;
						}
						info = info.next;
					}
					info = new DirScanInfo(assembly, dirScanList);
					dirScanList = info;
					return info;
				}
			}
		public DirScanInfo(Assembly assembly, DirScanInfo next)
				{
					this.assembly = assembly;
					this.next = next;
				}
Exemple #6
0
 public DirScanInfo(Assembly assembly, DirScanInfo next)
 {
     this.assembly = assembly;
     this.next     = next;
 }