public static async Task ResolveFoldersAsync(this IDvinApp dvinApp, IFolderResolver folderResolver, IErrorsAndInfos errorsAndInfos) { dvinApp.AreFoldersBeingResolved = true; dvinApp.SolutionFolder = (await folderResolver.ResolveAsync(dvinApp.SolutionFolder, errorsAndInfos)).FullName; dvinApp.ReleaseFolder = (await folderResolver.ResolveAsync(dvinApp.ReleaseFolder, errorsAndInfos)).FullName; dvinApp.PublishFolder = (await folderResolver.ResolveAsync(dvinApp.PublishFolder, errorsAndInfos)).FullName; dvinApp.ExceptionLogFolder = (await folderResolver.ResolveAsync(dvinApp.ExceptionLogFolder, errorsAndInfos)).FullName; dvinApp.AreFoldersBeingResolved = false; }
public async Task DriveResolvesToActualDrive() { IErrorsAndInfos errorsAndInfos = new ErrorsAndInfos(); Assert.AreEqual(@"E:", (await _Sut.ResolveAsync(@"$(SomeDrive)", errorsAndInfos)).FullName); Assert.IsFalse(errorsAndInfos.AnyErrors(), errorsAndInfos.ErrorsToString()); Assert.AreEqual(@"E:", (await _Sut.ResolveAsync(@"$(SomeDrive)\", errorsAndInfos)).FullName); Assert.IsFalse(errorsAndInfos.AnyErrors(), errorsAndInfos.ErrorsToString()); }
public async Task ResolveAsync(IFolderResolver folderResolver, IErrorsAndInfos errorsAndInfos) { foreach (var backbendFolder in this) { backbendFolder.SetFolder(await folderResolver.ResolveAsync(backbendFolder.Name, errorsAndInfos)); } }
public async Task <IFolder> ConfiguredSubspaceFolderAsync() { var errorsAndInfos = new ErrorsAndInfos(); var subspaceFolder = await FolderResolver.ResolveAsync(@"$(MainUserFolder)\Documents\Subspace", errorsAndInfos); if (errorsAndInfos.AnyErrors()) { throw new Exception(errorsAndInfos.ErrorsToString()); } if (!subspaceFolder.Exists()) { throw new Exception($"Folder does not exist: {subspaceFolder.FullName}"); } return(subspaceFolder); }
public async Task <HtmlValidationResult> IsHtmlMarkupValidAsync(string markup) { var markupFileName = ""; if (markup.Length > 10000) { var errorsAndInfos = new ErrorsAndInfos(); var folder = (await _FolderResolver.ResolveAsync(_SecuredHttpGateSettings.LocalhostTempPath, errorsAndInfos)).FullName; if (errorsAndInfos.AnyErrors()) { return(new HtmlValidationResult { Success = false, ErrorMessage = errorsAndInfos.ErrorsToString() }); } var shortFileName = "Markup" + markup.GetHashCode() + ".xml"; markupFileName = folder + "\\" + shortFileName; await File.WriteAllTextAsync(markupFileName, markup, Encoding.UTF8); markup = _SecuredHttpGateSettings.LocalhostTempPathUrl + shortFileName; } var aliceAndBob = await CreateAliceAndBobAsync(); var response = await _HttpGate.PostAsync(_SecuredHttpGateSettings.ApiUrl, new Dictionary <string, string> { { "markup", markup }, { "alice", aliceAndBob.Alice }, { "bob", aliceAndBob.Bob }, { "command", "ValidateMarkup" } }); if (markupFileName != "") { File.Delete(markupFileName); } if (response.StatusCode != HttpStatusCode.OK) { return(new HtmlValidationResult { Success = false, ErrorMessage = "Service unavailable" }); } var json = await response.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject <HtmlValidationResult>(json)); }