Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a76b0d
commit 4c3a5aa
Showing
19 changed files
with
1,115 additions
and
1,115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
wwwroot/js/signalr-client.js | ||
wwwroot/js/GoalConfiguration.min.js | ||
wwwroot/js/signalr-client.js | ||
wwwroot/js/GoalConfiguration.min.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
| ||
// This file is used by Code Analysis to maintain SuppressMessage | ||
// attributes that are applied to this project. | ||
// Project-level suppressions either have no target or are given | ||
// a specific target and scoped to a namespace, type, member, etc. | ||
|
||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "<Pending>")] | ||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Maintainability", "RCS1141:Add parameter to documentation comment.", Justification = "<Pending>")] | ||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>")] | ||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "RCS1090:Call 'ConfigureAwait(false)'.", Justification = "No SynchronizationContext in AspNet core")] | ||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0007:Use implicit type", Justification = "Dont want to use var for bool, int ...")] | ||
| ||
// This file is used by Code Analysis to maintain SuppressMessage | ||
// attributes that are applied to this project. | ||
// Project-level suppressions either have no target or are given | ||
// a specific target and scoped to a namespace, type, member, etc. | ||
|
||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "<Pending>")] | ||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Maintainability", "RCS1141:Add parameter to documentation comment.", Justification = "<Pending>")] | ||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>")] | ||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "RCS1090:Call 'ConfigureAwait(false)'.", Justification = "No SynchronizationContext in AspNet core")] | ||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0007:Use implicit type", Justification = "Dont want to use var for bool, int ...")] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
using System; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace Fritz.StreamTools.Helpers | ||
{ | ||
public static class JsonExtensions | ||
{ | ||
public static bool IsNullOrEmpty(this JToken token) | ||
{ | ||
return (token == null) || | ||
(token.Type == JTokenType.Array && !token.HasValues) || | ||
(token.Type == JTokenType.Object && !token.HasValues) || | ||
(token.Type == JTokenType.String && token.ToString() == String.Empty) || | ||
(token.Type == JTokenType.Null); | ||
} | ||
} | ||
} | ||
using System; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace Fritz.StreamTools.Helpers | ||
{ | ||
public static class JsonExtensions | ||
{ | ||
public static bool IsNullOrEmpty(this JToken token) | ||
{ | ||
return (token == null) || | ||
(token.Type == JTokenType.Array && !token.HasValues) || | ||
(token.Type == JTokenType.Object && !token.HasValues) || | ||
(token.Type == JTokenType.String && token.ToString() == String.Empty) || | ||
(token.Type == JTokenType.Null); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
using System; | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Fritz.StreamTools.Helpers | ||
{ | ||
public static class ReflectionHelper | ||
{ | ||
// | ||
// Uses reflection to find the named event and calls DynamicInvoke on it | ||
// | ||
public static void RaiseEvent(object instance, string name, EventArgs args) | ||
{ | ||
if (instance == null) | ||
throw new ArgumentNullException(nameof(instance)); | ||
if (string.IsNullOrEmpty(name)) | ||
throw new ArgumentException("message", nameof(name)); | ||
|
||
var fieldInfo = instance.GetType().GetField(name, BindingFlags.NonPublic | BindingFlags.Instance); | ||
if (fieldInfo == null) | ||
return; | ||
var multicastDelegate = fieldInfo.GetValue(instance) as MulticastDelegate; | ||
|
||
// NOTE: Using DynamicInvoke so tests work! | ||
multicastDelegate?.DynamicInvoke(new object[] { instance, args }); | ||
} | ||
} | ||
} | ||
using System; | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Fritz.StreamTools.Helpers | ||
{ | ||
public static class ReflectionHelper | ||
{ | ||
// | ||
// Uses reflection to find the named event and calls DynamicInvoke on it | ||
// | ||
public static void RaiseEvent(object instance, string name, EventArgs args) | ||
{ | ||
if (instance == null) | ||
throw new ArgumentNullException(nameof(instance)); | ||
if (string.IsNullOrEmpty(name)) | ||
throw new ArgumentException("message", nameof(name)); | ||
|
||
var fieldInfo = instance.GetType().GetField(name, BindingFlags.NonPublic | BindingFlags.Instance); | ||
if (fieldInfo == null) | ||
return; | ||
var multicastDelegate = fieldInfo.GetValue(instance) as MulticastDelegate; | ||
|
||
// NOTE: Using DynamicInvoke so tests work! | ||
multicastDelegate?.DynamicInvoke(new object[] { instance, args }); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Threading.Tasks; | ||
|
||
namespace System.Threading.Tasks | ||
{ | ||
public static class TaskHelpers | ||
{ | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public static void Forget(this Task task) | ||
{ | ||
// Empty on purpose! | ||
} | ||
|
||
private const int s_defaultTimeout = 5000; | ||
|
||
public static Task OrTimeout(this Task task, int milliseconds = s_defaultTimeout) | ||
{ | ||
return OrTimeout(task, new TimeSpan(0, 0, 0, 0, milliseconds)); | ||
} | ||
|
||
public static async Task OrTimeout(this Task task, TimeSpan timeout) | ||
{ | ||
var completed = await Task.WhenAny(task, Task.Delay(timeout)); | ||
if (completed != task) | ||
{ | ||
throw new TimeoutException(); | ||
} | ||
|
||
await task; | ||
} | ||
|
||
public static Task<T> OrTimeout<T>(this Task<T> task, int milliseconds = s_defaultTimeout) | ||
{ | ||
return OrTimeout(task, new TimeSpan(0, 0, 0, 0, milliseconds)); | ||
} | ||
|
||
public static async Task<T> OrTimeout<T>(this Task<T> task, TimeSpan timeout) | ||
{ | ||
var completed = await Task.WhenAny(task, Task.Delay(timeout)); | ||
if (completed != task) | ||
{ | ||
throw new TimeoutException(); | ||
} | ||
|
||
return await task; | ||
} | ||
} | ||
} | ||
using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Threading.Tasks; | ||
|
||
namespace System.Threading.Tasks | ||
{ | ||
public static class TaskHelpers | ||
{ | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public static void Forget(this Task task) | ||
{ | ||
// Empty on purpose! | ||
} | ||
|
||
private const int s_defaultTimeout = 5000; | ||
|
||
public static Task OrTimeout(this Task task, int milliseconds = s_defaultTimeout) | ||
{ | ||
return OrTimeout(task, new TimeSpan(0, 0, 0, 0, milliseconds)); | ||
} | ||
|
||
public static async Task OrTimeout(this Task task, TimeSpan timeout) | ||
{ | ||
var completed = await Task.WhenAny(task, Task.Delay(timeout)); | ||
if (completed != task) | ||
{ | ||
throw new TimeoutException(); | ||
} | ||
|
||
await task; | ||
} | ||
|
||
public static Task<T> OrTimeout<T>(this Task<T> task, int milliseconds = s_defaultTimeout) | ||
{ | ||
return OrTimeout(task, new TimeSpan(0, 0, 0, 0, milliseconds)); | ||
} | ||
|
||
public static async Task<T> OrTimeout<T>(this Task<T> task, TimeSpan timeout) | ||
{ | ||
var completed = await Task.WhenAny(task, Task.Delay(timeout)); | ||
if (completed != task) | ||
{ | ||
throw new TimeoutException(); | ||
} | ||
|
||
return await task; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,59 @@ | ||
@page | ||
@model Fritz.StreamTools.Pages.CurrentViewersModel | ||
@using System.Collections.Generic | ||
@{ | ||
Layout = null; | ||
|
||
var fontIcon = new Dictionary<string, string> | ||
{ | ||
{"Mixer", "microsoft"}, | ||
{"Fake", "tumblr" } | ||
}; | ||
|
||
} | ||
|
||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width" /> | ||
<title>CurrentViewers</title> | ||
</head> | ||
<body> | ||
|
||
@foreach (var service in Model.StreamService.ViewerCountByService.OrderByDescending(s => s.service)) | ||
{ | ||
|
||
<i class="fab fa-@(fontIcon.ContainsKey(service.service) ? fontIcon[service.service] : service.service.ToLowerInvariant() )"></i> <span class="serviceCount" id="@service.service.ToLowerInvariant()Count">@service.count</span> | ||
|
||
} | ||
|
||
Total: <span id="totalCount">@(Model.StreamService.ViewerCountByService.Sum(s => s.count))</span> | ||
|
||
<script src="~/lib/signalr/signalr-client.js"></script> | ||
<script src="~/js/streamhub.js"></script> | ||
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script> | ||
<script> | ||
(function () { | ||
const reducer = (accumulator, currentValue) => accumulator + parseInt(currentValue.textContent, 10); | ||
var hub = new StreamHub(); | ||
hub.onViewers = (service, count) => { | ||
document.getElementById(service + "Count").textContent = count; | ||
var currentCounts = document.getElementsByClassName("serviceCount"); | ||
var elArray = Array.from(currentCounts); | ||
document.getElementById("totalCount").textContent = elArray.reduce(reducer, 0); | ||
} | ||
hub.start("viewers"); | ||
})(); | ||
</script> | ||
|
||
</body> | ||
</html> | ||
@page | ||
@model Fritz.StreamTools.Pages.CurrentViewersModel | ||
@using System.Collections.Generic | ||
@{ | ||
Layout = null; | ||
|
||
var fontIcon = new Dictionary<string, string> | ||
{ | ||
{"Mixer", "microsoft"}, | ||
{"Fake", "tumblr" } | ||
}; | ||
|
||
} | ||
|
||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width" /> | ||
<title>CurrentViewers</title> | ||
</head> | ||
<body> | ||
|
||
@foreach (var service in Model.StreamService.ViewerCountByService.OrderByDescending(s => s.service)) | ||
{ | ||
|
||
<i class="fab fa-@(fontIcon.ContainsKey(service.service) ? fontIcon[service.service] : service.service.ToLowerInvariant() )"></i> <span class="serviceCount" id="@service.service.ToLowerInvariant()Count">@service.count</span> | ||
|
||
} | ||
|
||
Total: <span id="totalCount">@(Model.StreamService.ViewerCountByService.Sum(s => s.count))</span> | ||
|
||
<script src="~/lib/signalr/signalr-client.js"></script> | ||
<script src="~/js/streamhub.js"></script> | ||
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script> | ||
<script> | ||
(function () { | ||
const reducer = (accumulator, currentValue) => accumulator + parseInt(currentValue.textContent, 10); | ||
var hub = new StreamHub(); | ||
hub.onViewers = (service, count) => { | ||
document.getElementById(service + "Count").textContent = count; | ||
var currentCounts = document.getElementsByClassName("serviceCount"); | ||
var elArray = Array.from(currentCounts); | ||
document.getElementById("totalCount").textContent = elArray.reduce(reducer, 0); | ||
} | ||
hub.start("viewers"); | ||
})(); | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
It’s not a bug. It’s an undocumented feature! | ||
“Software Developer” – An organism that turns caffeine into software | ||
If debugging is the process of removing software bugs, then programming must be the process of putting them in – Edsger Dijkstra | ||
A user interface is like a joke. If you have to explain it, it’s not that good. | ||
I don’t care if it works on your machine! We are not shipping your machine!” – Vidiu Platon | ||
Measuring programming progress by lines of code is like measuring aircraft building progress by weight. – Bill Gates (co-founder of Microsoft) | ||
I’m very font of you because you are just my type. | ||
My code DOESN’T work, I have no idea why. My code WORKS, I have no idea why. | ||
Things aren’t always #000000 and #FFFFFF | ||
One man’s crappy software is another man’s full time job. – Jessica Gaston | ||
Software undergoes beta testing shortly before it’s released. Beta is Latin for “still doesn’t work”. | ||
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. – Martin Golding | ||
Talk is cheap. Show me the code. – Linus Torvalds | ||
Writing the first 90 percent of a computer program takes 90 percent of the time. The remaining ten percent also takes 90 percent of the time and the final touches also take 90 percent of the time. – N.J. Rubenking | ||
Old programmers never die. They simply give up their resources. | ||
There are only two industries that refer to their customers as “users”. – (Edward Tufte) | ||
Any code of your own that you haven’t looked at for six or more months might as well have been written by someone else. – (Eagleson’s Law) | ||
If at first you don’t succeed; call it version 1.0 | ||
If Internet Explorer is brave enough to ask to be your default browser, You are brave enough to ask that girl out. | ||
"To teach is to learn twice." - Anonymous | ||
It’s not a bug. It’s an undocumented feature! | ||
“Software Developer” – An organism that turns caffeine into software | ||
If debugging is the process of removing software bugs, then programming must be the process of putting them in – Edsger Dijkstra | ||
A user interface is like a joke. If you have to explain it, it’s not that good. | ||
I don’t care if it works on your machine! We are not shipping your machine!” – Vidiu Platon | ||
Measuring programming progress by lines of code is like measuring aircraft building progress by weight. – Bill Gates (co-founder of Microsoft) | ||
I’m very font of you because you are just my type. | ||
My code DOESN’T work, I have no idea why. My code WORKS, I have no idea why. | ||
Things aren’t always #000000 and #FFFFFF | ||
One man’s crappy software is another man’s full time job. – Jessica Gaston | ||
Software undergoes beta testing shortly before it’s released. Beta is Latin for “still doesn’t work”. | ||
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. – Martin Golding | ||
Talk is cheap. Show me the code. – Linus Torvalds | ||
Writing the first 90 percent of a computer program takes 90 percent of the time. The remaining ten percent also takes 90 percent of the time and the final touches also take 90 percent of the time. – N.J. Rubenking | ||
Old programmers never die. They simply give up their resources. | ||
There are only two industries that refer to their customers as “users”. – (Edward Tufte) | ||
Any code of your own that you haven’t looked at for six or more months might as well have been written by someone else. – (Eagleson’s Law) | ||
If at first you don’t succeed; call it version 1.0 | ||
If Internet Explorer is brave enough to ask to be your default browser, You are brave enough to ask that girl out. | ||
"To teach is to learn twice." - Anonymous |
Oops, something went wrong.