Skip to content

Commit 1d9f22c

Browse files
committed
Creates new overview after 3 new changes.
1 parent ed764bc commit 1d9f22c

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Tools/AutoClient/Modes/FolderStore/FolderWorkOverview.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,19 @@ public async Task Update(ICodexInstance instance)
4949
State.StoreFailed = failed;
5050
SaveState();
5151

52-
if (createNewJsonZip)
52+
if (State.UncommitedChanges > 3)
5353
{
54+
State.UncommitedChanges = 0;
55+
SaveState();
56+
5457
await CreateNewOverviewZip(jsonFiles, FilePath, instance);
5558
}
5659
}
5760

5861
public void MarkUncommitedChange()
5962
{
60-
save this. consider this.
63+
State.UncommitedChanges++;
64+
SaveState();
6165
}
6266

6367
private async Task CreateNewOverviewZip(List<string> jsonFiles, string filePath, ICodexInstance instance)
@@ -78,7 +82,8 @@ private async Task CreateNewOverviewZip(List<string> jsonFiles, string filePath,
7882
Log("Storage requested. Purchase ID: " + result);
7983

8084
var outFile = Path.Combine(app.Config.DataPath, "OverviewZip.cid");
81-
File.WriteAllLines(outFile, [DateTime.UtcNow.ToString("o") + " - " + result.EncodedCid.Id]);
85+
File.AppendAllLines(outFile, [DateTime.UtcNow.ToString("o") + " - " + result.EncodedCid.Id]);
86+
Log($">>> [{outFile}] has been updated. <<<");
8287
}
8388
catch (Exception exc)
8489
{

Tools/AutoClient/Modes/FolderStoreMode.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@ private async Task<FileWorker> ProcessWorkItem(ICodexInstance instance)
6767

6868
private void OnFileUploaded()
6969
{
70-
var overview = new FolderWorkOverview(app, purchaseInfo, folder);
71-
overview.MarkUncommitedChange();
7270
}
7371

7472
private void OnNewPurchase()
7573
{
7674
app.FolderWorkDispatcher.ResetIndex();
75+
76+
var overview = new FolderWorkOverview(app, purchaseInfo, folder);
77+
overview.MarkUncommitedChange();
7778
}
7879

7980
public void Stop()

0 commit comments

Comments
 (0)