GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fixing issue #29 (onedrive continuous triggering not working) · HighEncryption/SyncPro@9ff5008

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • SyncPro.Adapters.MicrosoftOneDrive
    • OneDriveAdapter.cs
  • SyncPro.Adapters.WindowsFileSystem
    • WindowsFileSystemAdapter.cs
  • SyncPro.Core/Adapters
    • IChangeNotification.cs
  • SyncPro.UI/ViewModels
    • EntryUpdateInfoViewModel.cs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎SyncPro.Adapters.MicrosoftOneDrive/OneDriveAdapter.cs‎

Copy file name to clipboardExpand all lines: SyncPro.Adapters.MicrosoftOneDrive/OneDriveAdapter.cs
+13-2Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,21 @@ private async Task ChangeNotificationThreadMain()
643643
Logger.LogException(exception, "Failed to pull changes from OneDrive");
644644
}
645645

646-
if (changes != null &&
646+
if (changes != null &&
647+
changes.Changes.Any() &&
647648
!string.Equals(changes.State, this.Config.LatestDeltaToken, StringComparison.Ordinal))
648649
{
649-
this.ItemChanged?.Invoke(this, new ItemsChangedEventArgs());
650+
ItemsChangedEventArgs eventArgs = new ItemsChangedEventArgs();
651+
652+
foreach (IChangeTrackedAdapterItem change in changes.Changes)
653+
{
654+
eventArgs.Changes.Add(
655+
new ItemChange(
656+
change.FullName,
657+
ItemChangeType.None));
658+
}
659+
660+
this.ItemChanged?.Invoke(this, eventArgs);
650661
}
651662

652663
Logger.Debug("OneDriveAdapter.ChangeNotificationThreadMain delay for " + OneDriveChangeNotificationPollingInterval);
Collapse file

‎SyncPro.Adapters.WindowsFileSystem/WindowsFileSystemAdapter.cs‎

Copy file name to clipboardExpand all lines: SyncPro.Adapters.WindowsFileSystem/WindowsFileSystemAdapter.cs
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,10 @@ public override void FinalizeItemWrite(Stream stream, EntryUpdateInfo updateInfo
350350
SyncEntry = updateInfo.Entry,
351351
AdapterId = this.Configuration.Id,
352352
};
353+
354+
// [2018-04-30] It appears that the SyncEntryId field needs to be set on the adapter entry
355+
// in order to avoid a referential integrity violation in the DB.
356+
adapterEntry.SyncEntryId = updateInfo.Entry.Id;
353357

354358
updateInfo.Entry.AdapterEntries.Add(adapterEntry);
355359
}
@@ -574,9 +578,10 @@ private void NotifyOfPendingChanges()
574578
return;
575579
}
576580

577-
this.ItemChanged?.Invoke(
578-
this,
579-
new ItemsChangedEventArgs { Changes = pendingChangesToProcess });
581+
ItemsChangedEventArgs eventArgs = new ItemsChangedEventArgs();
582+
eventArgs.Changes.AddRange(pendingChangesToProcess);
583+
584+
this.ItemChanged?.Invoke(this, eventArgs);
580585
}
581586

582587
private void FileSystemWatcherError(object sender, ErrorEventArgs e)
Collapse file

‎SyncPro.Core/Adapters/IChangeNotification.cs‎

Copy file name to clipboardExpand all lines: SyncPro.Core/Adapters/IChangeNotification.cs
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ public ItemChange(string fullName, ItemChangeType changeType)
4545
/// </summary>
4646
public class ItemsChangedEventArgs : EventArgs
4747
{
48-
public List<ItemChange> Changes { get; set; }
48+
public ItemsChangedEventArgs()
49+
{
50+
this.Changes = new List<ItemChange>();
51+
}
52+
53+
public List<ItemChange> Changes { get; }
4954
}
5055

5156
/// <summary>
Collapse file

‎SyncPro.UI/ViewModels/EntryUpdateInfoViewModel.cs‎

Copy file name to clipboardExpand all lines: SyncPro.UI/ViewModels/EntryUpdateInfoViewModel.cs
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ public EntryUpdateInfoViewModel(
197197
this.RelativePath = info.RelativePath;
198198
this.syncEntryId = info.Entry.Id;
199199
this.sourceAdapterId = sourceAdapterId;
200-
this.adapterEntryId = info.Entry.AdapterEntries.First(a => a.AdapterId == sourceAdapterId).AdapterEntryId;
200+
var adapterEntry = info.Entry.AdapterEntries.FirstOrDefault(a => a.AdapterId == sourceAdapterId);
201+
if (adapterEntry != null)
202+
{
203+
this.adapterEntryId = adapterEntry.AdapterEntryId;
204+
}
201205

202206
this.IsDirectory = info.Entry.Type == SyncEntryType.Directory;
203207

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.