using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using Octokit.Internal; namespace Octokit { [DebuggerDisplay("{DebuggerDisplay,nq}")] public class TreeItem { public TreeItem() { } public TreeItem(string path, string mode, TreeType type, int size, string sha, string url) { Path = path; Mode = mode; Type = type; Size = size; Sha = sha; Url = url; } /// /// The path for this Tree Item. /// public string Path { get; protected set; } /// /// The mode of this Tree Item. /// public string Mode { get; protected set; } /// /// The type of this Tree Item. /// [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")] public StringEnum Type { get; protected set; } /// /// The size of this Tree Item. /// public int Size { get; protected set; } /// /// The SHA of this Tree Item. /// public string Sha { get; protected set; } /// /// The URL of this Tree Item. /// public string Url { get; protected set; } internal string DebuggerDisplay { get { return string.Format(CultureInfo.InvariantCulture, "Sha: {0}, Path: {1}, Type: {2}, Size: {3}", Sha, Path, Type, Size); } } } public enum TreeType { [Parameter(Value = "blob")] Blob, [Parameter(Value = "tree")] Tree, [Parameter(Value = "commit")] Commit } /// /// The file mode to associate with a tree item /// public static class FileMode { /// /// Mark the tree item as a file (applicable to blobs only) /// public const string File = "100644"; /// /// Mark the tree item as an executable (applicable to blobs only) /// public const string Executable = "100755"; /// /// Mark the tree item as a subdirectory (applicable to trees only) /// public const string Subdirectory = "040000"; /// /// Mark the tree item as a submodule (applicable to commits only) /// [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Submodule")] public const string Submodule = "160000"; /// /// Mark the tree item as a symlink (applicable to blobs only) /// [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Symlink")] public const string Symlink = "120000"; } }