-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.3 Release
- Loading branch information
Showing
110 changed files
with
2,738 additions
and
2,206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,3 +235,5 @@ record.auth* | |
.NativeSettings | ||
.clientId | ||
settings.json | ||
additionalBackupData.json | ||
.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using Microsoft.Graph.Models; | ||
|
||
namespace onedrive_backup.Contracts | ||
{ | ||
public class BackupAdditionalData | ||
{ | ||
public BackupAdditionalData() | ||
{ | ||
Backups = new(); | ||
} | ||
|
||
public List<BackupData> Backups { get; set; } | ||
|
||
public bool IsRetainedLocally(string slug) | ||
{ | ||
var backup = Backups.FirstOrDefault(backupData => backupData.Slug == slug); | ||
return (backup != null && backup.RetainLocal); | ||
} | ||
|
||
public bool IsRetainedOneDrive(string slug) | ||
{ | ||
var backup = Backups.FirstOrDefault(backupData => backupData.Slug == slug); | ||
return (backup != null && backup.RetainOneDrive); | ||
} | ||
|
||
public int PruneAdditionalBackupData(params string[] existingSlugs) | ||
{ | ||
return Backups.RemoveAll(backup => !existingSlugs.Contains(backup.Slug)); | ||
} | ||
|
||
public void UpdateRetainLocally(string slug, bool retain) | ||
{ | ||
var backup = GetOrCreateBackupData(slug); | ||
backup.RetainLocal = retain; | ||
} | ||
|
||
public void UpdateRetainOneDrive(string slug, bool retain) | ||
{ | ||
var backup = GetOrCreateBackupData(slug); | ||
backup.RetainOneDrive = retain; | ||
} | ||
|
||
private BackupData GetOrCreateBackupData(string slug) | ||
{ | ||
var backup = Backups.FirstOrDefault(backupData => backupData.Slug == slug); | ||
if (backup == null) | ||
{ | ||
backup = new BackupData | ||
{ | ||
Slug = slug | ||
}; | ||
|
||
Backups.Add(backup); | ||
} | ||
|
||
return backup; | ||
} | ||
|
||
public class BackupData | ||
{ | ||
public string Slug { get; set; } | ||
|
||
public bool RetainLocal { get; set; } | ||
|
||
public bool RetainOneDrive { get; set; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.