2
0
mirror of synced 2025-01-12 01:24:23 +00:00

show index

This commit is contained in:
Ben 2024-11-26 16:22:43 +01:00
parent d136345df4
commit 529d48a758
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B
2 changed files with 18 additions and 7 deletions

View File

@ -14,14 +14,14 @@ namespace AutoClient.Modes.FolderStore
private readonly Action onNewPurchase;
private readonly CodexNode codex;
public FileWorker(App app, ICodexInstance instance, PurchaseInfo purchaseInfo, string folder, string filename, Action onFileUploaded, Action onNewPurchase)
public FileWorker(App app, ICodexInstance instance, PurchaseInfo purchaseInfo, string folder, FileIndex filename, Action onFileUploaded, Action onNewPurchase)
: base(app, folder, filename + ".json", purchaseInfo)
{
this.app = app;
log = new LogPrefixer(app.Log, GetFileTag(filename));
this.instance = instance;
this.purchaseInfo = purchaseInfo;
sourceFilename = filename;
sourceFilename = filename.File;
this.onFileUploaded = onFileUploaded;
this.onNewPurchase = onNewPurchase;
codex = new CodexNode(app, instance);
@ -225,10 +225,9 @@ namespace AutoClient.Modes.FolderStore
log.Log(msg);
}
private string GetFileTag(string filename)
private string GetFileTag(FileIndex filename)
{
var i = Math.Abs(filename.GetHashCode() % 9999);
return $"({i.ToString("0000")}) ";
return $"({filename.Index.ToString("00000")}) ";
}
[Serializable]

View File

@ -23,9 +23,9 @@
files = result.ToArray();
}
public string GetFileToCheck()
public FileIndex GetFileToCheck()
{
var file = files[index];
var file = new FileIndex(files[index], index);
index = (index + 1) % files.Length;
return file;
}
@ -35,4 +35,16 @@
index = 0;
}
}
public class FileIndex
{
public FileIndex(string file, int index)
{
File = file;
Index = index;
}
public string File { get; }
public int Index { get; }
}
}