// Public Methods (1) /// <summary> /// Start generating the report based on the PdfRptData /// </summary> public byte[] GeneratePdf() { checkNullValues(); byte[] data; try { PdfDoc = new Document(DocumentSettings.GetPageSizeAndColor(_pdfRptData.DocumentPreferences), _pdfRptData.DocumentPreferences.PagePreferences.Margins.Left, _pdfRptData.DocumentPreferences.PagePreferences.Margins.Right, _pdfRptData.DocumentPreferences.PagePreferences.Margins.Top, _pdfRptData.DocumentPreferences.PagePreferences.Margins.Bottom); data = createPdf(); } finally { PdfDoc?.Close(); if (PdfWriter != null) { PdfWriter.CloseStream = true; PdfWriter.Close(); PdfWriter = null; } _stream?.Dispose(); } return(data); }
public HttpResponseMessage Options() { try { DocumentSettings settings = new DocumentSettings(ActiveModule); Options options = new Options { Resources = GetResources(), Rows = settings.Rows, ShowIcon = settings.ShowIcon, ResetFilters = settings.ResetFilters, Columns = GetColumns(settings), SynchronizeFolder = IsAdmin, FileManagement = settings.FileManagement, OpenOnDblclick = settings.OpenOnDblclick, ImagePreview = settings.ImagePreview }; return(Request.CreateResponse(HttpStatusCode.OK, options, GetFormatter())); } catch { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, LocalizeString("UnattentedError"))); } }
public void should_set_configuration_if_not_exist() { string path = DocumentSettings.GetStorePath("file.txt"); Console.WriteLine(path); Assert.IsTrue(Directory.Exists(Path.GetDirectoryName(path))); }
static AppFilePaths() { DocumentSettings docSettings = null; if (File.Exists(ResourceStructurePath)) { var json = File.ReadAllText(ResourceStructurePath, OtherSettings.Encoding); try { docSettings = JsonConvert.DeserializeObject <DocumentSettings>(json); } catch (Exception e) { App.Logger.Warn(e, $"Cannot deserialize \"{ResourceStructurePath}\""); } } if (docSettings == null) { var defRes = new Uri(DefaultResourceStructureFile, UriKind.Relative); string defJson; // ReSharper disable once PossibleNullReferenceException using (var stream = new StreamReader(Application.GetResourceStream(defRes).Stream)) defJson = stream.ReadToEnd(); App.Logger.Info("Default resource structure file initialized + \"" + DefaultResourceStructureFile + "\""); docSettings = JsonConvert.DeserializeObject <DocumentSettings>(defJson); var settings = JsonConvert.SerializeObject(docSettings, Formatting.Indented); File.WriteAllText(ResourceStructurePath, settings, OtherSettings.Encoding); } MyDocumentSettings = docSettings; ParentImages = ChildImages = PersonImages = Path.Combine(Resources, MyDocumentSettings.Images, "people"); }
public DocumentProvision(IDocumentRepository docRepository, IUserRepository userRepository, IUploadHelperFunctions uploadHelperFunctions, IOptions <GeneralSettings> generalSettings, IOptions <DocumentSettings> documentSettings, ICustomLogger customLogger, IOptions <SearchSettings> searchSettings, IConfigurationRoot configuration, IHttpContextAccessor httpContextAccessor, ISPOAuthorization spoAuthorization, IOptions <LogTables> logTables, IOptions <ErrorSettings> errorSettings) { this.docRepository = docRepository; this.uploadHelperFunctions = uploadHelperFunctions; this.userRepository = userRepository; this.generalSettings = generalSettings.Value; this.documentSettings = documentSettings.Value; this.customLogger = customLogger; this.logTables = logTables.Value; this.errorSettings = errorSettings.Value; this.searchSettings = searchSettings.Value; this.configuration = configuration; this.httpContextAccessor = httpContextAccessor; this.spoAuthorization = spoAuthorization; }
public override async Task <Document> LoadDocumentAsync(DocumentSettings settings, DocumentInfo?sourceInfo, string specifier, DocumentCategory category, DocumentContextCallback contextCallback) { var alias = ResourceModuleUtils.GetResourceAlias(specifier); if (alias is object) { var resource = await _resourceManager.GetResourceAsync(alias); if (resource is object) { var script = _resourceScriptFactory.CreateFromExtension(resource, Path.GetExtension(alias)); if (script is object) { return(new StringDocument(new DocumentInfo(specifier) { Category = ModuleCategory.Standard }, script)); } } } throw new FileNotFoundException($"The resource {alias} was not found"); //return await _defaultLoader.LoadDocumentAsync(settings, sourceInfo, specifier, category, contextCallback); }
public DocumentsController(IUnitOfWork unitOfWork, IMapper mapper, IHostingEnvironment host, IOptionsSnapshot <DocumentSettings> options) { _unitOfWork = unitOfWork; _mapper = mapper; _host = host; _documentSettings = options.Value; }
/// <summary> /// 在中间的tab 页新添加一个文档 /// </summary> /// <param name="documentControl"></param> /// <returns></returns> public IDocumentControl AddADocument(IDocumentControl documentControl, string name) { if (!(documentControl is Control)) { throw new WinformUIExceptionDeal("Type of " + documentControl.GetType().FullName + " is not a control."); } //XtraUserControl child = new XtraUserControl(); DocumentSettings DocumentSettings = new DocumentSettings(); if (documentControl.Document != null) { DocumentSettings.Caption = documentControl.Document.DocumentName ?? name; if (documentControl.DocumentImage != null) { DocumentSettings.Image = documentControl.DocumentImage; } } //DocumentSettings.Attach(child, DocumentSettings); //((Control)documentControl).Parent = child; ((Control)documentControl).Dock = DockStyle.Fill; ((Control)documentControl).GotFocus += (sender, e) => { }; ((Control)documentControl).Visible = true; DocumentSettings.Attach((Control)documentControl, DocumentSettings); this.documentManagerDocking.TabbedView.AddDocument((Control)documentControl); return(documentControl); }
public DownloadDocumentByIdQueryHandler(IDocumentRepositoryAsync documentRepository, IAuthenticatedUserService authenticatedUser, IOptions <DocumentSettings> settings, ICryptographyService cryptographyService) { _documentRepository = documentRepository; _authenticatedUser = authenticatedUser; _settings = settings.Value; _cryptographyService = cryptographyService; }
public HttpResponseMessage Thumbnail([FromUri] ItemCommand itemCommand) { try { string folderPath = PathUtils.Instance.FormatFolderPath(itemCommand.Path); string filePath = folderPath + itemCommand.Files[0]; IFileInfo file = FileManager.Instance.GetFile(PortalSettings.PortalId, filePath); if (file != null) { DocumentSettings settings = new DocumentSettings(ActiveModule); int height = settings.ThumbnailHeight; int width = settings.ThumbnailWidth; string extension = "." + file.Extension; using (Stream content = FileManager.Instance.GetFileContent(file)) { using (Stream thumbnail = ImageUtils.CreateImage(content, height, width, extension)) { string img64 = string.Format("data:{0};base64,{1}", file.ContentType, ReadFullyAsBase64(thumbnail)); return(Request.CreateResponse(HttpStatusCode.OK, img64)); } } } return(Request.CreateResponse(HttpStatusCode.NotFound, filePath)); } catch { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, LocalizeString("UnattentedError"))); } }
public DocumentBase(StyleSetup styleSetup, DocumentSettings settings) { Document = new Document(); DocumentSettings = settings; StyleSetup = styleSetup; Setup(); }
/// <summary> /// Initialises a new instance of the LiveDocument class. /// </summary> /// <param name="assemblies">The assemblies to document.</param> /// <param name="filters">The visibility filters.</param> public LiveDocument(List <DocumentedAssembly> assemblies, List <Reflection.Visibility> filters) : base(assemblies, Mappers.GroupedNamespaceFirst, true, new LiveDocumenterEntryCreator()) { DocumentSettings settings = new DocumentSettings(); settings.VisibilityFilters.AddRange(filters); this.Settings = settings; }
public ExpenseController( IExpenseReviewUOW uow, IHostingEnvironment host, IOptionsSnapshot <DocumentSettings> options) { UOW = uow; Host = host; Options = options.Value; }
public GetDocumentsHandler(IDocumentService documentService, IDocumentTypeService documentTypeService, ITranslationService translationService, DocumentSettings documentSettings) { _documentService = documentService; _documentTypeService = documentTypeService; _translationService = translationService; _documentSettings = documentSettings; }
private void initSettings() { _pdfDocumentSettings = new DocumentSettings { DocumentSecurity = _pdfRptData.DocumentSecurity, PageSetup = _pdfRptData.DocumentPreferences, PdfDoc = PdfDoc, PdfWriter = PdfWriter, DocumentProperties = _pdfRptData.DocumentPreferences.DocumentMetadata }; }
private void runInDebugMode() { PdfDoc = new Document(DocumentSettings.GetPageSizeAndColor(_pdfRptData.DocumentPreferences), _pdfRptData.DocumentPreferences.PagePreferences.Margins.Left, _pdfRptData.DocumentPreferences.PagePreferences.Margins.Right, _pdfRptData.DocumentPreferences.PagePreferences.Margins.Top, _pdfRptData.DocumentPreferences.PagePreferences.Margins.Bottom); createPdf(); PdfDoc.Dispose(); }
/// <summary> /// Workbook /// </summary> public Workbook() { Styles = new StyleCollection(); Properties = new DocumentProperties(); DocumentSettings = new DocumentSettings(); ExcelWorkbook = new ExcelWorkbook(); WorkSheets = new WorksheetCollection(); }
public DocumentsController(IHostingEnvironment host, IUnitOfWork unitOfWork, IMapper mapper, IDocumentService documentService, IOptionsSnapshot <DocumentSettings> options, IDocumentRepository documentRepository) { this.documentSettings = options.Value; this.host = host; // this.posterRepository = posterRepository; this.documentRepository = documentRepository; this.unitOfWork = unitOfWork; this.documentService = documentService; this.mapper = mapper; }
/// <summary> /// Constructory which will inject all the related dependencies related to matter /// </summary> /// <param name="search"></param> public DocumentRepository(ISearch search, IOptions <SearchSettings> searchSettings, IOptions <ListNames> listNames, ISPList spList, IOptions <CamlQueries> camlQueries, IOptions <DocumentSettings> documentSettings, IOptions <MailSettings> mailSettings) { this.search = search; this.searchSettings = searchSettings.Value; this.listNames = listNames.Value; this.spList = spList; this.camlQueries = camlQueries.Value; this.documentSettings = documentSettings.Value; this.mailSettings = mailSettings.Value; }
private async Task <Document> LoadDocumentAsync(DocumentSettings settings, Uri uri, DocumentCategory category, DocumentContextCallback contextCallback) { if (uri.IsFile) { if (!settings.AccessFlags.HasFlag(DocumentAccessFlags.EnableFileLoading)) { throw new UnauthorizedAccessException("The script engine is not configured for loading documents from the file system"); } } else { if (!settings.AccessFlags.HasFlag(DocumentAccessFlags.EnableWebLoading)) { throw new UnauthorizedAccessException("The script engine is not configured for downloading documents from the Web"); } } var cachedDocument = GetCachedDocument(uri); if (cachedDocument != null) { return(cachedDocument); } string contents; if (uri.IsFile) { using (var reader = new StreamReader(uri.LocalPath)) { contents = await reader.ReadToEndAsync().ConfigureAwait(false); } } else { using (var client = new HttpClient()) { contents = await client.GetStringAsync(uri).ConfigureAwait(false); } } var documentInfo = new DocumentInfo(uri) { Category = category, ContextCallback = contextCallback }; var callback = settings.LoadCallback; callback?.Invoke(ref documentInfo); return(CacheDocument(new StringDocument(documentInfo, contents), false)); }
/// <summary> /// Create the column list from module settings. /// </summary> /// <param name="settings">Module settings</param> /// <returns>Column list</returns> private List <Column> GetColumns(DocumentSettings settings) { List <Column> columns = new List <Column>(3); Column name = new Column { Field = "name", HeaderText = LocalizeString("HeaderName"), HeaderClass = settings.NameHeaderClass, BodyClass = settings.NameBodyClass, Filter = settings.NameFilter, FilterMatchMode = settings.NameFilterMatchMode, Sortable = settings.NameSortable, Editor = settings.FileManagement ? "input" : null }; columns.Add(name); if (settings.ShowSize) { Column size = new Column { Field = "size", HeaderText = LocalizeString("HeaderSize"), HeaderClass = settings.SizeHeaderClass, BodyClass = settings.SizeBodyClass, Filter = settings.SizeFilter, FilterMatchMode = settings.SizeFilterMatchMode, Sortable = settings.SizeSortable }; columns.Add(size); } if (settings.ShowDate) { Column modified = new Column { Field = "modified", HeaderText = LocalizeString("HeaderDate"), HeaderClass = settings.DateHeaderClass, BodyClass = settings.DateBodyClass, Filter = settings.DateFilter, FilterMatchMode = settings.DateFilterMatchMode, Sortable = settings.DateSortable }; columns.Add(modified); } return(columns); }
/// <summary> /// Controlls the functionality for email related. /// </summary> /// <param name="errorSettings"></param> /// <param name="customLogger"></param> /// <param name="matterCenterServiceFunctions"></param> /// <param name="logTables"></param> /// <param name="documentProvision"></param> /// <param name="documentSettings"></param> public EmailController(IOptions <ErrorSettings> errorSettings, ICustomLogger customLogger, IMatterCenterServiceFunctions matterCenterServiceFunctions, IOptions <LogTables> logTables, IDocumentProvision documentProvision, IOptions <DocumentSettings> documentSettings) { this.errorSettings = errorSettings.Value; this.matterCenterServiceFunctions = matterCenterServiceFunctions; this.customLogger = customLogger; this.logTables = logTables.Value; this.documentProvision = documentProvision; this.documentSettings = documentSettings.Value; }
private void runInReleaseMode() { new Document(DocumentSettings.GetPageSizeAndColor(_pdfRptData.DocumentPreferences), _pdfRptData.DocumentPreferences.PagePreferences.Margins.Left, _pdfRptData.DocumentPreferences.PagePreferences.Margins.Right, _pdfRptData.DocumentPreferences.PagePreferences.Margins.Top, _pdfRptData.DocumentPreferences.PagePreferences.Margins.Bottom) .SafeUsingBlock(pdfDisposable => { PdfDoc = pdfDisposable; createPdf(); }); }
private byte[] runInReleaseMode() { byte[] data = null; new Document(DocumentSettings.GetPageSizeAndColor(_pdfRptData.DocumentPreferences), _pdfRptData.DocumentPreferences.PagePreferences.Margins.Left, _pdfRptData.DocumentPreferences.PagePreferences.Margins.Right, _pdfRptData.DocumentPreferences.PagePreferences.Margins.Top, _pdfRptData.DocumentPreferences.PagePreferences.Margins.Bottom) .SafeUsingBlock(pdfDisposable => { PdfDoc = pdfDisposable; data = createPdf(); }); return(data); }
/// <summary> /// Constructor where all the required dependencies are injected /// </summary> /// <param name="errorSettings"></param> /// <param name="documentSettings"></param> /// <param name="spoAuthorization"></param> /// <param name="matterCenterServiceFunctions"></param> /// <param name="documentRepositoy"></param> public DocumentController(IOptions <ErrorSettings> errorSettings, IOptions <DocumentSettings> documentSettings, ISPOAuthorization spoAuthorization, IMatterCenterServiceFunctions matterCenterServiceFunctions, IDocumentRepository documentRepositoy, ICustomLogger customLogger, IOptions <LogTables> logTables ) { this.errorSettings = errorSettings.Value; this.documentSettings = documentSettings.Value; this.spoAuthorization = spoAuthorization; this.matterCenterServiceFunctions = matterCenterServiceFunctions; this.documentRepositoy = documentRepositoy; this.customLogger = customLogger; this.logTables = logTables.Value; }
public CreateDocumentCommandHandler( IDocumentRepositoryAsync documentRepository, IDocumentTypeRepositoryAsync documentTypeRepository, IDocumentTagRepositoryAsync documentTagRepository, IAuthenticatedUserService authenticatedUser, IMapper mapper, ICryptographyService cryptographyService, IOptions <DocumentSettings> documentSettings) { _documentRepository = documentRepository; _documentTypeRepository = documentTypeRepository; _documentTagRepository = documentTagRepository; _authenticatedUser = authenticatedUser; _mapper = mapper; _cryptographyService = cryptographyService; _settings = documentSettings.Value; }
private static IEnumerable <Uri> GetRawUris(DocumentSettings settings, DocumentInfo?sourceInfo, string specifier) { Uri baseUri; Uri uri; if (sourceInfo.HasValue && SpecifierMayBeRelative(settings, specifier)) { baseUri = GetBaseUri(sourceInfo.Value); if ((baseUri != null) && Uri.TryCreate(baseUri, specifier, out uri)) { yield return(uri); } } var searchPath = settings.SearchPath; if (!string.IsNullOrWhiteSpace(searchPath)) { foreach (var url in searchPath.SplitSearchPath()) { if (Uri.TryCreate(url, UriKind.Absolute, out baseUri) && TryCombineSearchUri(baseUri, specifier, out uri)) { yield return(uri); } } } if (MiscHelpers.Try(out var path, () => Path.Combine(Directory.GetCurrentDirectory(), specifier)) && Uri.TryCreate(path, UriKind.Absolute, out uri)) { yield return(uri); } if (MiscHelpers.Try(out path, () => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, specifier)) && Uri.TryCreate(path, UriKind.Absolute, out uri)) { yield return(uri); } using (var process = Process.GetCurrentProcess()) { var module = process.MainModule; if ((module != null) && Uri.TryCreate(module.FileName, UriKind.Absolute, out baseUri) && Uri.TryCreate(baseUri, specifier, out uri)) { yield return(uri); } } }
/// <summary> /// DcouemtsController Constructor where all the required dependencies are injected /// </summary> /// <remarks></remarks> /// /// <param name="errorSettings"></param> /// <param name="documentSettings"></param> /// <param name="matterCenterServiceFunctions"></param> /// <param name="documentRepositoy"></param> /// <param name="customLogger"></param> /// <param name="logTables"></param> /// <param name="documentProvision"></param> /// <param name="generalSettings"></param> public DocumentController(IOptions <ErrorSettings> errorSettings, IOptions <DocumentSettings> documentSettings, IMatterCenterServiceFunctions matterCenterServiceFunctions, IDocumentRepository documentRepositoy, ICustomLogger customLogger, IOptions <LogTables> logTables, IDocumentProvision documentProvision, IOptions <GeneralSettings> generalSettings ) { this.errorSettings = errorSettings.Value; this.documentSettings = documentSettings.Value; this.matterCenterServiceFunctions = matterCenterServiceFunctions; this.documentRepositoy = documentRepositoy; this.customLogger = customLogger; this.logTables = logTables.Value; this.documentProvision = documentProvision; this.generalSettings = generalSettings.Value; }
private ReportDocumentParser(ILogger <ReportDocumentParser> logger, string textBlock, DocumentSettings configuration) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); if (string.IsNullOrEmpty(textBlock)) { throw new ArgumentNullException(nameof(textBlock)); } TextBlock = textBlock; _entityType = _configuration.DataEntity; _entity = (IReportDocument)Activator.CreateInstance(_entityType); if (_configuration.DataProcessor != null) { _entity.DataProcessor = (IDataProcessor)Activator.CreateInstance(configuration.DataProcessor); } _entity.OriginalDocument = textBlock; }
internal static void Main(string[] args) { var settings = new DocumentSettings() { UseVariables = true }; foreach (Record record in Document.ReadRecords(@"..\..\Test.xml", settings)) { WriteLine(record.EntityName); #if DEBUG Indent(); foreach (KeyValuePair <string, object> pair in record.GetProperties()) { if (pair.Value is List <object> list) { WriteLine($"[{pair.Key}]"); Indent(); foreach (object item in list) { WriteLine(item); } Unindent(); } else { WriteLine($"[{pair.Key}] {pair.Value}"); } } Unindent(); #endif Console.WriteLine(""); } Console.WriteLine("** DONE ***"); Console.ReadKey(); }