• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Core.ObjectId类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: BlobBasedConfig

 ///	<summary> * The constructor from object identifier
 ///	</summary>
 ///	<param name="base">the base configuration file </param>
 ///	<param name="r">the repository</param>
 /// <param name="objectid">the object identifier</param>
 /// <exception cref="IOException">
 /// the blob cannot be read from the repository. </exception>
 /// <exception cref="ConfigInvalidException">
 /// the blob is not a valid configuration format.
 /// </exception> 
 public BlobBasedConfig(Config @base, Repository r, ObjectId objectid)
     : base(@base)
 {
     ObjectLoader loader = r.OpenBlob(objectid);
     if (loader == null)
     {
         throw new IOException("Blob not found: " + objectid);
     }
     fromText(RawParseUtils.decode(loader.Bytes));
 }
开发者ID:jagregory,项目名称:GitSharp,代码行数:20,代码来源:BlobBasedConfig.cs


示例2: DecodeTypeString

        public static ObjectType DecodeTypeString(ObjectId id, byte[] typeString, byte endMark, ref int offset)
        {
            try
            {
                switch (typeString[offset])
                {
                    case (byte)'b':
                        if (typeString[offset + 1] != (byte)'l' ||
                        typeString[offset + 2] != (byte)'o' ||
                        typeString[offset + 3] != (byte)'b' ||
                        typeString[offset + 4] != endMark) break;
                        offset += 5;
                        return ObjectType.Blob;

                    case (byte)'c':
                        if (typeString[offset + 1] != (byte)'o' || typeString[offset + 2] != (byte)'m' ||
                        typeString[offset + 3] != (byte)'m' || typeString[offset + 4] != (byte)'i' ||
                        typeString[offset + 5] != (byte)'t' || typeString[offset + 6] != endMark) break;
                        offset += 7;
                        return ObjectType.Commit;

                    case (byte)'t':
                        switch (typeString[offset + 1])
                        {
                            case (byte)'a':
                                if (typeString[offset + 2] != (byte)'g' || typeString[offset + 2] != endMark)
                                {
                                    throw new CorruptObjectException(id, "invalid type");
                                }
                                offset += 4;
                                return ObjectType.Tag;

                            case (byte)'r':
                                if (typeString[offset + 2] != (byte)'e' || typeString[offset + 3] != (byte)'e' || typeString[offset + 4] != endMark)
                                {
                                    throw new CorruptObjectException(id, "invalid type");
                                }
                                offset += 5;
                                return ObjectType.Tree;

                        }
                        break;
                }
            }
            catch (IndexOutOfRangeException)
            {
            }
            throw new CorruptObjectException(id, "invalid type");
        }
开发者ID:spraints,项目名称:GitSharp,代码行数:49,代码来源:Codec.cs


示例3: Tag

 /**
  * Construct a Tag representing an existing with a known name referencing an known object.
  * This could be either a simple or annotated tag.
  *
  * @param db {@link Repository}
  * @param id target id.
  * @param refName tag name or null
  * @param raw data of an annotated tag.
  */
 public Tag(Repository db, ObjectId id, string refName, byte[] raw)
 {
     Repository = db;
     if (raw != null)
     {
         TagId = id;
         Id = ObjectId.FromString(raw, 7);
     }
     else
         Id = id;
     if (refName != null && refName.StartsWith("refs/tags/"))
         refName = refName.Substring(10);
     TagName = refName;
     this.raw = raw;
 }
开发者ID:spraints,项目名称:GitSharp,代码行数:24,代码来源:Tag.cs


示例4: BlobBasedConfig

		///	<summary> * The constructor from object identifier
		///	</summary>
		///	<param name="base">the base configuration file </param>
		///	<param name="repo">the repository</param>
		/// <param name="objectid">the object identifier</param>
		/// <exception cref="IOException">
		/// the blob cannot be read from the repository. </exception>
		/// <exception cref="ConfigInvalidException">
		/// the blob is not a valid configuration format.
		/// </exception> 
		public BlobBasedConfig(Config @base, Repository repo, ObjectId objectid)
			: base(@base)
		{
			if (repo == null)
			{
				throw new System.ArgumentNullException("repo");
			}
			
			ObjectLoader loader = repo.OpenBlob(objectid);
			if (loader == null)
			{
				throw new IOException("Blob not found: " + objectid);
			}
			fromText(RawParseUtils.decode(loader.Bytes));
		}
开发者ID:dev218,项目名称:GitSharp,代码行数:25,代码来源:BlobBasedConfig.cs


