/// <summary> /// Cunstructs the instance. /// </summary> /// <param name="module">Module containing report viewer component.</param> /// <exception cref="ArgumentNullException">Whem <paramref name="module"/> is null.</exception> public SolidCPModuleResourceStorage(SolidCPModuleBase module) { if (module == null) { throw new ArgumentNullException("module"); } this.module = module; }
/// <summary> /// Load report from file on disk. /// </summary> /// <param name="reportPath">Path to the report file.</param> /// <param name="reportResourceId">Resource id of a report inside resource file.</param> /// <param name="module">Instance of a module containing the ReportViewer component.</param> /// <returns><see cref="TextReader"/> containing the localized report file.</returns> /// <exception cref="ArgumentNullException">When <paramref name="reportPath"/> or <paramref name="module"/> is null.</exception> public static TextReader LoadReportFromFile(string reportPath, string reportResourceId, SolidCPModuleBase module) { if (String.IsNullOrEmpty(reportPath)) { throw new ArgumentNullException("reportPath"); } if (module == null) { throw new ArgumentNullException("module"); } return(new FileSystemReportLocalizer( reportPath , reportResourceId , new SolidCPModuleResourceStorage(module) ).GetLocalizedReportStream()); }
/// <summary> /// Loads embedded report file. /// </summary> /// <param name="assembly"><see cref="Assembly"/> containing the report file.</param> /// <param name="embeddedReportName">Name of the report in format {default namespace}.{folder structure inside assembly}.{file name with extension}</param> /// <param name="embeddedReportResourceId">Resource identifier of a report being loaded.</param> /// <param name="module">Instance of a module containing the ReportViewer component.</param> /// <returns><see cref="TextReader"/> containing the localized report file.</returns> /// <exception cref="ArgumentNullException">When <paramref name="assembly"/>, <paramref name="embeddedReportName"/> or <paramref name="module"/> is null.</exception> public static TextReader LoadReportFileFromAssembly(Assembly assembly, string embeddedReportName, string embeddedReportResourceId, SolidCPModuleBase module) { if (assembly == null) { throw new ArgumentNullException("assembly"); } if (String.IsNullOrEmpty(embeddedReportName)) { throw new ArgumentNullException("embeddedReportName"); } if (module == null) { throw new ArgumentNullException("module"); } return(new EmbeddedReportLocalizer( assembly , embeddedReportName , embeddedReportResourceId , new SolidCPModuleResourceStorage(module) ).GetLocalizedReportStream()); }