Skip to content

Commit

Permalink
Merge branch 'master' into azure-pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
MerlinCooper authored Jun 6, 2020
2 parents d8eeea7 + 77ce9dc commit 229035b
Show file tree
Hide file tree
Showing 21 changed files with 761 additions and 15 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
iRacingReplayOverlay.net
========================
[![Board Status](https://merlincooper.visualstudio.com/e6f13734-ec60-4c67-b13c-08641fd28b90/aba5fdb2-a95f-4c59-a57a-c7bc2140e80e/_apis/work/boardbadge/7e4ac0d3-9a8d-4dd6-a01a-49909ee3bae6)](https://merlincooper.visualstudio.com/e6f13734-ec60-4c67-b13c-08641fd28b90/_boards/board/t/aba5fdb2-a95f-4c59-a57a-c7bc2140e80e/Microsoft.RequirementCategory)


Please note - as I no longer own an active license for iRacing, nor do i have any time to commit to this project - I have to
abandon support for the project - its the challenge of open-source
iRacingReplayDirector
========================

I strongly encourage anyone who wishes - to fork this repo - and take over management/deployment/hosting of this application
Project is the sucessor of the discontinued iRacingReplayOverlay.NET application started by Vipoo.

As Vipoo no longer owns an active license for iRacing - nor has the time to commit to this project - I will take over managing the original repository (vipoo/iRacingReplayOverlay.net) and continue to coordinate future enhancements as well.

For the ease of processing most of the development activites will be done in the my fork (MerlinCooper/iRacingReplayDirector). Due to not being owner of the orignal repository CI/CD processes will be based on my fork as well.

Former Readme File (to be updated)
==================================

[![Build status](https://ci.appveyor.com/api/projects/status/15batnoaijxhvfjd?svg=true)](https://ci.appveyor.com/project/vipoo/iracingreplayoverlay-net)

This program converts your iRacing replay's into edited video files for uploading to youtube. It overlays the race with leaderboards and other race data.

Expand Down
11 changes: 4 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ pool:
vmImage: 'windows-latest'

variables:
solution: '**/*.sln'

solution: '**/*iRacingReplayOverlay*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'All'
buildConfiguration: 'Debug'

steps:
- task: VSBuild@1
inputs:
solution: '**\*.sln'
vsVersion: '15.0'
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
Expand All @@ -34,4 +31,4 @@ steps:
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
configuration: '$(buildConfiguration)'
1 change: 0 additions & 1 deletion plugins/NoOverlay
Submodule NoOverlay deleted from 1ca876
21 changes: 21 additions & 0 deletions plugins/NoOverlay/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
*.suo
*.userprefs
**/bin/*
**/obj/*
**/SampleRaceStream.bin
packages/
TestResult.xml
iRacingReplayOverlay.net.Tests.VisualState.xml
publish/
publish-beta/
**/*.csproj.user
**/*.log
deploy/*
!deploy/.keep
!deploy/test/.keep
Application Files
setup.exe
iRacingReplayOverlay.test.application
.vs/*
tools/encrypt.cmd
Aws/AwsKeyActual.cs
48 changes: 48 additions & 0 deletions plugins/NoOverlay/MyPlugin.DriverCamera.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using iRacingDirector.Plugin;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace NoOverlay
{
public partial class MyPlugin
{
public Driver CamDriver;

void DrawCurrentDriverRow()
{
var position = CamDriver.Position != null ? CamDriver.Position.Value.ToString() : "";
var indicator = CamDriver.Position != null ? CamDriver.Position.Value.Ordinal() : "";

var offset = 5;

Graphics.InRectangle(1920 / 2 - 440 / 2, 980, 70, 40)
.WithBrush(Styles.YellowBrush)
.WithPen(Styles.BlackPen)
.DrawRectangleWithBorder()
.WithFontSizeOf(24)
.WithBrush(Styles.BlackBrush)
.WithStringFormat(StringAlignment.Near)
.Center(cg => cg
.DrawText(position, topOffset: offset)
.AfterText(position)
.MoveRight(3)
.WithFont(Settings.FontName, 18, FontStyle.Bold)
.DrawText(indicator, topOffset: offset)
)

.ToRight(width: 70)
.WithLinearGradientBrush(Styles.White, Styles.WhiteSmoke, LinearGradientMode.BackwardDiagonal)
.DrawRectangleWithBorder()
.WithStringFormat(StringAlignment.Center)
.WithBrush(Styles.BlackBrush)
.DrawText(CamDriver.CarNumber, topOffset: offset)

.ToRight(width: 300)
.WithLinearGradientBrush(Styles.White, Styles.WhiteSmoke, LinearGradientMode.BackwardDiagonal)
.DrawRectangleWithBorder()
.WithStringFormat(StringAlignment.Center)
.WithBrush(Styles.BlackBrush)
.DrawText(CamDriver.UserName, topOffset: offset);
}
}
}
66 changes: 66 additions & 0 deletions plugins/NoOverlay/MyPlugin.Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using iRacingDirector.Plugin;
using System;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace NoOverlay
{
public static class MyPluginExtensions
{
public static string FormattedForLeaderboard(this string shortName)
{
var length = Math.Min(4, shortName.Length);
return shortName.Substring(0, length).ToUpper();
}

public static GraphicRect DrawBlackBackground(this GraphicRect rr)
{
return rr
.WithBrush(Styles.TransparentLightBlack)
.WithPen(Styles.WhitePen)
.DrawRectangleWithoutBorder();
}

public static GraphicRect DrawGrayBackground(this GraphicRect rr)
{
return rr
.WithBrush(Styles.TransparentLightGray)
.WithPen(Styles.WhitePen)
.DrawRectangleWithoutBorder();
}

public static GraphicRect DrawWhiteText(this GraphicRect rr, string text, StringAlignment alignment)
{
rr.WithBrush(Styles.WhiteBrush)
.WithStringFormat(alignment)
.DrawText(text);

return rr;
}

public static GraphicRect WithFontSizeOf(this GraphicRect rr, int fontSize)
{
return rr
.WithFont(Settings.FontName, fontSize, FontStyle.Regular);
}

public static GraphicRect DrawWhiteGradiantBox(this GraphicRect rr)
{
return rr
.WithLinearGradientBrush(Color.DarkGray, Color.White, LinearGradientMode.Vertical)
.WithPen(Styles.BlackPen)
.DrawRectangleWithBorder()
.WithBrush(Styles.BlackBrush);
}

public static GraphicRect DrawRedGradiantBox(this GraphicRect rr)
{
return rr
.WithHeight(rr.Rectangle.Height + 3)
.MoveUp(3)
.WithLinearGradientBrush(Styles.RedBannerDark, Styles.RedBannerLight, LinearGradientMode.Vertical)
.DrawRoundRectangle(5)
.WithBrush(Styles.WhiteBrush);
}
}
}
38 changes: 38 additions & 0 deletions plugins/NoOverlay/MyPlugin.FastestLaps.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using iRacingDirector.Plugin;
using System;
using System.Drawing;

namespace NoOverlay
{
public partial class MyPlugin
{
public FastLap FastLap;

void DrawFastestLap()
{
if (FastLap == null)
return;

const int left = 1920 - 80 - 450;
const int top = 900;

Graphics.InRectangle(left, top + 34, 400, 34)
.DrawRedGradiantBox();

Graphics.InRectangle(left, top + 34, 250, 34)
.WithBrush(Styles.WhiteBrush)
.WithFontSizeOf(19)
.WithStringFormat(StringAlignment.Center)
.DrawText(FastLap.Driver.UserName, topOffset: 5)
.ToRight(width: 150)
.DrawText(TimeSpan.FromSeconds(FastLap.Time).ToString(@"mm\:ss\.fff"), topOffset: 5);

Graphics.InRectangle(left, top, 400, 34)
.DrawWhiteGradiantBox()
.WithBrush(Styles.BlackBrush)
.WithFontSizeOf(18)
.WithStringFormat(StringAlignment.Center)
.DrawText("New Fast Lap", topOffset: 5);
}
}
}
42 changes: 42 additions & 0 deletions plugins/NoOverlay/MyPlugin.FlashCardHeading.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using iRacingDirector.Plugin;
using System.Drawing;

namespace NoOverlay
{
public partial class MyPlugin
{
GraphicRect DrawFlashCardHeading(string title)
{
var displayName = EventData.WeekendInfo.TrackDisplayName.ToUpper();

Graphics.InRectangle(FlashCardLeft, 250, FlashCardWidth, 575)
.DrawGrayBackground();

Graphics.InRectangle(FlashCardLeft - 10, 311 - 2, FlashCardWidth - 100, 48)
.DrawRedGradiantBox()
.MoveDown(7)
.MoveRight(20)
.WithFontSizeOf(23)
.WithStringFormat(StringAlignment.Near)
.DrawText(title, topOffset: 4);

Graphics.InRectangle(FlashCardLeft - 10, 240, FlashCardWidth - 100, 72)
.DrawWhiteGradiantBox()
.MoveDown(7)
.MoveRight(20)
.WithFontSizeOf(23)
.WithStringFormat(StringAlignment.Near)
.DrawText(displayName)
.MoveDown(32)
.WithFontSizeOf(17)
.WithStringFormat(StringAlignment.Near)
.DrawText(EventData.WeekendInfo.TrackCity.ToUpper() + ", " + EventData.WeekendInfo.TrackCountry.ToUpper());

return Graphics.InRectangle(FlashCardLeft + 30, 400, 60, 40)
.WithPen(Styles.BlackPen)
.WithBrush(Styles.BlackBrush)
.WithFontSizeOf(20)
.WithStringFormat(StringAlignment.Near);
}
}
}
54 changes: 54 additions & 0 deletions plugins/NoOverlay/MyPlugin.FlashCardIntro.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using iRacingDirector.Plugin;
using System;
using System.Drawing;
using System.Linq;

namespace NoOverlay
{
public partial class MyPlugin
{
void DrawIntroFlashCard(int page)
{
var r = DrawFlashCardHeading("Qualifying Results");

DrawFlashCardIntro(r, page);
}

void DrawFlashCardIntro(GraphicRect r, int page)
{
var totalWidth = FlashCardWidth;
var left = FlashCardLeft;

var thisPageOfQualifyingResults = EventData.QualifyingResults.Skip(page * DriversPerPage).Take(DriversPerPage);

var offset = 5;
Graphics.InRectangle(left, r.Rectangle.Top, totalWidth, 10)
.WithPen(Styles.ThickBlackPen)
.DrawLine(left + 8, r.Rectangle.Top - offset, left + totalWidth - 16, r.Rectangle.Top - offset);

foreach (var qualifier in thisPageOfQualifyingResults)
{
var driver = EventData.GetCompetingDriverByIndex(qualifier.CarIdx);

r.Center(cg => cg
.DrawText(qualifier.Position.ToString())
.AfterText(qualifier.Position.ToString())
.MoveRight(1)
.WithFont(Settings.FontName, 16, FontStyle.Bold)
.DrawText(qualifier.Position.Ordinal()))
.ToRight(width: 120, left: 30)
.DrawText(TimeSpan.FromSeconds(qualifier.FastestTime).ToString("mm\\:ss\\.ff"))
.ToRight(width: 60)
.DrawText(driver.CarNumber)
.ToRight(width: 300)
.DrawText(driver.UserName);

r = r.ToBelow();

Graphics.InRectangle(left, r.Rectangle.Top, totalWidth, 10)
.WithPen(Styles.ThickBlackPen)
.DrawLine(left + 8, r.Rectangle.Top - offset, left + totalWidth - 16, r.Rectangle.Top - offset);
}
}
}
}
62 changes: 62 additions & 0 deletions plugins/NoOverlay/MyPlugin.FlashCardOutro.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using iRacingDirector.Plugin;
using System;
using System.Drawing;
using System.Linq;

namespace NoOverlay
{
public partial class MyPlugin
{
public Driver[] PreferredDriverNames;

void DrawOutroFlashCard(int page)
{
var r = DrawFlashCardHeading("Race Results");

DrawFlashCardOutro(r, page);
}

void DrawFlashCardOutro(GraphicRect r, int page)
{
var rsession = EventData.Race;
var results = EventData.Results;

var offset = 5;
Graphics.InRectangle(FlashCardLeft, r.Rectangle.Top, FlashCardWidth, 10)
.WithPen(Styles.ThickBlackPen)
.DrawLine(FlashCardLeft + 8, r.Rectangle.Top - offset, FlashCardLeft + FlashCardWidth - 16, r.Rectangle.Top - offset);

var LeaderTime = TimeSpan.FromSeconds(results[0].Time);

foreach (var racerResult in results.Skip(DriversPerPage * page).Take(DriversPerPage))
{
var driver = EventData.GetCompetingDriverByIndex(racerResult.CarIdx);

var Gap = TimeSpan.FromSeconds(racerResult.Time) - LeaderTime; // Gap calculation
if (Gap == TimeSpan.Zero) //For the leader we want to display the race duration
Gap = LeaderTime;

r.WithBrush(PreferredDriverNames.Any(d => d.UserName == driver.UserName) ? Styles.RedBrush : Styles.BlackBrush);

r.Center(cg => cg
.DrawText(racerResult.Position.ToString())
.AfterText(racerResult.Position.ToString())
.MoveRight(1)
.WithFont(Settings.FontName, 16, FontStyle.Bold)
.DrawText(racerResult.Position.Ordinal()))
.ToRight(width: 190, left: 30)
.DrawText(Gap.ToString("hh\\:mm\\:ss\\.fff"))
.ToRight(width: 80, left: 20)
.DrawText(driver.CarNumber)
.ToRight(width: 350)
.DrawText(driver.UserName);

r = r.ToBelow();

Graphics.InRectangle(FlashCardLeft, r.Rectangle.Top, FlashCardWidth, 10)
.WithPen(Styles.ThickBlackPen)
.DrawLine(FlashCardLeft + 8, r.Rectangle.Top - offset, FlashCardLeft + FlashCardWidth - 16, r.Rectangle.Top - offset);
}
}
}
}
Loading

0 comments on commit 229035b

Please sign in to comment.