示例5: Entry

            public Entry(byte[] raw, int pos)
            {
                oldId = ObjectId.FromString(raw, pos);
                pos += Constants.OBJECT_ID_STRING_LENGTH;
                if (raw[pos++] != ' ')
                    throw new ArgumentException("Raw log message does not parse as log entry");
                newId = ObjectId.FromString(raw, pos);
                pos += Constants.OBJECT_ID_STRING_LENGTH;
                if (raw[pos++] != ' ')
                    throw new ArgumentException("Raw log message does not parse as log entry");
                who = RawParseUtils.parsePersonIdentOnly(raw, pos);
                int p0 = RawParseUtils.next(raw, pos, (byte)'\t');

                if (p0 == -1)
                    throw new ArgumentException("Raw log message does not parse as log entry");

                int p1 = RawParseUtils.nextLF(raw, p0);
                if (p1 == -1)
                    throw new ArgumentException("Raw log message does not parse as log entry");

                comment = RawParseUtils.decode(raw, p0, p1 - 1);
            }
开发者ID:dev218,项目名称:GitSharp,代码行数:22,代码来源:ReflogReader.cs


示例6: MakeTree

 private Tree MakeTree(ObjectId id, byte[] raw)
 {
     return new Tree(this, id, raw);
 }
开发者ID:georgeck,项目名称:GitSharp,代码行数:4,代码来源:Repository.cs


示例7: MapCommit

        /// <summary>
        /// Access a Commit by SHA'1 id.
        /// </summary>
        /// <param name="id"></param>
        /// <returns>Commit or null</returns>
        public Commit MapCommit(ObjectId id)
        {
            ObjectLoader or = OpenObject(id);
            if (or == null)
            {
                return null;
            }

            byte[] raw = or.Bytes;
            if (Constants.OBJ_COMMIT == or.Type)
            {
                return new Commit(this, id, raw);
            }

            throw new IncorrectObjectTypeException(id, ObjectType.Commit);
        }
开发者ID:georgeck,项目名称:GitSharp,代码行数:21,代码来源:Repository.cs


示例8: MakeCommit

 private object MakeCommit(ObjectId id, byte[] raw)
 {
     return new Commit(this, id, raw);
 }
开发者ID:georgeck,项目名称:GitSharp,代码行数:4,代码来源:Repository.cs


示例9: MakeTag

 private Tag MakeTag(ObjectId id, string refName, byte[] raw)
 {
     return new Tag(this, id, refName, raw);
 }
开发者ID:georgeck,项目名称:GitSharp,代码行数:4,代码来源:Repository.cs


示例10: Write

 public void Write(ObjectId id)
 {
     RequireLock();
     try
     {
         var b = new BinaryWriter(_os);
         id.CopyTo(b);
         b.Write('\n');
         b.Flush();
         _fLck.Release();
         b.Close();
         _os = null;
     }
     catch (Exception)
     {
         Unlock();
         throw;
     }
 }
开发者ID:jagregory,项目名称:GitSharp,代码行数:19,代码来源:LockFile.cs


示例11: Unpeeled

        /// <summary>
        /// Create a new ref pairing.
        /// </summary>
        /// <param name="st">method used to store this ref.</param>
        /// <param name="name">name of this ref.</param>
        /// <param name="id">
        /// current value of the ref. May be null to indicate a ref that
        /// does not exist yet.
        /// </param>
        public Unpeeled(Storage st, string name, ObjectId id)
            : base(st, name, id)
        {

        }
开发者ID:dev218,项目名称:GitSharp,代码行数:14,代码来源:ObjectIdRef.cs


示例12: OpenCommit

 public Commit OpenCommit(ObjectId id)
 {
     return MapCommit(id);
 }
开发者ID:georgeck,项目名称:GitSharp,代码行数:4,代码来源:Repository.cs


示例13: Tree

		///	<summary>
		/// Construct a Tree object with known content and hash value
		///	</summary>
		///	<param name="repo"></param>
		///	<param name="id"></param>
		///	<param name="raw"></param>
		///	<exception cref="IOException"></exception>
		public Tree(Repository repo, ObjectId id, byte[] raw)
			: base(null, id, null)
		{
			_db = repo;
			ReadTree(raw);
		}
开发者ID:dev218,项目名称:GitSharp,代码行数:13,代码来源:Tree.cs


示例14: MapObject

        /// <summary>
        /// Access any type of Git object by id and
        /// </summary>
        /// <param name="id">SHA-1 of object to read</param>
        /// <param name="refName">optional, only relevant for simple tags</param>
        /// <returns>The Git object if found or null</returns>
        public object MapObject(ObjectId id, string refName)
        {
            ObjectLoader or = OpenObject(id);

            if (or == null)
            {
                return null;
            }

            byte[] raw = or.Bytes;
            switch ((ObjectType)(or.Type))
            {
                case ObjectType.Tree:
                    return MakeTree(id, raw);

                case ObjectType.Commit:
                    return MakeCommit(id, raw);

                case ObjectType.Tag:
                    return MakeTag(id, refName, raw);

                case ObjectType.Blob:
                    return raw;

                default:
                    throw new IncorrectObjectTypeException(id,
                        "COMMIT nor TREE nor BLOB nor TAG");
            }
        }
开发者ID:georgeck,项目名称:GitSharp,代码行数:35,代码来源:Repository.cs


