mirror of
https://github.com/BubbaGumpShrump/AutoTrackR2.git
synced 2025-05-22 08:45:30 +00:00
Compare commits
3 commits
5f2f429dcc
...
1396702d9d
Author | SHA1 | Date | |
---|---|---|---|
|
1396702d9d | ||
|
f9ce907f40 | ||
|
b6508593db |
5 changed files with 93 additions and 50 deletions
.github/workflows
AutoTrackR2
72
.github/workflows/build.yml
vendored
72
.github/workflows/build.yml
vendored
|
@ -13,10 +13,11 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Extract version
|
- name: Get build number
|
||||||
id: version
|
id: buildnumber
|
||||||
run: |
|
run: |
|
||||||
$version = (Select-String -Path "AutoTrackR2/UpdatePage.xaml.cs" -Pattern 'currentVersion = "(.+?)"' | Select-Object -First 1).Matches.Groups[1].Value
|
$runNumber = $env:GITHUB_RUN_NUMBER
|
||||||
|
$version = "2.$runNumber"
|
||||||
echo "version=$version" >> $env:GITHUB_OUTPUT
|
echo "version=$version" >> $env:GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
|
@ -28,44 +29,55 @@ jobs:
|
||||||
run: dotnet restore AutoTrackR2.sln
|
run: dotnet restore AutoTrackR2.sln
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: dotnet build AutoTrackR2.sln --configuration Release --no-restore
|
|
||||||
|
|
||||||
- name: List build output directories
|
|
||||||
run: |
|
run: |
|
||||||
Write-Host "Listing build output directories:"
|
dotnet build AutoTrackR2.sln --configuration Release --no-restore -p:Version=${{ steps.buildnumber.outputs.version }}
|
||||||
Get-ChildItem -Recurse -Directory -Filter "Release" | ForEach-Object { Write-Host $_.FullName }
|
|
||||||
|
|
||||||
- name: Create artifacts directory
|
- name: Create release directory
|
||||||
run: mkdir artifacts
|
|
||||||
|
|
||||||
- name: Copy build output
|
|
||||||
run: |
|
run: |
|
||||||
|
mkdir release
|
||||||
$releaseDir = Get-ChildItem -Recurse -Directory -Filter "Release" | Select-Object -First 1
|
$releaseDir = Get-ChildItem -Recurse -Directory -Filter "Release" | Select-Object -First 1
|
||||||
if ($releaseDir) {
|
if ($releaseDir) {
|
||||||
Write-Host "Copying from: $($releaseDir.FullName)"
|
Write-Host "Release directory found at: $($releaseDir.FullName)"
|
||||||
Copy-Item "$($releaseDir.FullName)\*" "artifacts\" -Recurse
|
|
||||||
|
# Copy main application files (excluding .pdb)
|
||||||
|
Copy-Item "$($releaseDir.FullName)\AutoTrackR2.exe" "release\" -ErrorAction SilentlyContinue
|
||||||
|
Copy-Item "$($releaseDir.FullName)\AutoTrackR2.dll" "release\" -ErrorAction SilentlyContinue
|
||||||
|
Copy-Item "$($releaseDir.FullName)\AutoTrackR2.runtimeconfig.json" "release\" -ErrorAction SilentlyContinue
|
||||||
|
Copy-Item "$($releaseDir.FullName)\AutoTrackR2.deps.json" "release\" -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
# Copy resources
|
||||||
|
Copy-Item "$($releaseDir.FullName)\config.ini" "release\" -ErrorAction SilentlyContinue
|
||||||
|
Copy-Item "$($releaseDir.FullName)\themes.json" "release\" -ErrorAction SilentlyContinue
|
||||||
|
Copy-Item "$($releaseDir.FullName)\AutoTrackR2.ico" "release\" -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
# Create directories
|
||||||
|
mkdir "release\Fonts" -ErrorAction SilentlyContinue
|
||||||
|
mkdir "release\Assets" -ErrorAction SilentlyContinue
|
||||||
|
mkdir "release\sounds" -ErrorAction SilentlyContinue
|
||||||
|
mkdir "release\scripts" -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
# Copy directories
|
||||||
|
Copy-Item "$($releaseDir.FullName)\Fonts\*" "release\Fonts\" -Recurse -ErrorAction SilentlyContinue
|
||||||
|
Copy-Item "$($releaseDir.FullName)\Assets\*" "release\Assets\" -Recurse -ErrorAction SilentlyContinue
|
||||||
|
Copy-Item "$($releaseDir.FullName)\sounds\*" "release\sounds\" -Recurse -ErrorAction SilentlyContinue
|
||||||
|
Copy-Item "AutoTrackR2\scripts\*" "release\scripts\" -Recurse -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
# List contents of release directory for verification
|
||||||
|
Write-Host "Contents of release directory:"
|
||||||
|
Get-ChildItem -Path "release" -Recurse | ForEach-Object { Write-Host $_.FullName }
|
||||||
} else {
|
} else {
|
||||||
Write-Host "No Release directory found"
|
Write-Host "No Release directory found"
|
||||||
|
Get-ChildItem -Recurse -Directory | ForEach-Object { Write-Host $_.FullName }
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
- name: Upload application artifact
|
- name: Create zip file
|
||||||
uses: actions/upload-artifact@v4
|
run: |
|
||||||
with:
|
Compress-Archive -Path "release\*" -DestinationPath "AutoTrackR2-${{ steps.buildnumber.outputs.version }}.zip" -Force
|
||||||
name: AutoTrackR2-${{ steps.version.outputs.version }}
|
|
||||||
path: artifacts/
|
|
||||||
retention-days: 5
|
|
||||||
|
|
||||||
- name: Upload visorwipe script
|
- name: Upload release artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: visorwipe.ahk
|
name: AutoTrackR2-${{ steps.buildnumber.outputs.version }}
|
||||||
path: AutoTrackR2/scripts/visorwipe.ahk
|
path: AutoTrackR2-${{ steps.buildnumber.outputs.version }}.zip
|
||||||
retention-days: 5
|
|
||||||
|
|
||||||
- name: Upload videorecord script
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: videorecord.ahk
|
|
||||||
path: AutoTrackR2/scripts/videorecord.ahk
|
|
||||||
retention-days: 5
|
retention-days: 5
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
<Configurations>Debug;Release;Test</Configurations>
|
<Configurations>Debug;Release;Test</Configurations>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<ApplicationIcon>AutoTrackR2.ico</ApplicationIcon>
|
<ApplicationIcon>AutoTrackR2.ico</ApplicationIcon>
|
||||||
|
<Version>2.0</Version>
|
||||||
|
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||||
|
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -2,5 +2,5 @@ namespace AutoTrackR2.Constants;
|
||||||
|
|
||||||
public static class AppConstants
|
public static class AppConstants
|
||||||
{
|
{
|
||||||
public const string Version = "2.11";
|
public static string Version => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "2.0";
|
||||||
}
|
}
|
|
@ -97,7 +97,7 @@ public class KillHistoryManager
|
||||||
// Check file can be written to
|
// Check file can be written to
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using var fileStream = new FileStream(_killHistoryPath, FileMode.Append, FileAccess.Write, FileShare.None);
|
using var fileStream = new FileStream(_killHistoryPath, FileMode.Append, FileAccess.Write, FileShare.Read);
|
||||||
using var writer = new StreamWriter(fileStream);
|
using var writer = new StreamWriter(fileStream);
|
||||||
writer.Write(csv.ToString());
|
writer.Write(csv.ToString());
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ public class KillHistoryManager
|
||||||
{
|
{
|
||||||
var kills = new List<KillData>();
|
var kills = new List<KillData>();
|
||||||
|
|
||||||
using var reader = new StreamReader(_killHistoryPath);
|
using var reader = new StreamReader(new FileStream(_killHistoryPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
|
||||||
reader.ReadLine(); // Skip headers
|
reader.ReadLine(); // Skip headers
|
||||||
|
|
||||||
while (reader.Peek() >= 0)
|
while (reader.Peek() >= 0)
|
||||||
|
|
|
@ -16,6 +16,7 @@ public class KillStreakManager : IDisposable
|
||||||
private WaveOutEvent? _waveOut;
|
private WaveOutEvent? _waveOut;
|
||||||
private bool _isPlaying = false;
|
private bool _isPlaying = false;
|
||||||
private bool _disposed = false;
|
private bool _disposed = false;
|
||||||
|
private Task? _currentPlaybackTask;
|
||||||
|
|
||||||
public KillStreakManager(string soundsPath)
|
public KillStreakManager(string soundsPath)
|
||||||
{
|
{
|
||||||
|
@ -82,7 +83,7 @@ public class KillStreakManager : IDisposable
|
||||||
// Only start playing if not already playing
|
// Only start playing if not already playing
|
||||||
if (!_isPlaying && _soundQueue.Count > 0)
|
if (!_isPlaying && _soundQueue.Count > 0)
|
||||||
{
|
{
|
||||||
PlayNextSound();
|
_currentPlaybackTask = Task.Run(() => PlayNextSound());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +117,14 @@ public class KillStreakManager : IDisposable
|
||||||
{
|
{
|
||||||
if (_soundQueue.Count == 0 || _disposed) return;
|
if (_soundQueue.Count == 0 || _disposed) return;
|
||||||
|
|
||||||
string soundPath = _soundQueue.Dequeue();
|
string soundPath;
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
if (_soundQueue.Count == 0 || _disposed) return;
|
||||||
|
soundPath = _soundQueue.Dequeue();
|
||||||
|
_isPlaying = true;
|
||||||
|
}
|
||||||
|
|
||||||
Console.WriteLine($"Attempting to play sound: {soundPath}");
|
Console.WriteLine($"Attempting to play sound: {soundPath}");
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -124,28 +132,34 @@ public class KillStreakManager : IDisposable
|
||||||
if (!File.Exists(soundPath))
|
if (!File.Exists(soundPath))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Sound file not found: {soundPath}");
|
Console.WriteLine($"Sound file not found: {soundPath}");
|
||||||
_isPlaying = false;
|
lock (_lock)
|
||||||
if (_soundQueue.Count > 0)
|
|
||||||
{
|
{
|
||||||
PlayNextSound();
|
_isPlaying = false;
|
||||||
|
if (_soundQueue.Count > 0)
|
||||||
|
{
|
||||||
|
_currentPlaybackTask = Task.Run(() => PlayNextSound());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop any currently playing sound
|
// Stop any currently playing sound
|
||||||
_waveOut?.Stop();
|
lock (_lock)
|
||||||
_waveOut?.Dispose();
|
{
|
||||||
_waveOut = null;
|
_waveOut?.Stop();
|
||||||
|
_waveOut?.Dispose();
|
||||||
|
_waveOut = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Create a new WaveOutEvent
|
// Create a new WaveOutEvent
|
||||||
_waveOut = new WaveOutEvent();
|
var waveOut = new WaveOutEvent();
|
||||||
|
|
||||||
// Create a new AudioFileReader for the MP3 file
|
// Create a new AudioFileReader for the MP3 file
|
||||||
using var audioFile = new AudioFileReader(soundPath);
|
using var audioFile = new AudioFileReader(soundPath);
|
||||||
_waveOut.Init(audioFile);
|
waveOut.Init(audioFile);
|
||||||
|
|
||||||
// Set up event handler for when playback finishes
|
// Set up event handler for when playback finishes
|
||||||
_waveOut.PlaybackStopped += (sender, e) =>
|
waveOut.PlaybackStopped += (sender, e) =>
|
||||||
{
|
{
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
|
@ -154,23 +168,35 @@ public class KillStreakManager : IDisposable
|
||||||
_isPlaying = false;
|
_isPlaying = false;
|
||||||
if (_soundQueue.Count > 0)
|
if (_soundQueue.Count > 0)
|
||||||
{
|
{
|
||||||
PlayNextSound();
|
_currentPlaybackTask = Task.Run(() => PlayNextSound());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_isPlaying = true;
|
lock (_lock)
|
||||||
_waveOut.Play();
|
{
|
||||||
|
if (_disposed)
|
||||||
|
{
|
||||||
|
waveOut.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_waveOut = waveOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
waveOut.Play();
|
||||||
|
|
||||||
Console.WriteLine($"Successfully played sound: {soundPath}");
|
Console.WriteLine($"Successfully played sound: {soundPath}");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Error playing sound {soundPath}: {ex.Message}");
|
Console.WriteLine($"Error playing sound {soundPath}: {ex.Message}");
|
||||||
_isPlaying = false;
|
lock (_lock)
|
||||||
if (_soundQueue.Count > 0)
|
|
||||||
{
|
{
|
||||||
PlayNextSound();
|
_isPlaying = false;
|
||||||
|
if (_soundQueue.Count > 0)
|
||||||
|
{
|
||||||
|
_currentPlaybackTask = Task.Run(() => PlayNextSound());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,6 +221,7 @@ public class KillStreakManager : IDisposable
|
||||||
_waveOut?.Stop();
|
_waveOut?.Stop();
|
||||||
_waveOut?.Dispose();
|
_waveOut?.Dispose();
|
||||||
_waveOut = null;
|
_waveOut = null;
|
||||||
|
_currentPlaybackTask?.Wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue