sa/Stars Assistant/Services/CSVDataLoader.cs

42 lines
1.1 KiB
C#
Raw Normal View History

using System;
2024-09-17 18:20:42 +00:00
using System.IO;
using System.Reactive.Linq;
using Splat;
2024-09-17 18:20:42 +00:00
using StarsAssistant.Helpers;
namespace StarsAssistant.Services;
2024-09-17 18:20:42 +00:00
public class CSVDataLoader
{
/// <summary>
/// Reference to the game metadata, retrieved by DI
/// </summary>
2024-09-17 18:20:42 +00:00
protected Services.Game Game = Locator.Current.GetService<Services.Game>()!;
2024-09-17 18:20:42 +00:00
public void CSVDataLoader()
{
2024-09-17 18:20:42 +00:00
}
2024-09-17 18:20:42 +00:00
public void StartPlanetCSVWatcher()
{
// TODO: which scheduler for Throttle?
var watcher = FsWatcher
.ObserveFileSystem(Game.GamePath, new string[] { Game.PlanetFileSearchPattern });
.ThrottleAndDistinct(2);
/*
watcher.Subscribe(x =>
{
Console.WriteLine($"{DateTime.Now.ToLongTimeString()} got {x.Count()} events:");
foreach (var fsEvent in x)
{
Console.WriteLine($"{DateTime.Now.ToLongTimeString()} {i++} {fsEvent.FullPath} - {fsEvent.ChangeType}");
}
});
*/
}
}