Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions Controllers/ExternalReportServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,23 @@ public override List<CatalogItem> GetItems(string folderName, ItemTypeEnum type,

if (type == ItemTypeEnum.DataSet)
{
foreach (var file in Directory.GetFiles(Path.Combine(targetFolder, "DataSet")))
var dataSetProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(targetFolder, "DataSet"));
foreach (var file in dataSetProvider.GetDirectoryContents("").Where(f => !f.IsDirectory))
{
CatalogItem catalogItem = new CatalogItem();
catalogItem.Name = Path.GetFileNameWithoutExtension(file);
catalogItem.Name = Path.GetFileNameWithoutExtension(file.Name);
catalogItem.Type = ItemTypeEnum.DataSet;
catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+", "_");
_items.Add(catalogItem);
}
}
else if (type == ItemTypeEnum.DataSource)
{
foreach (var file in Directory.GetFiles(Path.Combine(targetFolder, "DataSource")))
var dataSourceProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(targetFolder, "DataSource"));
foreach (var file in dataSourceProvider.GetDirectoryContents("").Where(f => !f.IsDirectory))
{
CatalogItem catalogItem = new CatalogItem();
catalogItem.Name = Path.GetFileNameWithoutExtension(file);
catalogItem.Name = Path.GetFileNameWithoutExtension(file.Name);
catalogItem.Type = ItemTypeEnum.DataSource;
catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+", "_");
_items.Add(catalogItem);
Expand All @@ -82,10 +84,11 @@ public override List<CatalogItem> GetItems(string folderName, ItemTypeEnum type,
{
string reportTypeExt = this.reportType == "RDLC" ? ".rdlc" : ".rdl";

foreach (var file in Directory.GetFiles(targetFolder, "*" + reportTypeExt))
var reportProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(targetFolder);
foreach (var file in reportProvider.GetDirectoryContents("").Where(f => !f.IsDirectory && f.Name.EndsWith(reportTypeExt)))
{
CatalogItem catalogItem = new CatalogItem();
catalogItem.Name = Path.GetFileNameWithoutExtension(file);
catalogItem.Name = Path.GetFileNameWithoutExtension(file.Name);
catalogItem.Type = ItemTypeEnum.Report;
catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+", "_");
_items.Add(catalogItem);
Expand Down Expand Up @@ -133,7 +136,6 @@ public override bool EditReport(byte[] reportdata)
string targetFolder = Path.Combine(this.basePath, "resources", "Report");
string reportPat = Path.Combine(targetFolder, catagoryName, reportName);
File.WriteAllBytes(reportPat, reportdata.ToArray());

return true;
}

Expand Down
14 changes: 11 additions & 3 deletions Controllers/LogExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,23 @@ public static void RegisterLog4NetConfig(string configPath = "")
var prjDir = Path.GetFullPath(Path.Combine(folderPath));
if (!string.IsNullOrEmpty(configPath) && File.Exists(configPath))
{
XmlConfigurator.Configure(repository, new System.IO.FileInfo(configPath));
var fileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.GetDirectoryName(configPath));
var fileInfo = fileProvider.GetFileInfo(Path.GetFileName(configPath));
using var configStream = fileInfo.CreateReadStream();
XmlConfigurator.Configure(repository, configStream);
}
else if (File.Exists(Path.Combine(prjDir, "log4net.config")))
{
XmlConfigurator.Configure(repository, new System.IO.FileInfo(Path.Combine(prjDir, "log4net.config")));
var configFile = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(prjDir).GetFileInfo("log4net.config");
using var configStream = configFile.CreateReadStream();
XmlConfigurator.Configure(repository, configStream);
}
else if (File.Exists(Path.Combine(prjDir, "logs", "log4net.config")))
{
XmlConfigurator.Configure(repository, new System.IO.FileInfo(Path.Combine(prjDir, "logs", "log4net.config")));
var fileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(prjDir, "logs"));
var configFile = fileProvider.GetFileInfo("log4net.config");
using var configStream = configFile.CreateReadStream();
XmlConfigurator.Configure(repository, configStream);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Controllers/PreviewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public IActionResult Preview()
string foderName = this.ControllerContext.RouteData.Values["controller"].ToString();
ViewBag.action = "Preview";
ViewBag.isDesigner = false;
if (foderName == "ExternalParameterReport")
if (foderName == "ExternalParameterReport" || foderName == "MultiLanguageReport")
{
ViewBag.parameterSettings = new BoldReports.Models.ReportViewer.ParameterSettings();
ViewBag.parameterSettings.HideParameterBlock = true;
Expand Down
19 changes: 12 additions & 7 deletions Controllers/ReportDesignerWebApiController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Configuration;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
Expand All @@ -24,6 +25,7 @@ public class ReportDesignerWebApiController : Controller, IReportDesignerControl
{
private Microsoft.Extensions.Caching.Memory.IMemoryCache _cache;
private IWebHostEnvironment _hostingEnvironment;
private readonly IConfiguration _configuration;
internal ReportHelperSettings _helperSettings = null;
internal ExternalServer Server
{
Expand All @@ -41,10 +43,11 @@ internal ReportHelperSettings HelperSettings
set { this._helperSettings = value; }
}

public ReportDesignerWebApiController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache, IWebHostEnvironment hostingEnvironment)
public ReportDesignerWebApiController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache, IWebHostEnvironment hostingEnvironment, IConfiguration configuration)
{
_cache = memoryCache;
_hostingEnvironment = hostingEnvironment;
_configuration = configuration;
ExternalServer externalServer = new ExternalServer(_hostingEnvironment);
this.Server = externalServer;
this.ServerURL = "Sample";
Expand Down Expand Up @@ -77,13 +80,15 @@ public bool DisposeObjects()

for (var index = 0; index < dirs.Length; index++)
{
string[] files = Directory.GetFiles(dirs[index]);
var dirProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(dirs[index]);
var files = dirProvider.GetDirectoryContents("").Where(f => !f.IsDirectory).Select(f => Path.Combine(dirs[index], f.Name)).ToArray();

var fileCount = 0;
for (var fileIndex = 0; fileIndex < files.Length; fileIndex++)
{
FileInfo fi = new FileInfo(files[fileIndex]);
if (fi.LastAccessTimeUtc < DateTime.UtcNow.AddDays(-2))
var fileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.GetDirectoryName(files[fileIndex]));
var fileInfo = fileProvider.GetFileInfo(Path.GetFileName(files[fileIndex]));
if (fileInfo.Exists && fileInfo.LastModified < DateTimeOffset.UtcNow.AddDays(-2))
{
fileCount++;
}
Expand Down Expand Up @@ -118,7 +123,8 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)
reportOption.ReportModel.ReportingServer = this.Server;
reportOption.ReportModel.ReportServerUrl = this.ServerURL;
reportOption.ReportModel.EmbedImageData = true;
reportOption.ReportModel.ReportServerCredential = new NetworkCredential("Sample", "Passwprd");
reportOption.ReportModel.ReportServerCredential = new NetworkCredential(_configuration["reportServer:userName"], _configuration["reportServer:password"]);
reportOption.ReportModel.ExportResources.BrowserExecutablePath = Path.Combine(_hostingEnvironment.WebRootPath, "puppeteer", "Win-901912", "chrome-win");

if (reportOption.ReportModel.FontSettings == null)
{
Expand All @@ -145,7 +151,7 @@ public object PostFormDesignerAction()
{
return ReportDesignerHelper.ProcessDesigner(null, this, null, this._cache);
}

[HttpPost]
public object PostFormReportAction()
{
Expand Down Expand Up @@ -203,7 +209,6 @@ public bool SetData(string key, string itemId, ItemInfo itemData, out string err
{
System.IO.File.Delete(writePath);
}

System.IO.File.WriteAllBytes(writePath, bytes);
stream.Close();
stream.Dispose();
Expand Down
19 changes: 19 additions & 0 deletions Controllers/ReportViewer/DynamicLogosController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace ReportsCoreSamples.Controllers
{
[Route("report-viewer/dynamic-logos")]
public class DynamicLogosController : PreviewController
{
[HttpGet("")]
public IActionResult Index()
{
this.updateMetaData();
return View();
}
}
}
28 changes: 28 additions & 0 deletions Controllers/ReportViewer/MultiLanguageReportController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ReportsCoreSamples.Models;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.AspNetCore.Mvc;

namespace ReportsCoreSamples.Controllers
{
[Route("report-viewer/multi-language-report")]
public class MultiLanguageReportController : PreviewController
{
private Microsoft.Extensions.Caching.Memory.IMemoryCache _cache;
public MultiLanguageReportController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache)
{
_cache = memoryCache;
}
[HttpGet("")]
public IActionResult Index()
{
ViewBag.parameterSettings = new BoldReports.Models.ReportViewer.ParameterSettings();
ViewBag.parameterSettings.HideParameterBlock = true;
this.updateMetaData();
return View();
}
}
}
8 changes: 4 additions & 4 deletions Controllers/ReportViewerWebApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)
{
reportPath += ".rdlc";
}
FileStream reportStream = new FileStream(Path.Combine(basePath, "resources", "Report", reportPath), FileMode.Open, FileAccess.Read);
reportOption.ReportModel.Stream = reportStream;
var reportFileInfo = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(basePath, "resources", "Report")).GetFileInfo(reportPath);
reportOption.ReportModel.Stream = reportFileInfo.Exists ? reportFileInfo.CreateReadStream() : throw new FileNotFoundException();

if (reportOption.ReportModel.FontSettings == null)
{
reportOption.ReportModel.FontSettings = new BoldReports.RDL.Data.FontSettings();
}
reportOption.ReportModel.FontSettings.BasePath = Path.Combine(_hostingEnvironment.WebRootPath, "fonts");

reportOption.ReportModel.ExportResources.BrowserExecutablePath = Path.Combine(_hostingEnvironment.WebRootPath, "puppeteer", "Win-901912", "chrome-win");
}

// Method will be called when reported is loaded with internally to start to layout process with ReportHelper.
Expand All @@ -92,7 +92,7 @@ public object GetResource(ReportResource resource)
{
return ReportHelper.GetResource(resource, this, this._cache);
}

[HttpPost]
public object PostFormReportAction()
{
Expand Down
17 changes: 9 additions & 8 deletions Controllers/ReportWriterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ public IActionResult Generate(string reportName, string type)
reportWriter.ReportServerCredential = System.Net.CredentialCache.DefaultCredentials;

reportWriter.ReportProcessingMode = ProcessingMode.Remote;
reportWriter.ExportSettings = new customBrowsertype(_hostingEnvironment);
reportWriter.ExportResources.BrowserType = ExportResources.BrowserTypes.External;
reportWriter.ExportResources.ResourcePath = Path.Combine(basePath, "puppeteer");
string puppeteerPath = reportWriter.ExportResources.ResourcePath + @"/Win-901912/chrome-win/chrome.exe";
reportWriter.ExportSettings = new customBrowsertype(puppeteerPath);
reportWriter.ExportResources.BrowserExecutablePath = Path.GetDirectoryName(puppeteerPath);

FileStream inputStream = new FileStream(Path.Combine(basePath, "resources", "Report", reportName + ".rdl"), FileMode.Open, FileAccess.Read);
var reportFileInfo = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(basePath, "resources", "Report")).GetFileInfo(reportName + ".rdl");
var inputStream = reportFileInfo.Exists ? reportFileInfo.CreateReadStream() : throw new FileNotFoundException();
reportWriter.LoadReport(inputStream);

reportWriter.ExportResources.Scripts = new List<string>
Expand Down Expand Up @@ -139,20 +142,18 @@ public IActionResult Generate(string reportName, string type)

public class customBrowsertype : ExportSettings
{
private IWebHostEnvironment _hostingEnvironment;
private string _puppeteerPath;

public customBrowsertype(IWebHostEnvironment hostingEnvironment)
public customBrowsertype(string path)
{
_hostingEnvironment = hostingEnvironment;
_puppeteerPath = path;
}
public override string GetImageFromHTML(string url)
{
return ConvertBase64(url).Result;
}
public async Task<string> ConvertBase64(string url)
{
string puppeteerChromeExe = "";
puppeteerChromeExe = Path.Combine(_hostingEnvironment.WebRootPath, "puppeteer", "Win-901912", "chrome-win", "chrome.exe");
await using var browser = await PuppeteerSharp.Puppeteer.LaunchAsync(new PuppeteerSharp.LaunchOptions
{
Headless = true,
Expand All @@ -167,7 +168,7 @@ public async Task<string> ConvertBase64(string url)
"--dump-blink-runtime-call-stats",
"--profiling-flush",
},
ExecutablePath = puppeteerChromeExe
ExecutablePath = _puppeteerPath
});
await using var page = await browser.NewPageAsync();
await page.GoToAsync(url);
Expand Down
8 changes: 4 additions & 4 deletions Models/SampleData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ namespace ReportsCoreSamples.Models
public class SampleData
{
private IWebHostEnvironment _hostingEnvironment;
public SampleData(IWebHostEnvironment environment)
public SampleData(IWebHostEnvironment environment)
{
_hostingEnvironment = environment;
}
public dynamic getSampleData()
{
string json = System.IO.File.ReadAllText(_hostingEnvironment.WebRootPath + "/samples.json");
dynamic sampleJson = JsonConvert.DeserializeObject(json);
return sampleJson;
var fileInfo = _hostingEnvironment.WebRootFileProvider.GetFileInfo("samples.json");
using var reader = new System.IO.StreamReader(fileInfo.CreateReadStream());
return new JsonSerializer().Deserialize(reader, typeof(object));
}
}
}
Binary file removed Nuget/BoldReports.Base.Logger.10.1.11.nupkg
Binary file not shown.
Binary file added Nuget/BoldReports.Base.Logger.11.1.10.nupkg
Binary file not shown.
38 changes: 19 additions & 19 deletions ReportsCoreSamples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.12.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Bold.Licensing" Version="10.1.11" />
<PackageReference Include="BoldReports.AspNet.Core" Version="10.1.11" />
<PackageReference Include="BoldReports.CRI.Barcode" Version="10.1.11" />
<PackageReference Include="BoldReports.CRI.Signature" Version="10.1.11" />
<PackageReference Include="BoldReports.CRI.Shape" Version="10.1.11" />
<PackageReference Include="BoldReports.CRI.Html" Version="10.1.11">
<PackageReference Include="Bold.Licensing" Version="11.1.10" />
<PackageReference Include="BoldReports.AspNet.Core" Version="11.1.10" />
<PackageReference Include="BoldReports.CRI.Barcode" Version="11.1.10" />
<PackageReference Include="BoldReports.CRI.Signature" Version="11.1.10" />
<PackageReference Include="BoldReports.CRI.Shape" Version="11.1.10" />
<PackageReference Include="BoldReports.CRI.Html" Version="11.1.10">
<ExcludeAssets>native</ExcludeAssets>
</PackageReference>
<PackageReference Include="BoldReports.CRI.Pdf" Version="10.1.11" />
<PackageReference Include="BoldReports.Net.Core" Version="10.1.11" />
<PackageReference Include="BoldReports.Data.WebData" Version="10.1.11" />
<PackageReference Include="BoldReports.Data.Csv" Version="10.1.11" />
<PackageReference Include="BoldReports.Data.Excel" Version="10.1.11" />
<PackageReference Include="BoldReports.Data.ElasticSearch" Version="10.1.11" />
<PackageReference Include="BoldReports.Data.SSAS" Version="10.1.11" />
<PackageReference Include="BoldReports.CRI.Pdf" Version="11.1.10" />
<PackageReference Include="BoldReports.Net.Core" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.WebData" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.Csv" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.Excel" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.ElasticSearch" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.SSAS" Version="11.1.10" />
<PackageReference Include="BuildBundlerMinifier" Version="3.2.449" />
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="PuppeteerSharp" Version="5.0.0" />
Expand All @@ -43,12 +43,12 @@
</PackageReference>
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="BoldReports.Data.MySQL" Version="10.1.11" />
<PackageReference Include="BoldReports.Data.Oracle" Version="10.1.11" />
<PackageReference Include="BoldReports.Data.PostgreSQL" Version="10.1.11" />
<PackageReference Include="BoldReports.Data.Snowflake" Version="10.1.11" />
<PackageReference Include="BoldReports.Data.GoogleBigQuery" Version="10.1.11" />
<PackageReference Include="BoldReports.Data.MongoDB" Version="10.1.11" />
<PackageReference Include="BoldReports.Data.MySQL" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.Oracle" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.PostgreSQL" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.Snowflake" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.GoogleBigQuery" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.MongoDB" Version="11.1.10" />
</ItemGroup>
<ItemGroup>
<None Include="Controllers\**" CopyToOutputDirectory="Always" />
Expand Down
Loading
Loading