GitSharp.Core.PersonIdent.ToExternalString C# (CSharp) Method

ToExternalString() public method

Format for Git storage.
public ToExternalString ( ) : string
return string
        public string ToExternalString()
        {
            var r = new StringBuilder();

            r.Append(Name);
            r.Append(" <");
            r.Append(EmailAddress);
            r.Append("> ");
            r.Append(When / 1000);
            r.Append(' ');
            appendTimezone(r);

            return r.ToString();
        }

Usage Example

示例#1
0
        private static void AppendOneRecord(ObjectId oldId, ObjectId newId, PersonIdent ident, string msg, Repository db, string refName)
        {
            ident = ident == null ? new PersonIdent(db) : new PersonIdent(ident);

            var r = new StringBuilder();

            r.Append(ObjectId.ToString(oldId));
            r.Append(' ');
            r.Append(ObjectId.ToString(newId));
            r.Append(' ');
            r.Append(ident.ToExternalString());
            r.Append('\t');
            r.Append(msg);
            r.Append('\n');

            byte[] rec    = Constants.encode(r.ToString());
            var    logdir = new DirectoryInfo(Path.Combine(db.Directory.FullName, Constants.LOGS));
            var    reflog = new FileInfo(Path.Combine(logdir.FullName, refName));

            if (reflog.Exists || db.Config.getCore().isLogAllRefUpdates())
            {
                DirectoryInfo refdir = reflog.Directory;

                if (!refdir.Exists && !refdir.Mkdirs())
                {
                    throw new IOException("Cannot create directory " + refdir);
                }

                using (var @out = new FileStream(reflog.FullName, System.IO.FileMode.Append, FileAccess.Write))
                {
                    @out.Write(rec, 0, rec.Length);
                }
            }
        }
All Usage Examples Of GitSharp.Core.PersonIdent::ToExternalString