using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Subjects;
using System.Text;
using System.Threading.Tasks;
using Wabbajack.Common;
using Wabbajack.Lib.CompilationSteps;
using Wabbajack.VirtualFileSystem;
namespace Wabbajack.Lib
{
public abstract class ACompiler
{
protected static string _vfsCacheName = "vfs_compile_cache.bin";
///
/// A stream of tuples of ("Update Title", 0.25) which represent the name of the current task
/// and the current progress.
///
public IObservable<(string, float)> ProgressUpdates => _progressUpdates;
protected readonly Subject<(string, float)> _progressUpdates = new Subject<(string, float)>();
public Context VFS { get; internal set; } = new Context();
public ModManager ModManager;
public string GamePath;
public string ModListOutputFolder;
public string ModListOutputFile;
public List SelectedArchives = new List();
public List InstallDirectives = new List();
public List AllFiles = new List();
public ModList ModList = new ModList();
public List IndexedArchives = new List();
public Dictionary> IndexedFiles = new Dictionary>();
public abstract void Info(string msg);
public abstract void Status(string msg);
public abstract void Error(string msg);
internal abstract string IncludeFile(byte[] data);
internal abstract string IncludeFile(string data);
public abstract bool Compile();
public abstract Directive RunStack(IEnumerable stack, RawSourceFile source);
public abstract IEnumerable GetStack();
public abstract IEnumerable MakeStack();
protected ACompiler()
{
ProgressUpdates.Subscribe(itm => Utils.Log($"{itm.Item2} - {itm.Item1}"));
VFS.LogSpam.Subscribe(itm => Utils.Status(itm));
}
}
}