2using System.Collections.Generic;
3using System.Runtime.InteropServices.ComTypes;
4using System.Threading.Tasks;
15 private readonly Dictionary<string, string> folderIds =
new Dictionary<string, string>();
16 private readonly
Query query;
18 private int nrFoldersAdded = 0;
19 private int nrFoldersFound = 0;
20 private int nrFoldersDeleted = 0;
21 private int nrFilesAdded = 0;
22 private int nrFilesFound = 0;
23 private int nrFilesDeleted = 0;
36 private async Task<string> GetFolderTableId(
string Folder)
38 if (this.folderIds.TryGetValue(Folder, out
string TableId))
41 TableId =
"F" + (this.folderIds.Count + 1).ToString();
42 this.folderIds[Folder] = TableId;
44 await this.query.BeginSection(Folder);
45 await this.query.NewTable(TableId,
"Files in " + Folder,
57 public async Task
FileFound(
string Folder,
string FileName)
59 string TableId = await this.GetFolderTableId(Folder);
61 await this.query.NewRecords(TableId,
new Record(FileName,
"-"));
71 public async Task
FolderFound(
string Folder,
string SubFolder)
73 string TableId = await this.GetFolderTableId(Folder);
75 await this.query.NewRecords(TableId,
new Record(SubFolder,
"-"));
77 this.nrFoldersFound++;
85 public async Task
FileAdded(
string Folder,
string FileName)
87 string TableId = await this.GetFolderTableId(Folder);
89 await this.query.NewRecords(TableId,
new Record(FileName,
"Added"));
99 public async Task
FolderAdded(
string Folder,
string SubFolder)
101 string TableId = await this.GetFolderTableId(Folder);
103 await this.query.NewRecords(TableId,
new Record(SubFolder,
"Added"));
105 this.nrFoldersAdded++;
115 string TableId = await this.GetFolderTableId(Folder);
117 await this.query.NewRecords(TableId,
new Record(FileName,
"Deleted"));
119 this.nrFilesDeleted++;
129 string TableId = await this.GetFolderTableId(Folder);
131 await this.query.NewRecords(TableId,
new Record(SubFolder,
"Deleted"));
133 this.nrFoldersDeleted++;
141 await this.query.Start();
142 await this.query.SetTitle(this.node.FolderPath);
144 await this.query.BeginSection(
"Title");
145 await this.query.NewTable(
"Totals",
"Totals",
148 await this.query.EndSection();
155 public async Task
Error(Exception ex)
157 await this.query.LogMessage(ex);
165 await this.query.NewRecords(
"Totals",
166 new Record(
"#Files Existed", this.nrFilesFound),
167 new Record(
"#Files Added", this.nrFilesAdded),
168 new Record(
"#Files Deleted", this.nrFilesDeleted),
169 new Record(
"#Folders Existed", this.nrFoldersFound),
170 new Record(
"#Folders Added", this.nrFoldersAdded),
171 new Record(
"#Folders Deleted", this.nrFoldersDeleted));
172 await this.query.TableDone(
"Totals");
174 foreach (KeyValuePair<string, string> P
in this.folderIds)
175 await this.query.TableDone(P.Value);
177 await this.query.Done();
Generates basic statistics around a folder synchronization process.
async Task FileDeleted(string Folder, string FileName)
File node deleted from topology.
async Task FileFound(string Folder, string FileName)
File found, corresponding to node in topology.
async Task FileAdded(string Folder, string FileName)
File node added to topology.
async Task FolderAdded(string Folder, string SubFolder)
Subfolder node added to topology.
async Task Start()
Synchronization starts.
async Task Done()
Synchronization has completed.
async Task Error(Exception ex)
An exception has occurred during synchronization.
async Task FolderDeleted(string Folder, string SubFolder)
Subfolder node deleted from topology.
async Task FolderFound(string Folder, string SubFolder)
Subfolder found, corresponding to node in topology.
SynchronizationStatistics(FolderNode Node, Query Query)
Generates basic statistics around a folder synchronization process.
Represents a file folder in the file system.
Defines a column in a table.
Class handling the reception of data from a query.
Defines a record in a table.
ColumnAlignment
Column alignment.