getDirectory() public method

Gets the location of the objects directory.
public getDirectory ( ) : DirectoryInfo
return System.IO.DirectoryInfo
Esempio n. 1
0
        /// <summary>
        /// The constructor
        /// </summary>
        /// <param name="wrapped">the wrapped database</param>
        public CachedObjectDirectory(ObjectDirectory wrapped) : base(wrapped)
        {
            DirectoryInfo objects = wrapped.getDirectory();

            string[] fanout = objects.GetDirectories().Select(x => x.FullName).ToArray();
            if (fanout == null)
            {
                fanout = new string[0];
            }
            foreach (string d in fanout)
            {
                if (d.Length != 2)
                {
                    continue;
                }
                string[] entries = PathUtil.CombineDirectoryPath(objects, d).GetFiles().Select(x => x.FullName).ToArray();
                if (entries == null)
                {
                    continue;
                }
                foreach (string e in entries)
                {
                    if (e.Length != Constants.OBJECT_ID_STRING_LENGTH - 2)
                    {
                        continue;
                    }
                    try {
                        _unpackedObjects.Add(ObjectId.FromString(d + e));
                    } catch (ArgumentException) {
                        // ignoring the file that does not represent loose object
                    }
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// The constructor
 /// </summary>
 /// <param name="wrapped">the wrapped database</param>
 public CachedObjectDirectory(ObjectDirectory wrapped) : base(wrapped) {
     DirectoryInfo objects = wrapped.getDirectory();
     string[] fanout = objects.GetDirectories().Select(x => x.FullName).ToArray();
     if (fanout == null)
         fanout = new string[0];
     foreach (string d in fanout) {
         if (d.Length != 2)
             continue;
         string[] entries = PathUtil.CombineDirectoryPath(objects, d).GetFiles().Select(x => x.FullName).ToArray();
         if (entries == null)
             continue;
         foreach (string e in entries) {
             if (e.Length != Constants.OBJECT_ID_STRING_LENGTH - 2)
                 continue;
             try {
                 _unpackedObjects.Add(ObjectId.FromString(d + e));
             } catch (ArgumentException) {
                 // ignoring the file that does not represent loose object
             }
         }
     }
 }