/// <summary>
 /// Initializes a new instance of the <see cref="RemoteRepositoryModel"/> class.
 /// </summary>
 /// <param name="id">The API ID of the repository.</param>
 /// <param name="name">The repository name.</param>
 /// <param name="cloneUrl">The repository's clone URL.</param>
 /// <param name="isPrivate">Whether the repository is private.</param>
 /// <param name="isFork">Whether the repository is a fork.</param>
 /// <param name="ownerAccount">The repository owner account.</param>
 public RemoteRepositoryModel(long id, string name, UriString cloneUrl, bool isPrivate, bool isFork, IAccount ownerAccount)
     : base(name, cloneUrl)
 {
     Id           = id;
     OwnerAccount = ownerAccount;
     IsFork       = isFork;
     SetIcon(isPrivate, isFork);
     // this is an assumption, we'd have to load the repo information from octokit to know for sure
     // probably not worth it for this ctor
     DefaultBranch = new BranchModel("master", this);
 }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RemoteRepositoryModel"/> class.
        /// </summary>
        /// <param name="id">The API ID of the repository.</param>
        /// <param name="name">The repository name.</param>
        /// <param name="cloneUrl">The repository's clone URL.</param>
        /// <param name="isPrivate">Whether the repository is private.</param>
        /// <param name="isFork">Whether the repository is a fork.</param>
        /// <param name="ownerAccount">The repository owner account.</param>
        /// <param name="parent">The parent repository if this repository is a fork.</param>
        /// <param name="defaultBranchName">The default branch name (or "master" if undefined).</param>
        public RemoteRepositoryModel(long id, string name, UriString cloneUrl, bool isPrivate, bool isFork, IAccount ownerAccount,
                                     RemoteRepositoryModel parent, string defaultBranchName = "master")
            : base(name, cloneUrl)
        {
            Guard.ArgumentNotEmptyString(name, nameof(name));

            Id           = id;
            OwnerAccount = ownerAccount;
            IsFork       = isFork;
            SetIcon(isPrivate, isFork);
            DefaultBranch = new BranchModel(defaultBranchName, this);
            Parent        = parent;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoteRepositoryModel"/> class.
 /// </summary>
 /// <param name="repository">The source octokit repository.</param>
 public RemoteRepositoryModel(Octokit.Repository repository)
     : base(repository.Name, repository.CloneUrl)
 {
     Id     = repository.Id;
     IsFork = repository.Fork;
     SetIcon(repository.Private, IsFork);
     OwnerAccount  = new Account(repository.Owner);
     DefaultBranch = new BranchModel(repository.DefaultBranch, this);
     Parent        = repository.Parent != null ? new RemoteRepositoryModel(repository.Parent) : null;
     if (Parent != null)
     {
         Parent.DefaultBranch.DisplayName = Parent.DefaultBranch.Id;
     }
 }