2024-09-15 20:10:44 +00:00
|
|
|
using System;
|
2024-09-17 18:20:42 +00:00
|
|
|
using System.IO;
|
|
|
|
using System.Reactive.Linq;
|
2024-09-15 20:10:44 +00:00
|
|
|
using Splat;
|
2024-09-17 18:20:42 +00:00
|
|
|
using StarsAssistant.Helpers;
|
2024-09-15 20:10:44 +00:00
|
|
|
|
|
|
|
namespace StarsAssistant.Services;
|
|
|
|
|
|
|
|
|
2024-09-17 18:20:42 +00:00
|
|
|
public class CSVDataLoader
|
2024-09-15 20:10:44 +00:00
|
|
|
{
|
|
|
|
/// <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-15 20:10:44 +00:00
|
|
|
|
2024-09-17 18:20:42 +00:00
|
|
|
public void CSVDataLoader()
|
2024-09-15 20:10:44 +00:00
|
|
|
{
|
2024-09-17 18:20:42 +00:00
|
|
|
|
2024-09-15 20:10:44 +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}");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|