Esempio n. 1
0
        /// <summary>The constructor</summary>
        /// <param name="wrapped">the wrapped database</param>
        internal CachedObjectDirectory(ObjectDirectory wrapped)
        {
            this.wrapped = wrapped;
            FilePath objects = wrapped.GetDirectory();

            string[] fanout = objects.List();
            if (fanout == null)
            {
                fanout = new string[0];
            }
            foreach (string d in fanout)
            {
                if (d.Length != 2)
                {
                    continue;
                }
                string[] entries = new FilePath(objects, d).List();
                if (entries == null)
                {
                    continue;
                }
                foreach (string e in entries)
                {
                    if (e.Length != Constants.OBJECT_ID_STRING_LENGTH - 2)
                    {
                        continue;
                    }
                    try
                    {
                        ObjectId id = ObjectId.FromString(d + e);
                        unpackedObjects.Add(new CachedObjectDirectory.UnpackedObjectId(id));
                    }
                    catch (ArgumentException)
                    {
                    }
                }
            }
        }
Esempio n. 2
0
		/// <summary>The constructor</summary>
		/// <param name="wrapped">the wrapped database</param>
		internal CachedObjectDirectory(ObjectDirectory wrapped)
		{
			this.wrapped = wrapped;
			FilePath objects = wrapped.GetDirectory();
			string[] fanout = objects.List();
			if (fanout == null)
			{
				fanout = new string[0];
			}
			foreach (string d in fanout)
			{
				if (d.Length != 2)
				{
					continue;
				}
				string[] entries = new FilePath(objects, d).List();
				if (entries == null)
				{
					continue;
				}
				foreach (string e in entries)
				{
					if (e.Length != Constants.OBJECT_ID_STRING_LENGTH - 2)
					{
						continue;
					}
					try
					{
						ObjectId id = ObjectId.FromString(d + e);
						unpackedObjects.Add(new CachedObjectDirectory.UnpackedObjectId(id));
					}
					catch (ArgumentException)
					{
					}
				}
			}
		}
Esempio n. 3
0
        private string GetPackFilePath(string packName)
        {
            FilePath packDir = new FilePath(odb.GetDirectory(), "pack");

            return(new FilePath(packDir, "pack-" + packName + ".pack").GetPath());
        }
Esempio n. 4
0
 internal override FilePath GetDirectory()
 {
     return(wrapped.GetDirectory());
 }