private static async Task<bool> UserIsLogOff(Api api) { try { await api.Folders.GetInfo("0"); return false; } catch (WebException e) { if (((HttpWebResponse) e.Response).StatusCode == HttpStatusCode.Unauthorized) { return true; } throw; } }
private async Task<Synchronization> CreateSynchronization() { api = new Api(await GenerateAuthToken, new Files(), new Folders()); var sync = new Synchronization(api, new FilesComparison(), new FoldersComparison()); sync.Preparing += () => LogEvent("Preparing"); sync.Synchronizing += () => LogEvent("Synchronizing"); sync.Downloading += () => LogEvent("Downloading"); sync.Uploading += () => LogEvent("Uploading"); sync.Deleting += () => LogEvent("Deleting"); sync.Done += () => LogEvent("Done"); sync.UnknownError += () => LogEvent("Unknown Error"); return sync; }
private Synchronization Init() { api = new Api(null, new FilesFake(map, Local, Server), new FoldersFake(map)); return new Synchronization(api, new FilesComparison(TestFilesCollection), new FoldersComparison(TestFoldersCollection)); }