public void GetOrganisationUsers(Repository repository) { GithubRepository.GetCollaborators(repository.Owner.Login, repository.Name).ContinueWith(t => { // this is a bullshit fix if (t.Exception != null) { return; } ExecuteOnMainThread(() => PopulateUsers(t.Result)); }); //if (repository.Owner.IsOrganization) //{ // GithubRepository // .GetOrganisationUsers(repository.Owner.Login) // .ContinueWith(t => // { // // this is a bullshit fix // if (t.Exception != null) return; // ExecuteOnMainThread(() => PopulateUsers(t.Result)); // }); //} //else //{ // PopulateUsers(new[] { repository.Owner }); //} }
private Repository RepositoryField(Repository repository) { if (repository is FileRepository) { FileRepository temp = (FileRepository)repository; temp.Path = EditorGUILayout.TextField("Path to file repository:", temp.Path); return(temp); } if (repository is GithubRepository) { GithubRepository temp = (GithubRepository)repository; temp.Url = EditorGUILayout.TextField("Url of github repository", temp.Url); if (temp.TagList != null) { temp.TagList = ArrayField <string>( temp.TagList, "Fetch from tag", "Add another tag", "sometag", tag => EditorGUILayout.TextField(tag) ); } return(temp); } EditorGUILayout.HelpBox(string.Format("The repository {0} is not a known type of repository!"), MessageType.Error); return(repository); }
public MainAction([Dependency("MainDispatcher")] MainDispatcher dispatcher, [Dependency("GithubRepository")] GithubRepository repository) { System.Diagnostics.Debug.WriteLine("MainAction # Constructor"); this.dispatcher = dispatcher; this.repository = repository; }
protected string MakeGetUrl(string filePath, GithubRepository repository) { StringBuilder urlBuilder = new StringBuilder(GITHUB_URL); urlBuilder.Append(repository.Full_Name).Append("/contents/").Append(filePath); return(urlBuilder.ToString()); }
private IEnumerable <Repository> GetProjectsForUser(Task <User> task) { if (task.Exception == null) { User = task.Result; } if (User == null) { return(Enumerable.Empty <Repository>()); } var repos = new List <Repository>(); var orgs = GithubRepository.GetOrganisations(User.Login).Result; var userRepos = GithubRepository.GetProjects(User.Login).Result; repos.AddRange(userRepos); foreach (var org in orgs) { var orgRepos = GithubRepository.GetProjects(org.Login).Result; repos.AddRange(orgRepos); } return(repos); }
public void Query_ValidUserAndRepo_MapsReturnedUserFieldsCorrectly() { // Arrange string userUrl = "https://api.github.com/users/robconery"; GithubUser githubUser = ValidGithubUser(); GithubRepo githubRepo = CreateRepo(1, 5); List <GithubRepo> githubRepos = new List <GithubRepo> { githubRepo }; Mock <IWebClient> webClient = new Mock <IWebClient>(); webClient.Setup(r => r.Query <GithubUser>(userUrl)).Returns(githubUser); webClient.Setup(r => r.Query <List <GithubRepo> >(githubUser.ReposUrl)).Returns(githubRepos); IRepository repository = new GithubRepository(webClient.Object); // Act IUser userReturned = repository.SearchUsers(githubUser.Login); // Assert Assert.Equal(githubUser.Login, userReturned.Login); Assert.Equal(githubUser.Name, userReturned.Name); Assert.Equal(githubUser.AvatarUrl, userReturned.AvatarUrl); Assert.Equal(githubUser.Location, userReturned.Location); Assert.Equal(githubUser.TopFiveMostPopularRepos[0].Name, userReturned.TopFiveMostPopularRepos[0].Name); Assert.Equal(githubUser.TopFiveMostPopularRepos[0].StargazersCount, userReturned.TopFiveMostPopularRepos[0].PopularityCount); }
public void GetGithubCommitsTest() { int expected = 1; IGitRepository gitRepository = new GithubRepository(); IEnumerable <DailyCommitStatistic> commits = gitRepository.GetDailyCommitStatistics(); int actual = commits.Count(); Assert.AreEqual(expected, actual); }
private void CheckForUpdates() { var version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); var updates = GithubRepository.HasUpdates(version).Result; if (updates) { UpdateNotification.Visibility = Visibility.Visible; UpdateNotification.UpdateLayout(); } }
public async Task <PullRequestPagedResult> GetPullRequests(int pageNumber, GithubRepository repository) { try { // get the first item from each repository state type we are interested in so we can get the paging headers. var firstOpenPr = _githubRepositories.GetFirstOpenPullRequest(repository.AuthorUsername, repository.Name); var firstClosedPr = _githubRepositories.GetFirstClosedPullRequest(repository.AuthorUsername, repository.Name); var firstPr = _githubRepositories.GetPullRequests(repository.AuthorUsername, repository.Name, 1, 1); // I think summing open and closed will give me the total but i need to read the docs to confirm // get paged pull requests var response = await _githubRepositories.GetPullRequests(repository.AuthorUsername, repository.Name, pageNumber); // use the 'last' paging header to determine the total count of each type var openPrCount = GetPageCountFromResponse(await firstOpenPr); var closedPrCount = GetPageCountFromResponse(await firstClosedPr); var totalPrCount = GetPageCountFromResponse(await firstPr); if (!response.IsSuccessStatusCode) { //throw exception } var pullRequests = new List <PullRequest>(); foreach (var pullRequest in response.Content) { pullRequests.Add(new PullRequest( pullRequest.title, pullRequest.body, pullRequest.user.avatar_url, pullRequest.user.login, pullRequest.created_at, pullRequest.html_url)); } var pagedResult = new PullRequestPagedResult() { Results = pullRequests, TotalCount = totalPrCount, TotalOpen = openPrCount, TotalClosed = closedPrCount }; return(pagedResult); } catch (Exception ex) { throw; } }
public void GetLabels(Repository repository) { Labels.Clear(); if (User == null || repository == null) { return; } if (repository.HasIssues) { GithubRepository.GetLabels(repository.Owner.Login, repository.Name) .ContinueWith(t => ExecuteOnMainThread(() => PopulateLabels(t.Result))); } }
public async Task <IActionResult> OnGetAsync(int id = -1) { if (id == -1) { return(NotFound()); } SelectedProject = await _context.Repositories.Include(r => r.AdditionalRepositoryData).FirstOrDefaultAsync(r => r.RepositoryId == id); if (SelectedProject == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> CreateRepo(GithubRepository githubRepo) { if (!ModelState.IsValid) { return(BadRequest()); } var existingRepo = await _repository.FindRepoByGithubIdAsync(githubRepo.RepositoryId); if (existingRepo != null) { return(BadRequest($"Failed to save. Repository '{githubRepo.Name}' already exists")); } _repository.CreateRepo(githubRepo); await _unitOfWork.SaveChangesAsync(); return(CreatedAtRoute("GetRepoById", new { id = githubRepo.Id }, githubRepo)); }
public void Query_ValidUserNoRepos_ReturnsEmptyReposCollection() { // Arrange string userUrl = "https://api.github.com/users/robconery"; GithubUser githubUser = ValidGithubUser(); Mock <IWebClient> webClient = new Mock <IWebClient>(); webClient.Setup(r => r.Query <GithubUser>(userUrl)).Returns(githubUser); webClient.Setup(r => r.Query <List <GithubRepo> >(githubUser.ReposUrl)).Returns(new List <GithubRepo>()); IRepository repository = new GithubRepository(webClient.Object); // Act IUser userReturned = repository.SearchUsers(githubUser.Login); // Assert Assert.NotNull(userReturned.TopFiveMostPopularRepos); Assert.Empty(userReturned.TopFiveMostPopularRepos); }
public override void Init() { Authenticate(); if (!IsGitWorkingTree()) { // Init git in current directory InitGitOnCurrentDirectory(); } IList <GithubRepository> repositories = GetRepositories(); if (!string.IsNullOrEmpty(RepositoryFullName)) { LinkedRepository = repositories.FirstOrDefault(r => r.FullName.Equals(RepositoryFullName, StringComparison.InvariantCultureIgnoreCase)); } else { var remoteUris = Git.GetRemoteUris(); if (remoteUris.Count == 1) { LinkedRepository = repositories.FirstOrDefault(r => RepositoryMatchUri(r, remoteUris.First())); } else if (remoteUris.Count > 0) { // filter repositories to reduce prompt options repositories = repositories.Where(r => remoteUris.Any(u => RepositoryMatchUri(r, u))).ToList(); } } if (LinkedRepository == null) { Collection <ChoiceDescription> choices = new Collection <ChoiceDescription>(repositories.Select(item => new ChoiceDescription(item.FullName)).ToList <ChoiceDescription>()); var choice = ((PSCmdlet)PSCmdlet).Host.UI.PromptForChoice( "Choose a repository", "", choices, 0 ); LinkedRepository = repositories.FirstOrDefault(r => r.FullName.Equals(choices[choice].Label)); } }
public GithubRepositoryDetails GetRepositoryDetails() { var HTMLCollector = new HTMLCollector(_url); // we could pass this in through the constructor, but this simplifies the client code. var html = HTMLCollector.Collect(); var contributorHTML = GetContributorHTML(0); var githubRepository = new GithubRepository( new WatchesAnalyzer(html), new StarsAnalyzer(html), new ReleasesAnalyzer(html), new PullRequestsAnalyzer(html), new IssuesAnalyzer(html), new ForksAnalyzer(html), new ContributorsAnalyzer(contributorHTML), new CommitsAnalyzer(html), new BranchesAnalyzer(html)); return(githubRepository.GetRepositoryDetails()); }
/// <summary> /// Default controller serves the main page for the User Search application /// </summary> /// <param name="loginname"> /// A source control user's login name used to search in a source control system for /// details of the user. Validated against a whitelist of allowed characters on both the /// client and the server to help guard against injection attacks. /// </param> /// <returns> /// The main page of the User Search application including /// any details of searched for users if the user has entered /// a login name and clicked search. /// </returns> public ActionResult Index(string loginname) { IUser user = new User(); if (!String.IsNullOrWhiteSpace(loginname)) { Regex rx = new Regex("^[a-zA-Z0-9-.]{1,39}$", RegexOptions.Compiled | RegexOptions.IgnoreCase); if (!rx.IsMatch(loginname)) { ModelState.AddModelError("Login", "Username may only contain alphanumeric characters or hyphens and cannot be longer than 39 characters"); return(View(user)); } IWebClient webClient = new WebClient(); IRepository repository = new GithubRepository(webClient); ISearch search = new Search(repository); user = search.SearchUsers(loginname); } return(View(user)); }
public ValidationResult <Issue> CreateIssue() { if (User == null || SelectedProject == null || string.IsNullOrWhiteSpace(Title) || string.IsNullOrWhiteSpace(Body)) { return(ValidationResult <Issue> .Failure("Please enter all details")); } string assigned; if (AssignedUser == null || AssignedUser.Login == "No User") { assigned = null; } else { assigned = AssignedUser.Login; } int?milestone; if (SelectedMilestone == null || SelectedMilestone.Title == "No Milestone") { milestone = null; } else { milestone = SelectedMilestone.Number; } string[] selectedLabels = Labels.Where(l => l.IsChecked).Select(l => l.Name).ToArray(); try { var result = GithubRepository.CreateIssue(SelectedProject.Owner.Login, SelectedProject.Name, Title, Body, assigned, milestone, selectedLabels).Result; return(ValidationResult <Issue> .Success.WithData(result)); } catch (Exception ex) { return(ValidationResult <Issue> .Failure("Error Uploading Issue: " + ex.Message)); } }
public Dictionary <User, IEnumerable <User> > GetOrganisationUsers() { var results = new Dictionary <User, IEnumerable <User> >(); if (User == null) { return(results); } var organisations = GithubRepository.GetOrganisations(User.Login).Result.ToList(); organisations.Add(User); foreach (var repo in organisations) { var result = GithubRepository.GetOrganisationUsers(repo.Login).Result; results.Add(repo, result); } return(null); }
public async Task <IActionResult> OnGetAsync(int id = -1) { if (id == -1) { return(NotFound()); } // Retrieve project from database and set the bound property accordingly SelectedProject = await _context.Repositories.Include(r => r.AdditionalRepositoryData).FirstOrDefaultAsync(r => r.RepositoryId == id); Upload = new CustomExperienceUpload { AdditionalRepositoryData = SelectedProject.AdditionalRepositoryData }; if (SelectedProject == null) { return(NotFound()); } return(Page()); }
public void GetMilestonesFor(Repository repository) { if (User == null || repository == null) { return; } if (repository.HasIssues) { GithubRepository .GetMilestones(repository.Owner.Login, repository.Name) .ContinueWith(t => { if (t.Exception != null) { return; } ExecuteOnMainThread(() => PopulateMilestones(t.Result)); }); } }
static void Main(string[] args) { var project = new Project { Name = "CppSharp" }; var repo = new GithubRepository(project) { Owner = "mono", Name = "CppSharp", URL = @"https://github.com/mono/CppSharp.git", MinRevision = new Commit("cd3e729d3873a845eacee4260480e4c3dfe14579") }; project.Repositories.Add(repo); var config = new BuildConfiguration(); project.Configurations.Add(config); var options = new Options { OutputDir = @"C:\builds\", Username = "******", Token = "a32086c82fb50fc7acc4b33a5d183e23d4efa997" }; Task.Run((() => LaunchBuildAgent(options))); using (var server = new BuildServer(options)) { ConsoleUtils.SetupExitHandler(sig => { server.IsExiting = true; return(true); }); server.Projects.Add(project); server.RunServer(); } }
private bool RepositoryMatchUri(GithubRepository githubRepository, string remoteUri) { string cleanUri; try { UriBuilder uri = new UriBuilder(remoteUri) { UserName = null, Password = null }; cleanUri = uri.ToString(); } catch { // Fail gracefully to handle ssh scenario cleanUri = remoteUri; } return(new UriBuilder(githubRepository.CloneUrl).ToString().Equals(cleanUri, StringComparison.InvariantCultureIgnoreCase) || new UriBuilder(githubRepository.HtmlUrl).ToString().Equals(cleanUri, StringComparison.InvariantCultureIgnoreCase) || new UriBuilder(githubRepository.GitUrl).ToString().Equals(cleanUri, StringComparison.InvariantCultureIgnoreCase) || githubRepository.SshUrl.Equals(cleanUri, StringComparison.InvariantCultureIgnoreCase)); }
public void Login() { SearchingForRepositories = true; try { if (User == null) { GithubRepository.GetUser() .ContinueWith <IEnumerable <Repository> >(GetProjectsForUser) .ContinueWith(AssignProjects); } else { GithubRepository.GetProjects(User.Login) .ContinueWith(AssignProjects); } } catch { Projects = new ObservableCollection <Repository>(); } }
public void Query_ValidUserTenRepos_ReturnsTopFiveReposOrderedCorrectly() { // Arrange string userUrl = "https://api.github.com/users/robconery"; GithubUser githubUser = ValidGithubUser(); GithubRepo repo1 = CreateRepo(1, 5); GithubRepo repo2 = CreateRepo(2, 500); GithubRepo repo3 = CreateRepo(3, 51); GithubRepo repo4 = CreateRepo(4, 43); GithubRepo repo5 = CreateRepo(5, 56); GithubRepo repo6 = CreateRepo(6, 999); GithubRepo repo7 = CreateRepo(7, 0); GithubRepo repo8 = CreateRepo(8, 14); GithubRepo repo9 = CreateRepo(9, 23); GithubRepo repo10 = CreateRepo(10, 34); List <GithubRepo> githubRepos = new List <GithubRepo> { repo1, repo2, repo3, repo4, repo5, repo6, repo7, repo8, repo9, repo10 }; Mock <IWebClient> webClient = new Mock <IWebClient>(); webClient.Setup(r => r.Query <GithubUser>(userUrl)).Returns(githubUser); webClient.Setup(r => r.Query <List <GithubRepo> >(githubUser.ReposUrl)).Returns(githubRepos); IRepository repository = new GithubRepository(webClient.Object); // Act IUser userReturned = repository.SearchUsers(githubUser.Login); // Assert Assert.NotNull(userReturned.TopFiveMostPopularRepos); Assert.Equal(5, userReturned.TopFiveMostPopularRepos.Count); Assert.Equal(repo6.Name, userReturned.TopFiveMostPopularRepos[0].Name); Assert.Equal(repo2.Name, userReturned.TopFiveMostPopularRepos[1].Name); Assert.Equal(repo5.Name, userReturned.TopFiveMostPopularRepos[2].Name); Assert.Equal(repo3.Name, userReturned.TopFiveMostPopularRepos[3].Name); Assert.Equal(repo4.Name, userReturned.TopFiveMostPopularRepos[4].Name); }
void OnRepositoryChange(GithubRepository repository, List <Commit> commits) { foreach (var commit in commits) { if (commit.BuildSet != null) { continue; } // Spawn a set of builds for this commit. var buildSet = new BuildSet { Commit = commit }; commit.BuildSet = buildSet; Branch branch; commit.Branch.TryGetTarget(out branch); Repository repo; branch.Repository.TryGetTarget(out repo); var buildConfiguration = repo.Project.DefaultBuildConfiguration; buildConfiguration.Directory = Options.OutputDir; Log.Message("Spawning new build for {0}/{1}", repo.Project.Name, commit.ToString()); var build = new Build(repo.Project, commit, buildConfiguration); buildSet.Builds.Add(build); Database.AddBuild(build); BuildQueue.AddBuild(build); } }
private void btnQuery_Click(object sender, EventArgs e) { if (!String.IsNullOrWhiteSpace(queryText)) { Cursor.Current = Cursors.WaitCursor; //the database is checked... using (DatabaseContext db = new DatabaseContext()) { lblStatus.Text = "Checking the database..."; List <GithubUser> result = (from i in db.GithubUser where i.Login == queryText select i).ToList(); status = result.Count; // it is true if it is not zero. } if (status != 0) { lblStatus.Text = "Getting data from the database..."; GetUserAndRepo(); } else { lblStatus.Text = "Getting data from Github ..."; //insert from api to db. using (DatabaseContext db = new DatabaseContext()) { try { string repoUrl = "https://api.github.com/users/" + queryText + "/repos"; List <GithubRepoForJson> repos = Global.GetDeserializeJson <List <GithubRepoForJson> >(repoUrl); lblStatus.Text = "Saving data to the database..."; List <GithubRepository> reposForUser = new List <GithubRepository>(); foreach (GithubRepoForJson repo in repos) { GithubRepository r = new GithubRepository(); r.FullName = repo.full_name; r.CreatedAt = repo.created_at; r.DownloadUrl = "https://github.com/" + repo.full_name + "/archive/master.zip"; reposForUser.Add(r); } // string userUrl = "https://api.github.com/users/" + queryText; GithubUserForJson user = Global.GetDeserializeJson <GithubUserForJson>(userUrl); GithubUser u = new GithubUser(); u.Login = user.login; u.HtmlUrl = user.html_url; u.Name = user.name; u.AvatarUrl = user.avatar_url; u.Followers = user.followers; u.Following = user.following; u.Repository = reposForUser; db.GithubUser.Add(u); db.SaveChanges(); //select from db lblStatus.Text = "Getting data from the database..."; GetUserAndRepo(); } catch { MessageBox.Show("Error! Github user was not found. Please try again..."); lblStatus.Text = "Unsuccessful..."; } } } } else { MessageBox.Show("Warning! Please enter a Github \"Login Name\"..."); } }
public static Tuple <long, string, string> PullRequestParams(this GithubRepository githubRepository) { //Also if not working you can get "pulls_url" field from Json return(new Tuple <long, string, string>(githubRepository.Id, githubRepository.Owner.Login, githubRepository.RepositoryName)); }
public Dotnet(SocketIO client) { this.client = client; client.On("_visualizedependency", repo => { Task.Run(async() => { GithubRepository githubRepository = JsonConvert.DeserializeObject <GithubRepository>(repo.Text); if (githubRepository != null) { IServer _SServer = new SServer(new DbContext()); Console.WriteLine($"{githubRepository.full_name} Proje Bağımlılıkları Görüntüleme İşlemi Başladı."); Server server = _SServer.GetRandomServer(); if (server != null) { Console.WriteLine($"{githubRepository.full_name} Projesi {server.server_name} Sunucusunda İşlenecek!"); SshClient sshClient = null; if (Debugger.IsAttached) { sshClient = new SshClient(server.local_ip, server.local_port, "root", ""); } else { sshClient = new SshClient(server.remote_ip, server.remote_port, "root", ""); } using (sshClient) { try { sshClient.Connect(); SshCommand lsCommand = sshClient.CreateCommand("ls"); using (lsCommand) { lsCommand.Execute(); string message = lsCommand.Result; string[] bufferArr = message.Split('\n'); List <string> directories = new List <string>(bufferArr); directories.RemoveAll(x => String.IsNullOrEmpty(x)); if (directories.Contains(githubRepository.name)) { Console.WriteLine($"{githubRepository.full_name} {server.server_name} Sunucusunda Bulundu ve Silindi!"); SshCommand rmCommand = sshClient.CreateCommand($"rm -r {githubRepository.name}"); using (rmCommand) { rmCommand.Execute(); } } } SshCommand cloneCommand = sshClient.CreateCommand($"git clone {githubRepository.clone_url} && echo repository cloned"); using (cloneCommand) { cloneCommand.BeginExecute(); while (true) { Stream commandStream = cloneCommand.OutputStream; byte[] streamArr = new byte[commandStream.Length]; commandStream.Read(streamArr, 0, (int)commandStream.Length); string message = Encoding.ASCII.GetString(streamArr); if (message.Contains("repository cloned")) { Console.WriteLine($"{githubRepository.full_name} Projesi {server.server_name} Sunucusuna Başarıyla İndirildi!"); break; } Thread.Sleep(2000); } } SshCommand searchCommand = sshClient.CreateCommand($"find /root/{githubRepository.name}/ -name '*.csproj'"); using (searchCommand) { searchCommand.Execute(); string searchCommandResult = searchCommand.Result; string[] bufferArr = searchCommandResult.Split('\n'); List <string> csprojFiles = new List <string>(bufferArr); csprojFiles.RemoveAll(x => String.IsNullOrEmpty(x)); if (csprojFiles.Count > 0) { Console.WriteLine($"{githubRepository.full_name} Projesine Ait {csprojFiles.Count} Adet CSPROJ Dosyası Bulundu!"); SftpClient sftp = null; if (Debugger.IsAttached) { sftp = new SftpClient(server.local_ip, server.local_port, "root", ""); } else { sftp = new SftpClient(server.remote_ip, server.remote_port, "root", ""); } using (sftp) { sftp.Connect(); SocketEntity socketEntity = new SocketEntity(); foreach (string csprojfile in csprojFiles) { string[] csprojArr = csprojfile.Split('/'); string projectName = (csprojArr[csprojArr.Length - 1]).Replace(".csproj", ""); string fileName = Guid.NewGuid().ToString() + ".csproj"; string path = Directory.GetCurrentDirectory() + $"/{fileName}"; using (Stream stream = File.Create(path)) { sftp.DownloadFile(csprojfile, stream); } if (File.Exists(path)) { string csprojContent = File.ReadAllText(path); File.Delete(path); Project project = null; using (var stringReader = new System.IO.StringReader(csprojContent)) { var serializer = new XmlSerializer(typeof(Project)); project = serializer.Deserialize(stringReader) as Project; } if (project != null) { SocketEntity.Project socketProject = new SocketEntity.Project(); socketProject.name = projectName; socketProject.sdk = project.Sdk; foreach (ItemGroup itemGroup in project.ItemGroup) { if (itemGroup.PackageReference.Count > 0) { List <SocketEntity.Reference> references = itemGroup.PackageReference.Select(x => new SocketEntity.Reference { include = x.Include, includeType = (int)enumIncludeType.package, version = x.Version }).ToList(); socketProject.references.AddRange(references); } if (itemGroup.ProjectReference.Count > 0) { foreach (ProjectReference projectReference in itemGroup.ProjectReference) { string include = projectReference.Include; string[] includeArr = include.Split('\\'); include = (includeArr[includeArr.Length - 1]).Replace(".csproj", ""); socketProject.references.Add(new SocketEntity.Reference { include = include, includeType = (int)enumIncludeType.project, version = "" }); } } } foreach (PropertyGroup propertyGroup in project.PropertyGroup) { if (!String.IsNullOrEmpty(propertyGroup.TargetFramework)) { socketProject.targetFramework = propertyGroup.TargetFramework; } if (!String.IsNullOrEmpty(socketProject.targetFramework)) { break; } } socketEntity.projects.Add(socketProject); } else { Console.WriteLine($"{githubRepository.full_name} CSPROJ Dosyası Okunamadı!"); return; } } else { Console.WriteLine($"{githubRepository.full_name} CSPROJ Dosyası İndirilemedi!"); return; } } Console.WriteLine($"{githubRepository.full_name} Projesi Başarıyla İşlendi!"); client.EmitAsync("showDependency", githubRepository, socketEntity).Wait(); } } else { Console.WriteLine($"{githubRepository.full_name} Reposuna Ait Bir CSPROJ Dosyası Bulunamadı!"); return; } } } catch (Exception ex) { Console.WriteLine($"{ex.Message}"); } } } else { Console.WriteLine("Aktif Bir Sunucu Bulunamadı!"); return; } } else { Console.WriteLine("Hatalı Bir Veri Geldi!"); return; } }); }); }
public void CreateRepo(GithubRepository repo) { _context.Repositories.AddAsync(repo); }
public void DeleteRepo(GithubRepository repo) { _context.Repositories.Remove(repo); }
private bool RepositoryMatchUri(GithubRepository githubRepository, string remoteUri) { string cleanUri; try { UriBuilder uri = new UriBuilder(remoteUri) {UserName = null, Password = null}; cleanUri = uri.ToString(); } catch { // Fail gracefully to handle ssh scenario cleanUri = remoteUri; } return new UriBuilder(githubRepository.CloneUrl).ToString().Equals(cleanUri, StringComparison.InvariantCultureIgnoreCase) || new UriBuilder(githubRepository.HtmlUrl).ToString().Equals(cleanUri, StringComparison.InvariantCultureIgnoreCase) || new UriBuilder(githubRepository.GitUrl).ToString().Equals(cleanUri, StringComparison.InvariantCultureIgnoreCase) || githubRepository.SshUrl.Equals(cleanUri, StringComparison.InvariantCultureIgnoreCase); }
private bool RepositoryMatchUri(GithubRepository githubRepository, string remoteUri) { UriBuilder uri = new UriBuilder(remoteUri) { UserName = null, Password = null }; string cleanUri = uri.ToString(); return new UriBuilder(githubRepository.CloneUrl).ToString().Equals(cleanUri, StringComparison.InvariantCultureIgnoreCase) || new UriBuilder(githubRepository.HtmlUrl).ToString().Equals(cleanUri, StringComparison.InvariantCultureIgnoreCase) || new UriBuilder(githubRepository.GitUrl).ToString().Equals(cleanUri, StringComparison.InvariantCultureIgnoreCase); }
public override void Init() { Authenticate(); if (!IsGitWorkingTree()) { // Init git in current directory InitGitOnCurrentDirectory(); } IList<GithubRepository> repositories = GetRepositories(); if (!string.IsNullOrEmpty(RepositoryFullName)) { LinkedRepository = repositories.FirstOrDefault(r => r.FullName.Equals(RepositoryFullName, StringComparison.InvariantCultureIgnoreCase)); } else { var remoteUris = Git.GetRemoteUris(); if (remoteUris.Count == 1) { LinkedRepository = repositories.FirstOrDefault(r => RepositoryMatchUri(r, remoteUris.First())); } else if (remoteUris.Count > 0) { // filter repositories to reduce prompt options repositories = repositories.Where(r => remoteUris.Any(u => RepositoryMatchUri(r, u))).ToList(); } } if (LinkedRepository == null) { Collection<ChoiceDescription> choices = new Collection<ChoiceDescription>(repositories.Select(item => new ChoiceDescription(item.FullName)).ToList<ChoiceDescription>()); var choice = ((PSCmdlet)Pscmdlet).Host.UI.PromptForChoice( "Choose a repository", "", choices, 0 ); LinkedRepository = repositories.FirstOrDefault(r => r.FullName.Equals(choices[choice].Label)); } }