public IActionResult Projects() { JObject starredRepos = Github.GetStarredRepos(); ViewData["Message"] = "Your projects page."; return(View(starredRepos)); }
public void then_a_typed_list_should_be_able_to_be_returned() { var users = Github.GetUsers <List <Models.Users> >(); users.Data.Should().BeOfType <List <Models.Users> >(); users.Data.Count.Should().BeGreaterThan(0); }
async void Update() { if (IsVisible && !openDialog && await MessageWindow.Create( $"A new version of Apollo Studio is available ({(await Github.LatestRelease()).Name} - {(await Github.LatestDownload()).Size.Bytes().Humanize("#.##")}).\n\n" + "Do you want to update to the latest version?", new string[] { "Yes", "No" }, null ) == "Yes") { foreach (Window window in App.Windows) { if (window.GetType() != typeof(MessageWindow)) { window.Close(); } } if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Program.LaunchAdmin = true; } else { UpdateWindow.Create(this); } } }
public void Should_SeeDebugOutputInVSConsole() { using(var stream = new MemoryStream(TestResources.log4net)) log4net.Config.XmlConfigurator.Configure(stream); var github = new Github(GitHubUrl).WithLogger<Log4NetLog>(); }
public Github Index([FromServices] IConfiguration configuration) { var model = new Github(); model.CodeLink = configuration.GetSection("Github").GetValue <string>("Code"); return(model); }
public override void Because() { User = Username; RepoName = "Whatever"; RepoOwnerName = "Whatever"; Response = Github.CreateIssue <Issue>(RepoOwnerName, RepoName, Title, Body, User, Labels); }
protected void getPeeps() { System.Web.HttpBrowserCapabilities browser = Request.Browser; List <Github.Users> lst = Github.GetADUsers(txtSearchStr.Text); string rsults = string.Empty; for (int i = 0; i < lst.Count; i++) { if (browser.Browser == "IE" || browser.Browser == "Mozilla" || browser.Browser == "InternetExplorer" || browser.Browser == "Chrome") { if (((Github.Users)lst[i]).EmpPhoto == null) { rsults = rsults + "<div class='card' style='width:25rem;'><div class='margin-fix'><span class='icon-size'><img class='card-img-top img-responsive rounded-circle' src='../Assets/O14_person_placeHolder_192_small.png' width='87' height='87' alt='Card image cap' /></span><h4 class='card-title'>" + ((Github.Users)lst[i]).DisplayName + "</h4><h6 class='card-title'>" + ((Github.Users)lst[i]).Department + " Department" + "<br /> " + ((Github.Users)lst[i]).EmployeeTitle + ", <i class='fa fa-map-marker'></i> " + ((Github.Users)lst[i]).office + "</h6> <b>Reports to: </b> " + ((Github.Users)lst[i]).Manager + "</h6> <br /><b>Level 2 Manager: </b> " + ((Github.Users)lst[i]).Level2Manager + "</h6><br /><i class='fa fa-phone-square'></i> " + ((Github.Users)lst[i]).PhoneNumber + " <br /><i class='fa fa-mobile'></i> " + ((Github.Users)lst[i]).Mobile + "</div></div><br />"; } else { rsults = rsults + "<div class='card' style='width:25rem;'><div class='margin-fix'><span class='icon-size'><img class='card-img-top img-responsive rounded-circle' src='data:image/png;base64," + ((Github.Users)lst[i]).EmpPhoto + "' width='87' height='87' alt='Card image cap' /></span><h4 class='card-title'>" + ((Github.Users)lst[i]).DisplayName + "</h4><h6 class='card-title'>" + ((Github.Users)lst[i]).Department + " Department" + "<br /> " + ((Github.Users)lst[i]).EmployeeTitle + ", <i class='fa fa-map-marker'></i> " + ((Github.Users)lst[i]).office + "</h6><b>Reports to: </b> " + ((Github.Users)lst[i]).Manager + "</h6><br /> <b>Level 2 Manager: </b> " + ((Github.Users)lst[i]).Level2Manager + "</h6><br /><i class='fa fa-phone-square'></i> " + ((Github.Users)lst[i]).PhoneNumber + "<br /><i class='fa fa-mobile'></i> " + ((Github.Users)lst[i]).Mobile + "</div></div><br />"; } } else { } } lblResults.Text = rsults; }
/// <summary> /// Updates list of Github user's repositories when Github username is changed. /// </summary> protected async void UpdateRepoList() { ddlGithubRepo.Items.Clear(); lblMessages.Text = ""; try { List <string> repos = await Github.GetReposForUser(txtGithubUser.Text); if (repos != null && repos.Count > 0) { ddlGithubRepo.DataSource = repos; ddlGithubRepo.DataBind(); // Select active project's repo if it was set ListItem listItem = ddlGithubRepo.Items.FindByText(activeProject.github_reponame); if (listItem != null) { ddlGithubRepo.ClearSelection(); listItem.Selected = true; } } } catch (Exception ex) { lblMessages.Text = ex.Message; } }
/// <summary> /// Initializes stuff from Github (commits etc). /// </summary> protected async void InitGithub() { divCommitFeed.InnerHtml = ""; divLanguages.InnerHtml = ""; try { // Commit feed List <GitHubCommit> commits = await Github.GetCommits(activeProject.github_username, activeProject.github_reponame); if (commits != null && commits.Count > 0) { foreach (GitHubCommit c in commits) { divCommitFeed.InnerHtml += string.Format("<div class='feed-item'><div class='date'>{0}<br/>{1} pushed a commit:</div><div class='text'><a href='{2}'>{3}</a></div></div>", c.Commit.Author.Date.DateTime.ToShortDateString(), c.Commit.Author.Name, c.HtmlUrl, c.Commit.Message); } } // Programming languages List <RepositoryLanguage> languages = await Github.GetLanguages(activeProject.github_username, activeProject.github_reponame); if (languages != null && languages.Count > 0) { foreach (RepositoryLanguage l in languages) { divLanguages.InnerHtml += string.Format("<span class='label label-info' style='margin-right:5px'>{0}</span>", l.Name); } } } catch (Exception) { lblMessages.Text = "Failed loading stuff from Github! Probably API rate limit exceeded for your IP..."; } }
public void TestUsernamePasswordAuthentication() { io.Setup((o) => o.AskPassword("Token (hidden): ", false)) .Returns("token").Verifiable(); io.Setup((o) => o.SetAuthentication("github.com", "token", "x-oauth-basic")) .Verifiable(); transport.SetupGetString("https://api.github.com") .Returns("{}").Verifiable(); var sourceAuth = new Mock <IConfigSource>(); sourceAuth.Setup((o) => o.AddConfigSetting("github-oauth.github.com", "token")) .Verifiable(); config.Setup((o) => o.GetSourceAuth()) .Returns(sourceAuth.Object); var github = new Github(io.Object, config.Object, null, transport.Object); Assert.IsTrue(github.AuthorizeOAuthInteractively("github.com", "reason")); Verify(io, transport, sourceAuth); }
async void CheckUpdate() { if (await Github.ShouldUpdate()) { UpdateButton.Enable($"Updates are available for Apollo Studio ({(await Github.LatestRelease()).Name} - {(await Github.LatestDownload()).Size.Bytes().Humanize("#.##")})."); } }
async void CheckUpdate() { if (await Github.ShouldUpdate()) { UpdateButton.Enable(); } }
private bool IsVersionCurrent(out Version Version) { Version Current; Version Latest; string LatestVersion = ""; try { LatestVersion = Github.GetVersion(Constants.Version).GetAwaiter().GetResult(); } catch (Exception ex) { } if (Version.TryParse(Constants.Version, out Current) && Version.TryParse(LatestVersion, out Latest) && LatestVersion != "") { int result = Latest.CompareTo(Current); if (result > 0) { Version = Latest; return(false);//Latest is greater } else { Version = Current; return(true); // Is current, or in a dev environment with newer version in current } } Version = Current; return(true); }
public void SetupTest() { github = new Github(); fb = new Facebook(); gmail = new Gmail(); packtpub = new Packtpub(); }
public MainWindow() { AppInfo.Instance.Value.IsClosing = false; Crypto.LoadKey(); progress = new Progress(this); InitializeComponent(); if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.username)) AppInfo.Instance.Value.Username = Crypto.Decrypt(Properties.Settings.Default.username); if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.password)) AppInfo.Instance.Value.Password = Crypto.Decrypt(Properties.Settings.Default.password); login = new Login(); if (string.IsNullOrWhiteSpace(AppInfo.Instance.Value.Username)) { login.ShowDialog(); } git = new Github(AppInfo.Instance.Value.Username, AppInfo.Instance.Value.Password); Initialize(); }
private async void GetData() { try { if (MasterPRItems != null && MasterPRItems.Count > 0) { return; } await Task.Delay(1000); UserDialogs.Instance.ShowLoading(); MasterPRItems = new ObservableCollection <Models.Repository>(); PRItems = new ObservableCollection <Models.Repository>(); var model = await Github.GetRepositories(Paging); Paging = model.Count / 99; MasterPRItems = new ObservableCollection <Models.Repository>(model); PRItems = MasterPRItems; ErrorMessage = string.Empty; if (MasterPRItems.Count >= 999) { ShowLoadMore = false; } else { ShowLoadMore = true; } } finally { UserDialogs.Instance.HideLoading(); } }
static void Main(string[] args) { Console.Title = "GitBash"; File a = new File(); Github b = new Github(); //vs 1 a.Diretorio = @"C:\Users\aluno\Object3D"; a.NomeArquivo = "Musicas"; a.Texto = "Eu curto rock balboa"; a.ExibirInfo(); //salvando vs 1 b.CareTaker = a.SalvarCommits(); //vs 2 a.Diretorio = @"C:\Users\aluno\Object3D"; a.NomeArquivo = "Maçã"; a.Texto = "Maçã verde, cultivada em 1987 e mumificada pelo própio Isaaac Newton"; a.ExibirInfo(); //salvando vs 2 b.CareTaker = a.SalvarCommits(); //vs 3 a.Diretorio = @"C:\Users\aluno\JogoPi"; a.NomeArquivo = "Rodavort"; a.Texto = "O melhor jogo do mundo?"; a.ExibirInfo(); //regredindo para vs 2 a.VoltarCommits(b.CareTaker); a.ExibirInfo(); //regredindo para vs 1 a.VoltarCommits(b.CareTaker); a.ExibirInfo(); }
// GET: /<controller>/ public IActionResult GitStars() { //Github.TestGitAPI();//works //Github.GetGitRepos();//works, returns a JArray of 30 repos JObject githubRepos = Github.GetStarredRepos(); return(View(githubRepos)); }
public void then_dynamic_json_array_is_accessible() { var users = Github.GetUsers(); string url = users.Dynamic()[0].avatar_url; url.Should().NotBeNullOrEmpty(); }
/// <summary> /// Stars package github repository /// </summary> /// <param name="package"></param> /// <returns></returns> public async Task <bool> StarPackage(PackageReference package) { if ((package.Metadata?.HasGithub == false && package.Metadata?.HasParsedGithub == false) || string.IsNullOrEmpty(package.Metadata?.GithubUrl)) { throw new ArgumentException("Package must have github url!", nameof(package)); } return(await Github.StarRepo(package.Metadata.GithubUrl)); }
public override void Because() { User = Username; RepoName = "NeedARepoYouCanCreateIssuesIn"; RepoOwnerName = "Whatever"; Github = Github.WithAuthentication(Authenticator()); Response = Github.CreateIssue <Issue>(RepoOwnerName, RepoName, Title, Body, User, Labels); }
private static void PropertiesNotNull(Github gitHub) { Assert.That(gitHub != null); Assert.That(gitHub.Commits != null); Assert.That(gitHub.Issues != null); Assert.That(gitHub.Networks != null); Assert.That(gitHub.Objects != null); Assert.That(gitHub.Repositories != null); Assert.That(gitHub.Users != null); }
public void TestIsRateLimit(bool expected, string remainin) { var headers = new HttpTestHeaders { { "X-RateLimit-Remainin", remainin }, }; var github = new Github(io.Object, config.Object, null, transport.Object); Assert.AreEqual(expected, github.IsRateLimit(headers)); }
public async Task CheckForUpdate() { var latest = await Github.CheckForUpdate("djdookie", "Advisor", Version); if (latest != null) { Advisor.Notify("Plugin update available", $"[DOWNLOAD]({latest.html_url}) Advisor {latest.tag_name}", 0, "download", () => Process.Start(latest.html_url)); Log.Info("Update available: " + latest.tag_name, "Advisor"); } }
public async Task CheckForUpdate() { var latest = await Github.CheckForUpdate("kimsey0", "Advisor", Version); if (latest != null) { Advisor.Notify("Plugin update available", $"[DOWNLOAD]({latest.HtmlUrl}) Advisor {latest.TagName}", 0, "download", () => Process.Start(latest.HtmlUrl)); Log.Info($"Update available: {latest.TagName}", "Advisor"); } }
public override void Because() { User = Username; RepoName = "Whatever"; RepoOwnerName = "Whatever"; Github = Github.WithAuthentication(Authenticator()); IssueToUpdate = Github.CreateIssue <Issue>(RepoOwnerName, RepoName, "Isssue To Update", "Text to Update", User).Data; Response = Github.EditIssue <Issue>(RepoOwnerName, RepoName, IssueToUpdate.Number); }
public async void CreateServerCFG() { //Download serverconfig.json var replaceValues = new List <(string, string)>() { ("{{ServerName}}", _serverData.ServerName), ("{{Port}}", _serverData.ServerPort), ("{{MaxClients}}", _serverData.ServerMaxPlayer) }; await Github.DownloadGameServerConfig(ServerPath.GetServersServerFiles(_serverData.ServerID, "data", "serverconfig.json"), FullName, replaceValues); }
public void TestUsernamePasswordFailure() { io.Setup((o) => o.AskPassword("Token (hidden): ", false)) .Returns("token").Verifiable(); transport.SetupGetString("https://api.github.com") .Throws(new TransportException("failed", HttpStatusCode.Unauthorized, null)); var github = new Github(io.Object, config.Object, null, transport.Object); Assert.IsFalse(github.AuthorizeOAuthInteractively("github.com")); }
async void Loaded(object sender, EventArgs e) { Position = new PixelPoint(Position.X, Math.Max(0, Position.Y)); State.Text = "Downloading..."; WebClient downloader = new WebClient(); downloader.DownloadProgressChanged += Progress; downloader.DownloadDataCompleted += Downloaded; downloader.DownloadDataAsync(new Uri((await Github.LatestDownload()).BrowserDownloadUrl)); }
public UnitTest1() { var myConfiguration = new Dictionary <string, string>(); _configuration = new ConfigurationBuilder() .AddInMemoryCollection(myConfiguration) .Build(); _github = new Github(); _mockJuros = new MockRepository(MockBehavior.Default).Create <Juros>(_configuration); _mockJuros.Setup(x => x.RetornarTaxaDeJuros()).Returns(0.02); _mockDivida = new MockRepository(MockBehavior.Default).Create <Divida>(_configuration, _mockJuros.Object); }
public override int GetHashCode() { unchecked { int hashCode = base.GetHashCode(); hashCode = (hashCode * 397) ^ (Brand != null ? Brand.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Copyright != null ? Copyright.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Avatar != null ? Avatar.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Github != null ? Github.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Linkedin != null ? Linkedin.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Twitter != null ? Twitter.GetHashCode() : 0); return(hashCode); } }
public void HandleXrev(IRCMessage sIRCMessage) { var sSendMessage = sIrcBase.Networks[sIRCMessage.ServerName].sSendMessage; if (sIRCMessage.Info.Length < 5) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoValue", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (sIRCMessage.Info[4].ToLower() == "github") { var text = sLManager.GetCommandTexts("xrev/github", sIRCMessage.Channel, sIRCMessage.ServerName); if (text.Length < 7) { sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName))); return; } if (sIRCMessage.Info.Length < 6) { sSendMessage.SendChatMessage(sIRCMessage, text[0]); return; } if (sIRCMessage.Info.Length < 7) { sSendMessage.SendChatMessage(sIRCMessage, text[1]); return; } if (sIRCMessage.Info.Length < 8) { sSendMessage.SendChatMessage(sIRCMessage, text[2]); return; } var github = new Github(sIRCMessage.Info[5], sIRCMessage.Info[6], sIRCMessage.Info[7]); if (github.UserName.IsNullOrEmpty() || github.Message.IsNullOrEmpty() || github.Url.IsNullOrEmpty()) { sSendMessage.SendChatMessage(sIRCMessage, text[3]); return; } sSendMessage.SendChatMessage(sIRCMessage, text[4], github.Message); sSendMessage.SendChatMessage(sIRCMessage, text[5], github.Url); sSendMessage.SendChatMessage(sIRCMessage, text[6], github.UserName); } }
public static async Task RunAsync() { Directory.CreateDirectory("www"); var github = new Github(); var plotter = new Plotter("plots"); var dailyReportFileInfo = await github.GetFileInfoAsync( "CSSEGISandData", "COVID-19", "csse_covid_19_data/csse_covid_19_daily_reports"); var dailyReportCsvEngine = new FileHelperEngine <ReportData>(); var dailyReportData = new List <KeyValuePair <DateTime, List <ReportData> > >();
public async Task TestMethod1() { const string apiHost = "https://api.github.com"; const string appName = "githubvsintegrations"; var tokenFactory = new TokenFactory(apiHost, appName); var token = await tokenFactory.CreateAuthorization( TokensEtc.UserName, TokensEtc.Password, new[] {"public_repo"}); token.IsNotNull(); // API 一個呼べればトークン取得は正しいだろう var github = new Github(token, "githubvsintegrations", apiHost); var cancellationToken = new CancellationToken(); var repos = await github.ListUserRepository(cancellationToken); repos.IsNotNull(); repos = await github.ListUserRepository(cancellationToken); repos.IsNotNull(); }
public void Should_SeeDebugOutputInVSConsole() { var github = new Github(GitHubUrl).WithLogger(type => new DebugLogger(type)); }
public void Setup() { _github = new Github(GitHubUrl).WithLogger(type => new DebugLogger(type)); }
public void Setup() { var kernel = new StandardKernel(new JsonModule()); GitHub = kernel.Get<Github>(); }
private static void ServicesAreJsonServices(Github gitHub) { Assert.That(gitHub.Commits is JsonCommitService); Assert.That(gitHub.Issues is JsonIssueService); Assert.That(gitHub.Networks is JsonNetworkService); Assert.That(gitHub.Objects is JsonObjectService); Assert.That(gitHub.Repositories is JsonRepositoryService); Assert.That(gitHub.Users is JsonUserService); }
public void Setup() { _github = new Github(GitHubUrl).WithLogger<Log4NetLog>(); }
public void Setup() { Bootstrapper.Bootstrap(); _github = ObjectFactory.GetInstance<Github>(); }