Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: build

on:
push:
pull_request:
branches: [main]

env:
DOTNET_VERSION: "6.0.x" # The .NET SDK version to use
Expand Down
Binary file added Documentation/VisualPairCoding_Animation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/VisualPairCoding_SessionMenu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ A small Winforms app to visually display whos turn it is when coding together in
- Up to 5 Participants
- The length of the session is customizable
- Skip current "Driver" if he/she is absent
- Animation with the name of the next "Driver" when roles change

## Idea

Expand All @@ -18,6 +19,10 @@ The Main Menu of the App

![VisualPairCoding Main Menu](./Documentation/VisualPairCoding_MainMenu.png)

Coding Session
Coding Session. (Can be moved by clicking anywhere in the content of the window)

![VisualPairCoding Session](./Documentation/VisualPairCoding_SessionMenu.png)

The Animation when the next driver is Up

![VisualPairCoding Session](./Documentation/VisualPairCoding_Animation.png)
239 changes: 239 additions & 0 deletions Source/VisualPairCoding/VisualPairCoding.BL/GithubAPIResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@

using VisualPairCoding.Interfaces;

namespace VisualPairCoding.BL;
public class GithubAPIResponse : IGithubAPIResponse
{

public string Url { get; }

public string Assets_url { get; }

public string Upload_url { get; }

public string Html_url { get; }

public int Id { get; }

public GithubAuthor Author { get; }

public string Node_id { get; }

public string Tag_name { get; }

public string Target_commitish { get; }

public string Name { get; }

public bool Draft { get; }

public bool Prerelease { get; }

public DateTime Created_at { get; }

public DateTime Published_at { get; }

public GithubReleaseAsset[] Assets { get; }

public string Tarball_url { get; }

public string Zipball_url { get; }

public string Body { get; }

IGithubAuthor IGithubAPIResponse.Author { get; }

IGithubReleaseAsset[] IGithubAPIResponse.Assets { get; }

public GithubAPIResponse(string url, string assets_url, string upload_url, string html_url, int id, GithubAuthor author, string node_id, string tag_name, string target_commitish, string name, bool draft, bool prerelease, DateTime created_at, DateTime published_at, GithubReleaseAsset[] assets, string tarball_url, string zipball_url, string body)
{
Url = url;
Assets_url = assets_url;
Upload_url = upload_url;
Html_url = html_url;
Id = id;
Author = author;
Node_id = node_id;
Tag_name = tag_name;
Target_commitish = target_commitish;
Name = name;
Draft = draft;
Prerelease = prerelease;
Created_at = created_at;
Published_at = published_at;
Assets = assets;
Tarball_url = tarball_url;
Zipball_url = zipball_url;
Body = body;
}
}

public class GithubAuthor : IGithubAuthor
{

public string Login { get; }

public int Id { get; }

public string Node_id { get; }

public string Avatar_url { get; }

public string Gravatar_id { get; }

public string Url { get; }

public string Html_url { get; }

public string Followers_url { get; }

public string Following_url { get; }

public string Gists_url { get; }

public string Starred_url { get; }

public string Subscriptions_url { get; }

public string Organizations_url { get; }

public string Repos_url { get; }

public string Events_url { get; }

public string Received_events_url { get; }

public string Type { get; }

public bool Site_admin { get; }

public GithubAuthor(string login, int id, string node_id, string avatar_url, string gravatar_id, string url, string html_url, string followers_url, string following_url, string gists_url, string starred_url, string subscriptions_url, string organizations_url, string repos_url, string events_url, string received_events_url, string type, bool site_admin)
{
Login = login;
Id = id;
Node_id = node_id;
Avatar_url = avatar_url;
Gravatar_id = gravatar_id;
Url = url;
Html_url = html_url;
Followers_url = followers_url;
Following_url = following_url;
Gists_url = gists_url;
Starred_url = starred_url;
Subscriptions_url = subscriptions_url;
Organizations_url = organizations_url;
Repos_url = repos_url;
Events_url = events_url;
Received_events_url = received_events_url;
Type = type;
Site_admin = site_admin;
}
}

