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


C# Commit.setEncoding方法代码示例

本文整理汇总了C#中Commit.setEncoding方法的典型用法代码示例。如果您正苦于以下问题:C# Commit.setEncoding方法的具体用法?C# Commit.setEncoding怎么用?C# Commit.setEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Commit的用法示例。


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

示例1: test024_createCommitNonAscii

 public void test024_createCommitNonAscii()
 {
     ObjectId emptyId = new ObjectWriter(db).WriteBlob(new byte[0]);
     Tree almostEmptyTree = new Tree(db);
     almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, Encoding.ASCII.GetBytes("empty"), false));
     ObjectId almostEmptyTreeId = new ObjectWriter(db).WriteTree(almostEmptyTree);
     Commit commit = new Commit(db);
     commit.TreeId = (almostEmptyTreeId);
     commit.Author = (new PersonIdent("Joe H\u00e4cker", "[email protected]", 4294967295L, 60));
     commit.Committer = (new PersonIdent("Joe Hacker", "[email protected]", 4294967295L, 60));
     commit.setEncoding("ISO-8859-1");
     commit.Message = "\u00dcbergeeks";
     ObjectId cid = new ObjectWriter(db).WriteCommit(commit);
     var s = new Inspector(db).Inspect(cid);
     Assert.AreEqual("2979b39d385014b33287054b87f77bcb3ecb5ebf", cid.ToString());
 }
开发者ID:mneedham,项目名称:GitSharp,代码行数:16,代码来源:WriteTests.cs

示例2: test023_createCommitNonAnullii

 public void test023_createCommitNonAnullii()
 {
     ObjectId emptyId = new ObjectWriter(db).WriteBlob(new byte[0]);
     Tree almostEmptyTree = new Tree(db);
     almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, Encoding.ASCII.GetBytes("empty"), false));
     ObjectId almostEmptyTreeId = new ObjectWriter(db).WriteTree(almostEmptyTree);
     Commit commit = new Commit(db);
     commit.TreeId = (almostEmptyTreeId);
     commit.Author = (new PersonIdent("Joe H\u00e4cker", "[email protected]", 4294967295L, 60));
     commit.Committer = (new PersonIdent("Joe Hacker", "[email protected]", 4294967295L, 60));
     commit.setEncoding("UTF-8");
     commit.Message = ("\u00dcbergeeks");
     ObjectId cid = new ObjectWriter(db).WriteCommit(commit);
     Assert.AreEqual("4680908112778718f37e686cbebcc912730b3154", cid.ToString());
 }
开发者ID:mneedham,项目名称:GitSharp,代码行数:15,代码来源:WriteTests.cs


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