using System;
using System.IO;
using System.Reactive.Linq;
using Splat;
using StarsAssistant.Helpers;
namespace StarsAssistant.Services;
public class CSVDataLoader
{
///
/// Reference to the game metadata, retrieved by DI
///
protected Services.Game Game = Locator.Current.GetService()!;
public void CSVDataLoader()
{
}
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}");
}
});
*/
}
}