当前位置: 首页>>代码示例>>C#>>正文


C# PackFile类代码示例

本文整理汇总了C#中PackFile的典型用法代码示例。如果您正苦于以下问题:C# PackFile类的具体用法?C# PackFile怎么用?C# PackFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PackFile类属于命名空间,在下文中一共展示了PackFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: test000_FirstPack

        public void test000_FirstPack()
        {
            FileInfo packFile = getPack("pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack");
            Stream @is = packFile.Open(System.IO.FileMode.Open, FileAccess.Read);
            try
            {
                FileInfo tmppack = new FileInfo(Path.Combine(trash.ToString(), "tmp_pack1"));
                FileInfo idxFile = new FileInfo(Path.Combine(trash.ToString(), "tmp_pack1.idx"));
                FileInfo tmpPackFile = new FileInfo(Path.Combine(trash.ToString(), "tmp_pack1.pack"));

                tmppack.Create().Close();
                idxFile.Create().Close();
                tmpPackFile.Create().Close();

                IndexPack pack = new IndexPack(db, @is, tmppack);
                pack.index(new TextProgressMonitor());
                PackFile file = new PackFile(idxFile, tmpPackFile);

                Assert.IsTrue(file.HasObject(ObjectId.FromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904")));
                Assert.IsTrue(file.HasObject(ObjectId.FromString("540a36d136cf413e4b064c2b0e0a4db60f77feab")));
                Assert.IsTrue(file.HasObject(ObjectId.FromString("5b6e7c66c276e7610d4a73c70ec1a1f7c1003259")));
                Assert.IsTrue(file.HasObject(ObjectId.FromString("6ff87c4664981e4397625791c8ea3bbb5f2279a3")));
                Assert.IsTrue(file.HasObject(ObjectId.FromString("82c6b885ff600be425b4ea96dee75dca255b69e7")));
                Assert.IsTrue(file.HasObject(ObjectId.FromString("902d5476fa249b7abc9d84c611577a81381f0327")));
                Assert.IsTrue(file.HasObject(ObjectId.FromString("aabf2ffaec9b497f0950352b3e582d73035c2035")));
                Assert.IsTrue(file.HasObject(ObjectId.FromString("c59759f143fb1fe21c197981df75a7ee00290799")));
            }
            finally
            {
                @is.Close();
            }
        }
开发者ID:gilran,项目名称:GitSharp,代码行数:32,代码来源:IndexPackTests.cs

示例2: NewWhole

		internal static LocalObjectRepresentation NewWhole(PackFile f, long p, long length
			)
		{
			LocalObjectRepresentation r = new _LocalObjectRepresentation_53();
			r.pack = f;
			r.offset = p;
			r.length = length;
			return r;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:9,代码来源:LocalObjectRepresentation.cs

示例3: PackInputStream

		/// <exception cref="System.IO.IOException"></exception>
		internal PackInputStream(PackFile pack, long pos, WindowCursor wc)
		{
			this.pack = pack;
			this.pos = pos;
			this.wc = wc;
			// Pin the first window, to ensure the pack is open and valid.
			//
			wc.Pin(pack, pos);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:10,代码来源:PackInputStream.cs

示例4: LargePackedWholeObject

		internal LargePackedWholeObject(int type, long size, long objectOffset, int headerLength
			, PackFile pack, FileObjectDatabase db)
		{
			this.type = type;
			this.size = size;
			this.objectOffset = objectOffset;
			this.headerLength = headerLength;
			this.pack = pack;
			this.db = db;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:10,代码来源:LargePackedWholeObject.cs

示例5: NewDelta

		internal static LocalObjectRepresentation NewDelta(PackFile f, long p, long n, ObjectId
			 @base)
		{
			LocalObjectRepresentation r = new LocalObjectRepresentation.Delta();
			r.pack = f;
			r.offset = p;
			r.length = n;
			r.baseId = @base;
			return r;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:10,代码来源:LocalObjectRepresentation.cs

示例6: test003_lookupCompressedObject

 public void test003_lookupCompressedObject()
 {
     ObjectId id = ObjectId.FromString("902d5476fa249b7abc9d84c611577a81381f0327");
     var pr = new PackFile(TestIdx, TestPack);
     PackedObjectLoader or = pr.Get(new WindowCursor(), id);
     Assert.IsNotNull(or);
     Assert.AreEqual(Constants.OBJ_TREE, or.Type);
     Assert.AreEqual(35, or.Size);
     Assert.AreEqual(7738, or.DataOffset);
     pr.Close();
 }
开发者ID:HackerBaloo,项目名称:GitSharp,代码行数:11,代码来源:PackReaderTests.cs

示例7: LargePackedDeltaObject

		internal LargePackedDeltaObject(long objectOffset, long baseOffset, int headerLength
			, PackFile pack, FileObjectDatabase db)
		{
			this.type = Constants.OBJ_BAD;
			this.size = SIZE_UNKNOWN;
			this.objectOffset = objectOffset;
			this.baseOffset = baseOffset;
			this.headerLength = headerLength;
			this.pack = pack;
			this.db = db;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:11,代码来源:LargePackedDeltaObject.cs

示例8: Test003_lookupCompressedObject

		public virtual void Test003_lookupCompressedObject()
		{
			PackFile pr;
			ObjectId id;
			ObjectLoader or;
			id = ObjectId.FromString("902d5476fa249b7abc9d84c611577a81381f0327");
			pr = new PackFile(TEST_IDX, TEST_PACK);
			or = pr.Get(new WindowCursor(null), id);
			NUnit.Framework.Assert.IsNotNull(or);
			NUnit.Framework.Assert.AreEqual(Constants.OBJ_TREE, or.GetType());
			NUnit.Framework.Assert.AreEqual(35, or.GetSize());
			pr.Close();
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:13,代码来源:T0004_PackReaderTest.cs

示例9: get

 public static Entry get(PackFile pack, long position)
 {
     Slot e = Cache[Hash(position)];
     if (e.provider == pack && e.position == position)
     {
         Entry buf = e.data.get();
         if (buf != null)
         {
             MoveToHead(e);
             return buf;
         }
     }
     return null;
 }
开发者ID:drothmaler,项目名称:GitSharp,代码行数:14,代码来源:UnpackedObjectCache.cs

示例10: Copy

 /// <summary>
 /// Copy bytes from the window to a caller supplied buffer.
 /// </summary>
 /// <param name="pack">The file the desired window is stored within.</param>
 /// <param name="position">Position within the file to read from.</param>
 /// <param name="dstbuf">Destination buffer to copy into.</param>
 /// <param name="dstoff">Offset within <paramref name="dstbuf"/> to start copying into.</param>
 /// <param name="cnt">
 /// The number of bytes to copy. This value may exceed the number of
 /// bytes remaining in the window starting at offset <paramref name="position"/>.
 /// </param>
 /// <returns>
 /// number of bytes actually copied; this may be less than
 /// <paramref name="cnt"/> if <paramref name="cnt"/> exceeded the number of
 /// bytes available.
 /// </returns>
 /// <remarks>
 /// This cursor does not match the provider or id and the proper 
 /// window could not be acquired through the provider's cache.
 /// </remarks>
 public int Copy(PackFile pack, long position, byte[] dstbuf, int dstoff, int cnt)
 {
     long length = pack.Length;
     int need = cnt;
     while (need > 0 && position < length)
     {
         Pin(pack, position);
         int r = _byteWindow.copy(position, dstbuf, dstoff, need);
         position += r;
         dstoff += r;
         need -= r;
     }
     return cnt - need;
 }
开发者ID:dev218,项目名称:GitSharp,代码行数:34,代码来源:WindowCursor.cs

示例11: test003_lookupCompressedObject

        public void test003_lookupCompressedObject()
        {
            PackFile pr;
            ObjectId id;
            PackedObjectLoader or;

            id = ObjectId.FromString("902d5476fa249b7abc9d84c611577a81381f0327");
            pr = new PackFile(TEST_IDX, TEST_PACK);
            or = pr.Get(new WindowCursor(), id);
            Assert.IsNotNull(or);
            Assert.AreEqual(Constants.OBJ_TREE, or.getType());
            Assert.AreEqual(35, or.getSize());
            Assert.AreEqual(7738, or.getDataOffset());
            pr.Close();
        }
开发者ID:stephensong,项目名称:GitSharp,代码行数:15,代码来源:PackReaderTests.cs

示例12: insertPack

 private void insertPack(PackFile pf)
 {
     PackFile[] o, n;
     do
     {
         o = packs();
         n = new PackFile[1 + o.Length];
         n[0] = pf;
         Array.Copy(o, 0, n, 1, o.Length);
     } while (!packList.compareAndSet(o, n));
 }
开发者ID:ArildF,项目名称:GitSharp,代码行数:11,代码来源:ObjectDirectory.cs

示例13: reuseMap

        private static Dictionary<string, PackFile> reuseMap(PackFile[] old)
        {
            Dictionary<string, PackFile> forReuse = new Dictionary<string, PackFile>();
            foreach (PackFile p in old)
            {
                if (p.IsInvalid)
                {
                    // The pack instance is corrupted, and cannot be safely used
                    // again. Do not include it in our reuse map.
                    //
                    p.Close();
                    continue;
                }

                PackFile prior = forReuse[p.File.Name] = p;
                if (prior != null)
                {
                    // This should never occur. It should be impossible for us
                    // to have two pack files with the same name, as all of them
                    // came out of the same directory. If it does, we promised to
                    // close any PackFiles we did not reuse, so close the one we
                    // just evicted out of the reuse map.
                    //
                    prior.Close();
                }
            }
            return forReuse;
        }
开发者ID:ArildF,项目名称:GitSharp,代码行数:28,代码来源:ObjectDirectory.cs

示例14: inList

 private static bool inList(PackFile[] list, PackFile pack)
 {
     foreach (PackFile p in list)
     {
         if (p == pack)
         {
             return true;
         }
     }
     return false;
 }
开发者ID:ArildF,项目名称:GitSharp,代码行数:11,代码来源:ObjectDirectory.cs

示例15: DeltaOfsPackedObjectLoader

 public DeltaOfsPackedObjectLoader(PackFile pr, long dataOffset, long objectOffset, int deltaSz, long @base)
     : base(pr, dataOffset, objectOffset, deltaSz)
 {
     _deltaBase = @base;
 }
开发者ID:HackerBaloo,项目名称:GitSharp,代码行数:5,代码来源:DeltaOfsPackedObjectLoader.cs


注:本文中的PackFile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。