-
Notifications
You must be signed in to change notification settings - Fork 0
Added AoE IV replay source #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| using System.Collections.ObjectModel; | ||
| using System.Collections.Specialized; | ||
| using System.IO; | ||
| using GamesDat.Core.Telemetry.Sources.AgeOfEmpires4; | ||
|
|
||
| namespace GamesDat.Demo.Wpf.ViewModels; | ||
|
|
||
|
|
@@ -323,6 +324,33 @@ private void InitializeBuiltInSources() | |
| null); | ||
| Sources.Add(brawlhallaSource); | ||
| } | ||
|
|
||
| // Add AoE IV source | ||
| try | ||
| { | ||
| var aoe4Path = AgeOfEmpires4ReplayFileSource.GetDefaultReplayPath(); | ||
| System.Diagnostics.Debug.WriteLine($"AoE IV replay path: {aoe4Path}"); | ||
| var aoe4Source = new FileWatcherSourceViewModel( | ||
| "Age of Empires IV", | ||
| aoe4Path, | ||
| "*.*", | ||
| () => new AgeOfEmpires4ReplayFileSource()); | ||
| aoe4Source.DetectedFiles.CollectionChanged += OnSourceFilesChanged; | ||
| Sources.Add(aoe4Source); | ||
| } | ||
| catch (DirectoryNotFoundException) | ||
| { | ||
| // Game not installed - add disabled source | ||
| var defaultPath = Path.Combine( | ||
| Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), | ||
| "Age of Empires IV", "playback"); | ||
| var aoe4Source = new FileWatcherSourceViewModel( | ||
| "Age of Empires IV (Not Installed)", | ||
| defaultPath, | ||
| "*.*", | ||
| null); | ||
|
Comment on lines
+344
to
+351
|
||
| Sources.Add(aoe4Source); | ||
| } | ||
| } | ||
|
|
||
| private void OnSourceFilesChanged(object? sender, NotifyCollectionChangedEventArgs e) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |||||
| using System.Collections.Generic; | ||||||
| using System.Linq; | ||||||
| using GamesDat.Core.Telemetry.Sources; | ||||||
| using GamesDat.Core.Telemetry.Sources.AgeOfEmpires4; | ||||||
| using GamesDat.Core.Telemetry.Sources.Tekken8; | ||||||
|
|
||||||
| namespace GamesDat.Tests.Helpers; | ||||||
|
|
@@ -12,6 +13,16 @@ namespace GamesDat.Tests.Helpers; | |||||
| /// </summary> | ||||||
| public class FileWatcherTestData | ||||||
| { | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// Sources we currently explicitly ignore during testing ebcause they use an | ||||||
|
||||||
| /// Sources we currently explicitly ignore during testing ebcause they use an | |
| /// Sources we currently explicitly ignore during testing because they use an |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,51 @@ | ||||||||||
| using System; | ||||||||||
| using System.Collections.Generic; | ||||||||||
| using System.Linq; | ||||||||||
| using System.Text; | ||||||||||
| using System.Threading.Tasks; | ||||||||||
|
Comment on lines
+2
to
+5
|
||||||||||
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new AoE IV block relies on catching DirectoryNotFoundException, but
GetDefaultReplayPath()only builds a path string and won’t throw. As a result, the “(Not Installed)” source will never be added; consider checkingDirectory.Exists(aoe4Path)(or using the samePathExistslogic used byFileWatcherSourceViewModel) instead of try/catch if you want to present an installed/not-installed state.