Compare commits

..

No commits in common. "1396702d9d2b34b7c8c64ca7d63eb3c307ee4db8" and "5f2f429dcc4beeb5cbd000529962ab48247c2088" have entirely different histories.

5 changed files with 52 additions and 95 deletions

View file

@ -13,11 +13,10 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Get build number - name: Extract version
id: buildnumber id: version
run: | run: |
$runNumber = $env:GITHUB_RUN_NUMBER $version = (Select-String -Path "AutoTrackR2/UpdatePage.xaml.cs" -Pattern 'currentVersion = "(.+?)"' | Select-Object -First 1).Matches.Groups[1].Value
$version = "2.$runNumber"
echo "version=$version" >> $env:GITHUB_OUTPUT echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Setup .NET - name: Setup .NET
@ -29,55 +28,44 @@ jobs:
run: dotnet restore AutoTrackR2.sln run: dotnet restore AutoTrackR2.sln
- name: Build - name: Build
run: | run: dotnet build AutoTrackR2.sln --configuration Release --no-restore
dotnet build AutoTrackR2.sln --configuration Release --no-restore -p:Version=${{ steps.buildnumber.outputs.version }}
- name: Create release directory - name: List build output directories
run: |
Write-Host "Listing build output directories:"
Get-ChildItem -Recurse -Directory -Filter "Release" | ForEach-Object { Write-Host $_.FullName }
- name: Create artifacts 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 "Release directory found at: $($releaseDir.FullName)" Write-Host "Copying from: $($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: Create zip file - name: Upload application artifact
run: |
Compress-Archive -Path "release\*" -DestinationPath "AutoTrackR2-${{ steps.buildnumber.outputs.version }}.zip" -Force
- name: Upload release artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: AutoTrackR2-${{ steps.buildnumber.outputs.version }} name: AutoTrackR2-${{ steps.version.outputs.version }}
path: AutoTrackR2-${{ steps.buildnumber.outputs.version }}.zip path: artifacts/
retention-days: 5
- name: Upload visorwipe script
uses: actions/upload-artifact@v4
with:
name: visorwipe.ahk
path: AutoTrackR2/scripts/visorwipe.ahk
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

View file

@ -10,10 +10,6 @@
<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>

View file

@ -2,5 +2,5 @@ namespace AutoTrackR2.Constants;
public static class AppConstants public static class AppConstants
{ {
public static string Version => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "2.0"; public const string Version = "2.11";
} }

View file

@ -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.Read); using var fileStream = new FileStream(_killHistoryPath, FileMode.Append, FileAccess.Write, FileShare.None);
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(new FileStream(_killHistoryPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)); using var reader = new StreamReader(_killHistoryPath);
reader.ReadLine(); // Skip headers reader.ReadLine(); // Skip headers
while (reader.Peek() >= 0) while (reader.Peek() >= 0)

View file

@ -16,7 +16,6 @@ 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)
{ {
@ -83,7 +82,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)
{ {
_currentPlaybackTask = Task.Run(() => PlayNextSound()); PlayNextSound();
} }
} }
} }
@ -117,14 +116,7 @@ public class KillStreakManager : IDisposable
{ {
if (_soundQueue.Count == 0 || _disposed) return; if (_soundQueue.Count == 0 || _disposed) return;
string soundPath; string soundPath = _soundQueue.Dequeue();
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
@ -132,34 +124,28 @@ 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}");
lock (_lock) _isPlaying = false;
if (_soundQueue.Count > 0)
{ {
_isPlaying = false; PlayNextSound();
if (_soundQueue.Count > 0)
{
_currentPlaybackTask = Task.Run(() => PlayNextSound());
}
} }
return; return;
} }
// Stop any currently playing sound // Stop any currently playing sound
lock (_lock) _waveOut?.Stop();
{ _waveOut?.Dispose();
_waveOut?.Stop(); _waveOut = null;
_waveOut?.Dispose();
_waveOut = null;
}
// Create a new WaveOutEvent // Create a new WaveOutEvent
var waveOut = new WaveOutEvent(); _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)
{ {
@ -168,35 +154,23 @@ public class KillStreakManager : IDisposable
_isPlaying = false; _isPlaying = false;
if (_soundQueue.Count > 0) if (_soundQueue.Count > 0)
{ {
_currentPlaybackTask = Task.Run(() => PlayNextSound()); PlayNextSound();
} }
} }
}; };
lock (_lock) _isPlaying = true;
{ _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}");
lock (_lock) _isPlaying = false;
if (_soundQueue.Count > 0)
{ {
_isPlaying = false; PlayNextSound();
if (_soundQueue.Count > 0)
{
_currentPlaybackTask = Task.Run(() => PlayNextSound());
}
} }
} }
} }
@ -221,7 +195,6 @@ public class KillStreakManager : IDisposable
_waveOut?.Stop(); _waveOut?.Stop();
_waveOut?.Dispose(); _waveOut?.Dispose();
_waveOut = null; _waveOut = null;
_currentPlaybackTask?.Wait();
} }
} }
} }