mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Updated work queue reporting
This commit is contained in:
parent
9db982a13d
commit
2e2ced6023
@ -17,12 +17,12 @@ namespace Wabbajack.Common
|
||||
|
||||
[ThreadStatic] private static int CpuId;
|
||||
|
||||
[ThreadStatic] internal static bool WorkerThread;
|
||||
internal static bool WorkerThread => CurrentQueue != null;
|
||||
[ThreadStatic] internal static WorkQueue CurrentQueue;
|
||||
|
||||
private readonly static Subject<CPUStatus> _Status = new Subject<CPUStatus>();
|
||||
private static readonly Subject<CPUStatus> _Status = new Subject<CPUStatus>();
|
||||
public IObservable<CPUStatus> Status => _Status;
|
||||
private readonly Subject<(int Current, int Max)> _QueueSize = new Subject<(int Current, int Max)>();
|
||||
public IObservable<(int Current, int Max)> QueueSize => _QueueSize;
|
||||
|
||||
public static int ThreadCount { get; } = Environment.ProcessorCount;
|
||||
public static List<Thread> Threads { get; private set; }
|
||||
|
||||
@ -48,7 +48,7 @@ namespace Wabbajack.Common
|
||||
private void ThreadBody(int idx)
|
||||
{
|
||||
CpuId = idx;
|
||||
WorkerThread = true;
|
||||
CurrentQueue = this;
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ namespace Wabbajack.Lib
|
||||
{
|
||||
UpdateTracker = new StatusUpdateTracker(10);
|
||||
Queue = new WorkQueue();
|
||||
VFS = new Context(Queue) {UpdateTracker = UpdateTracker};
|
||||
VFS = new Context(Queue) {UpdateTracker = UpdateTracker};
|
||||
ModManager = ModManager.MO2;
|
||||
|
||||
MO2Folder = mo2_folder;
|
||||
|
@ -112,20 +112,19 @@ namespace Wabbajack.VirtualFileSystem
|
||||
bw.Write(FileVersion);
|
||||
bw.Write((ulong) Index.AllFiles.Count);
|
||||
|
||||
var sizes = Index.AllFiles
|
||||
Index.AllFiles
|
||||
.PMap(Queue, f =>
|
||||
{
|
||||
var ms = new MemoryStream();
|
||||
f.Write(ms);
|
||||
return ms;
|
||||
})
|
||||
.Select(ms =>
|
||||
.Do(ms =>
|
||||
{
|
||||
var size = ms.Position;
|
||||
ms.Position = 0;
|
||||
bw.Write((ulong) size);
|
||||
ms.CopyTo(fs);
|
||||
return ms.Position;
|
||||
});
|
||||
Utils.Log($"Wrote {fs.Position.ToFileSizeString()} file as vfs cache file {filename}");
|
||||
}
|
||||
|
@ -68,8 +68,8 @@ namespace Wabbajack
|
||||
.Select(p => p.Current)
|
||||
.ToProperty(this, nameof(this.Compiler));
|
||||
|
||||
// Let sub VM determine what settings we're displaying and when
|
||||
this._CurrentModlistSettings = this.WhenAny(x => x.Compiler.ModlistSettings)
|
||||
// Let sub VM determine what settings we're displaying and when
|
||||
this._CurrentModlistSettings = this.WhenAny(x => x.Compiler.ModlistSettings)
|
||||
.ToProperty(this, nameof(this.CurrentModlistSettings));
|
||||
|
||||
this._Image = this.WhenAny(x => x.CurrentModlistSettings.ImagePath.TargetPath)
|
||||
|
@ -31,9 +31,6 @@ namespace Wabbajack
|
||||
private readonly ObservableAsPropertyHelper<ViewModel> _ActivePane;
|
||||
public ViewModel ActivePane => _ActivePane.Value;
|
||||
|
||||
private readonly ObservableAsPropertyHelper<int> _QueueProgress;
|
||||
public int QueueProgress => _QueueProgress.Value;
|
||||
|
||||
public ObservableCollectionExtended<CPUStatus> StatusList { get; } = new ObservableCollectionExtended<CPUStatus>();
|
||||
|
||||
public ObservableCollectionExtended<string> Log { get; } = new ObservableCollectionExtended<string>();
|
||||
@ -65,13 +62,6 @@ namespace Wabbajack
|
||||
.Subscribe()
|
||||
.DisposeWith(this.CompositeDisposable);
|
||||
|
||||
// TODO: fix this
|
||||
/*
|
||||
Utils.StatusUpdates
|
||||
.Subscribe((i) => WorkQueue.Report(i.Message, i.Progress))
|
||||
.DisposeWith(this.CompositeDisposable);
|
||||
*/
|
||||
|
||||
// Wire mode to drive the active pane.
|
||||
// Note: This is currently made into a derivative property driven by mode,
|
||||
// but it can be easily changed into a normal property that can be set from anywhere if needed
|
||||
@ -90,7 +80,7 @@ namespace Wabbajack
|
||||
})
|
||||
.ToProperty(this, nameof(this.ActivePane));
|
||||
|
||||
// TODO: fix this
|
||||
|
||||
// Compile progress updates and populate ObservableCollection
|
||||
/*
|
||||
WorkQueue.Status
|
||||
|
Loading…
Reference in New Issue
Block a user