示例15: MapTree

        /// <summary>
        /// Access a Tree by SHA'1 id.
        /// </summary>
        /// <param name="id"></param>
        /// <returns>Tree or null</returns>
        public Tree MapTree(ObjectId id)
        {
            ObjectLoader or = OpenObject(id);
            if (or == null)
            {
                return null;
            }

            byte[] raw = or.Bytes;
            switch (((ObjectType)or.Type))
            {
                case ObjectType.Tree:
                    return new Tree(this, id, raw);

                case ObjectType.Commit:
                    return MapTree(ObjectId.FromString(raw, 5));
            }

            throw new IncorrectObjectTypeException(id, ObjectType.Tree);
        }
开发者ID:georgeck,项目名称:GitSharp,代码行数:25,代码来源:Repository.cs


示例16: Commit

 ///	<summary>
 /// Create a commit associated with these parents and associate it with a
 /// repository.
 /// </summary>
 /// <param name="db">
 ///	The repository to which this commit object belongs.
 /// </param>
 ///	<param name="parentIds">
 ///	Id's of the parent(s).
 /// </param>
 public Commit(Repository db, ObjectId[] parentIds)
 {
     Repository = db;
     ParentIds = parentIds;
 }
开发者ID:linquize,项目名称:GitSharp,代码行数:15,代码来源:Commit.cs


示例17: WriteVerifyPack4

        private void WriteVerifyPack4(bool thin)
        {
            var interestings = new LinkedList<ObjectId>();
            interestings.AddLast(ObjectId.FromString("82c6b885ff600be425b4ea96dee75dca255b69e7"));
            var uninterestings = new LinkedList<ObjectId>();
            uninterestings.AddLast(ObjectId.FromString("c59759f143fb1fe21c197981df75a7ee00290799"));
            CreateVerifyOpenPack(interestings, uninterestings, thin, false);

            var writtenObjects = new[]
                                 	{
                                 		ObjectId.FromString("82c6b885ff600be425b4ea96dee75dca255b69e7"),
                                 		ObjectId.FromString("aabf2ffaec9b497f0950352b3e582d73035c2035"),
                                 		ObjectId.FromString("5b6e7c66c276e7610d4a73c70ec1a1f7c1003259")
                                 	};

            Assert.AreEqual(writtenObjects.Length, _writer.getObjectsNumber());
            ObjectId[] expectedObjects;
            if (thin)
            {
                expectedObjects = new ObjectId[4];
                Array.Copy(writtenObjects, 0, expectedObjects, 0, writtenObjects.Length);
                expectedObjects[3] = ObjectId.FromString("6ff87c4664981e4397625791c8ea3bbb5f2279a3");
            }
            else
            {
                expectedObjects = writtenObjects;
            }

            VerifyObjectsOrder(expectedObjects);
            Assert.AreEqual("cded4b74176b4456afa456768b2b5aafb41c44fc", _writer.computeName().Name);
        }
开发者ID:georgeck,项目名称:GitSharp,代码行数:31,代码来源:PackWriterTest.cs


示例18: VerifyObjectsOrder

        private void VerifyObjectsOrder(ObjectId[] objectsOrder)
        {
            var entries = new SortedList<long, PackIndex.MutableEntry>();

            foreach (PackIndex.MutableEntry me in _pack)
            {
                entries.Add(me.Offset, me.CloneEntry());
            }

            int i = 0;
            foreach (PackIndex.MutableEntry me in entries.Values)
            {
                Assert.AreEqual(objectsOrder[i++].ToObjectId(), me.ToObjectId());
            }
        }
开发者ID:georgeck,项目名称:GitSharp,代码行数:15,代码来源:PackWriterTest.cs


示例19: PeeledTag

        /// <summary>
        /// Create a new ref pairing.
        /// </summary>
        /// <param name="st">method used to store this ref.</param>
        /// <param name="name">name of this ref.</param>
        /// <param name="id">
        /// current value of the ref. 
        /// </param>
        /// <param name="p">the first non-tag object that tag {@code id} points to.</param>
        public PeeledTag(Storage st, string name, ObjectId id, ObjectId p)
            : base(st, name, id)
        {

            _peeledObjectId = p;
        }
开发者ID:dev218,项目名称:GitSharp,代码行数:15,代码来源:ObjectIdRef.cs


示例20: MapTag

        /// <summary>
        /// Access a Tag by SHA'1 id
        /// </summary>
        /// <param name="refName"></param>
        /// <param name="id"></param>
        /// <returns>Commit or null</returns>
        public Tag MapTag(string refName, ObjectId id)
        {
            ObjectLoader or = OpenObject(id);
            if (or == null) return null;

            byte[] raw = or.Bytes;

            if (ObjectType.Tag == (ObjectType)or.Type)
            {
                return new Tag(this, id, refName, raw);
            }

            return new Tag(this, id, refName, null);
        }
开发者ID:georgeck,项目名称:GitSharp,代码行数:20,代码来源:Repository.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Core.ObjectWriter类代码示例发布时间:2022-05-26
下一篇:
C# CLI.CmdParserOptionSet类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap