public async Task <IActionResult> GenerateOnlineRealm( [FromQuery] string commitSha, [FromQuery] string realmServerUrl, [FromQuery] string realmName) { var auditData = commitSha != null ? await this.updateManager.GetAuditXmlData(commitSha) : await this.updateManager.GetAuditXmlData(); logger.LogInformation("Realm to update {RealmServerUrl}/{RealmName}", realmServerUrl, realmName); var user = await realmSettings.GetUser(); var realmUrl = new Uri($"realms://{realmServerUrl}/{realmName}"); var realm = await user.GetRealm(realmUrl); DotNetRuRealmHelper.ReplaceRealm(realm, auditData); return(new OkResult()); }
public async Task <FileStreamResult> GenerateOfflineRealm([FromQuery] string commitSha) { var auditData = commitSha != null ? await UpdateManager.GetAuditData(commitSha) : await UpdateManager.GetAuditData(); var realmOfflinePath = $"{Path.GetTempPath()}/DotNetRuOffline.realm"; Realm.DeleteRealm(new RealmConfiguration(realmOfflinePath)); var realm = Realm.GetInstance(realmOfflinePath); DotNetRuRealmHelper.ReplaceRealm(realm, auditData); var stream = System.IO.File.OpenRead(realmOfflinePath); return(new FileStreamResult(stream, "application/octet-stream") { FileDownloadName = "DotNetRuOffline.realm" }); }