public class GithubReleaseAsset : IGithubReleaseAsset
{
public string Url { get; }

public int Id { get; }

public string Node_id { get; }

public string Name { get; }

public string Label { get; }

public GithubReleaseUploader Uploader { get; }

public string Content_type { get; }

public string State { get; }

public int Size { get; }

public int Download_count { get; }

public DateTime Created_at { get; }

public DateTime Updated_at { get; }

IGithubReleaseUploader IGithubReleaseAsset.Uploader { get; }

public string Browser_download_url { get; }

public GithubReleaseAsset(string url, int id, string node_id, string name, string label, GithubReleaseUploader uploader, string content_type, string state, int size, int download_count, DateTime created_at, DateTime updated_at, string browser_download_url)
{
Url = url;
Id = id;
Node_id = node_id;
Name = name;
Label = label;
Uploader = uploader;
Content_type = content_type;
State = state;
Size = size;
Download_count = download_count;
Created_at = created_at;
Updated_at = updated_at;
Browser_download_url = browser_download_url;
}
}
public class GithubReleaseUploader : IGithubReleaseUploader
{
public string Login { get; }

public int Id { get; }

public string Node_id { get; }

public string Avatar_url { get; }

public string Gravatar_id { get; }

public string Url { get; }

public string Html_url { get; }

public string Followers_url { get; }

public string Following_url { get; }

public string Gists_url { get; }

public string Starred_url { get; }

public string Subscriptions_url { get; }

public string Organizations_url { get; }

public string Repos_url { get; }

public string Events_url { get; }

public string Received_events_url { get; }

public string Type { get; }

public bool Site_admin { get; }

public GithubReleaseUploader(string login, int id, string node_id, string avatar_url, string gravatar_id, string url, string html_url, string followers_url, string following_url, string gists_url, string starred_url, string subscriptions_url, string organizations_url, string repos_url, string events_url, string received_events_url, string type, bool site_admin)
{
Login = login;
Id = id;
Node_id = node_id;
Avatar_url = avatar_url;
Gravatar_id = gravatar_id;
Url = url;
Html_url = html_url;
Followers_url = followers_url;
Following_url = following_url;
Gists_url = gists_url;
Starred_url = starred_url;
Subscriptions_url = subscriptions_url;
Organizations_url = organizations_url;
Repos_url = repos_url;
Events_url = events_url;
Received_events_url = received_events_url;
Type = type;
Site_admin = site_admin;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\VisualPairCoding.Interfaces\VisualPairCoding.Interfaces.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using Microsoft.Win32;
using Newtonsoft.Json;
using System.Net;
using VisualPairCoding.BL;

namespace VisualPairCoding.Infrastructure;
public class AutoUpdater
{
private readonly string _appVersion;
private WebClient downloadClient = new WebClient();

public AutoUpdater(
string appVersion)
{
_appVersion = appVersion;
}


public GithubAPIResponse[] GetLatestVersion() {

var releaseURL = "https://api.github.com/repos/stho32/VisualPairCoding/releases";

var client = new HttpClient();

var webRequest = new HttpRequestMessage(HttpMethod.Get, releaseURL);
client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0");

var response = client.Send(webRequest);

string result = response.Content.ReadAsStringAsync().Result.Trim();
GithubAPIResponse[] releases = JsonConvert.DeserializeObject<GithubAPIResponse[]>(result);

return releases;
}


public Boolean RegisterVersionInRegistery()
{
RegistryKey key;

var getLocalVersion = Registry.CurrentUser.OpenSubKey("VisualPairCoding");

if (getLocalVersion == null)
{
key = Registry.CurrentUser.CreateSubKey("VisualPairCoding");
key.SetValue("version", _appVersion);
key.Close();
}

return true;

}

public void Update()
{
GithubAPIResponse[] releases = this.GetLatestVersion();
bool checkRegistery = this.RegisterVersionInRegistery();

if (checkRegistery == false)
{
throw new Exception("Could not add the App to the registery!");
}

downloadClient.DownloadFile(releases[0].Assets[0].Browser_download_url, releases[0].Assets[0].Name);
Registry.CurrentUser.OpenSubKey("VisualPairCoding", true).SetValue("version", releases[0].Name);
}

public Boolean IsUpdateAvailable()
{
GithubAPIResponse[] releases = this.GetLatestVersion();
if (releases[0].Name != Registry.CurrentUser.OpenSubKey("VisualPairCoding").GetValue("version").ToString())
{
return true;
}

return false;

}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\VisualPairCoding.BL\VisualPairCoding.BL.csproj" />
</ItemGroup>

</Project>
5 changes: 0 additions & 5 deletions Source/VisualPairCoding/VisualPairCoding.Interfaces/Class1.cs

This file was deleted.

Loading