Beispiel #1
0
        /// <summary>
        /// Gets fileinfo
        /// </summary>
        /// <param name="filenameBase">Filename base - automatically trims any existing extension</param>
        /// <param name="dir">directorium to put file into</param>
        /// <param name="format">Targeted output format</param>
        /// <returns></returns>
        public FileInfo getFileInfo(String filenameBase, DirectoryInfo dir, reportOutputFormatName format = reportOutputFormatName.none, getWritableFileMode mode = getWritableFileMode.autoRenameExistingOnOtherDate)
        {
            //String filename = getFilename(filenameBase, format);
            String filepath = getFilename(filenameBase, dir, format);

            return(filepath.getWritableFile(mode)); //new FileInfo(filepath);
        }
Beispiel #2
0
        /// <summary>
        /// Makes filename from <c>filenameBase</c> according to specified <c>format</c>.
        /// </summary>
        /// <param name="filenameBase">Filename base - automatically trims any existing extension</param>
        /// <param name="dir">directorium to put file into</param>
        /// <param name="format">Targeted output format</param>
        /// <returns>
        /// filename with proper extension
        /// </returns>
        /// <exception cref="System.ArgumentOutOfRangeException">format</exception>
        /// <remarks>
        /// If <c>format</c> is not supported throws <see cref="ArgumentOutOfRangeException" />. For <c>none</c> returns default
        /// </remarks>
        public String getFilename(String filenameBase, DirectoryInfo dir, reportOutputFormatName format = reportOutputFormatName.none)
        {
            String filename = getFilename(filenameBase, format);
            String filepath = Path.Combine(dir.FullName, filename);

            return(filepath);
        }
Beispiel #3
0
        /// <summary>
        /// Makes filename from <c>filenameBase</c> according to specified <c>format</c>.
        /// </summary>
        /// <remarks>If <c>format</c> is not supported throws <see cref="ArgumentOutOfRangeException"/>. For <c>none</c> returns default</remarks>
        /// <param name="filenameBase">Filename base - automatically trims any existing extension</param>
        /// <param name="format">Targeted output format</param>
        /// <returns>filename with proper extension</returns>
        /// <exception cref="System.ArgumentOutOfRangeException">format</exception>
        public String getFilename(String filenameBase, reportOutputFormatName format = reportOutputFormatName.none)
        {
            String dir = Path.GetDirectoryName(filenameBase);

            if (format == reportOutputFormatName.none)
            {
                format = defaultFormat;
            }
            if (format == reportOutputFormatName.unknown)
            {
                format = defaultFormat;
            }

            if (!supported.Contains(format))
            {
                String exmsg = String.Format("Supplied output format is not supported: format {0}, supported formats {1}", format.ToString(), supported.toCsvInLine(";"));
                throw new ArgumentOutOfRangeException("format", this, exmsg);
            }

            filenameBase = Path.GetFileNameWithoutExtension(filenameBase);

            String output = filenameBase;

            throw new NotImplementedException("Format resolve not implemented yet");
            // output = imbSciStringExtensions.add(output, format.getDefaultExtension(), ".");
            if (!imbSciStringExtensions.isNullOrEmptyString(dir))
            {
                output = imbSciStringExtensions.add(dir, output, "\\");
            }

            return(output);
        }
 public reportOutputUnit(string __path, string __name, reportOutputFormatName __format, reportOutputForm __form, object __output, reportElementLevel __level)
 {
     path       = __path;
     name       = __name;
     fileformat = __format;
     form       = __form;
     // builder = __builder;
     output = __output;
     level  = __level;
 }
Beispiel #5
0
        public override string ContentToString(bool doFlush = false, reportOutputFormatName format = reportOutputFormatName.none)
        {
            String markdown   = base.ContentToString(doFlush);
            String str_output = markdown;

            //if (format == reportOutputFormatName.htmlViaMD)
            //{
            //    str_output = str_output.markdigMD2HTML();
            //}
            return(str_output);
        }
        /// <summary>
        /// prepares builder to support format
        /// </summary>
        /// <param name="targetFormat">The target format.</param>
        /// <returns></returns>
        public bool setForFormat(reportOutputFormatName targetFormat)
        {
            bool formatChanged = false;

            if (builder.format != targetFormat)
            {
                formatChanged = true;
                builder.setActiveOutputFormat(targetFormat);
                OnPropertyChanged("render");
            }
            return(formatChanged);
        }
        public FileInfo getFileInfo(string basename, getWritableFileMode mode, reportOutputFormatName format)
        {
            if (format == reportOutputFormatName.none)
            {
                format = builder.format;
            }

            string output = formats.getFilename(basename, format);

            output = directoryScope.FullName.add(output, "\\");

            FileInfo fi = output.getWritableFile(mode);

            return(fi);
        }
Beispiel #8
0
        public static externalTool getDefaultApplication(this reportOutputFormatName outputFormat)
        {
            switch (outputFormat)
            {
            case reportOutputFormatName.htmlReport:
                return(externalTool.firefox);

                break;

            default:
                return(externalTool.notepadpp);

                break;
            }
        }
        public deliveryUnitItemSimpleRenderOutput(ITextRender __builder, reportOutputFormatName __format, IEnumerable <reportElementLevel> __newDirectoryLevels) : base(deliveryUnitItemType.content)
        {
            name     = __builder.GetType().Name.add(__format.ToString(), "-");
            location = deliveryUnitItemLocationBase.unknown;
            flags    = deliveryUnitItemFlags.none;

            outputRender = __builder;

            format = __format;

            levelsOfNewDirectory.AddRange(__newDirectoryLevels);

            //builder = new builderSelector();
            //builder.Add(__builder, __format);
            //builder.setActiveOutputFormat(__format);
        }
Beispiel #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="deliveryUnitItemContentTemplated" /> class.
        /// </summary>
        /// <param name="__sourcepath">The sourcepath.</param>
        /// <param name="__sourceRender">The source render.</param>
        /// <param name="__format">The format.</param>
        public deliveryUnitItemContentTemplated(string __sourcepath, deliveryUnitItemSimpleRenderOutput __sourceRender, reportOutputFormatName __format, IEnumerable <reportElementLevel> __levels) : base(deliveryUnitItemType.contentTemplate)
        {
            location = deliveryUnitItemLocationBase.localResource;
            flags    = deliveryUnitItemFlags.useTemplate;
            //useTemplate = true;

            sourceRender = __sourceRender;
            //format.Add(__formats.getFlatList<reportOutputFormatName>());
            levelsOfNewDirectory.AddRange(__levels);

            format = __format;

            sourcepath.setup("".t(templateFieldDeliveryUnit.del_themepath).add(__sourcepath, "\\"));

            string opath2 = "".t(templateFieldBasic.path_here);

            outputpath.setup(opath2);
        }
Beispiel #11
0
        public override PropertyCollection getContentBlocks(bool includeMain, reportOutputFormatName format = reportOutputFormatName.none)
        {
            PropertyCollection pc = sbControler.getDataset(includeMain);

            PropertyCollection pc_out = new PropertyCollection();

            foreach (Object key in pc.Keys)
            {
                String str_block = pc[key].toStringSafe();
                //if (format == reportOutputFormatName.htmlViaMD)
                //{
                //    str_block = str_block.markdigMD2HTML();
                //}
                pc_out.Add(key, str_block);

                //  String str_key = key.ToString() + "_md";

                // pc_out.Add(str_key, pc[key].toStringSafe());
            }
            return(pc_out);
        }
        public reportOutputFormatTags(reportOutputFormatName format = reportOutputFormatName.none)
        {
            if (format == reportOutputFormatName.none)
            {
                format = reportOutputFormatName.htmlReport;                                        //imbCoreApplicationSettings.ReportReportFormat;
            }
            switch (format)
            {
            case reportOutputFormatName.textFile:

                break;

            case reportOutputFormatName.htmlReport:
                headTag       = htmlTagName.h3;
                lineTag       = htmlTagName.p;
                inlineTag     = htmlTagName.span;
                inlineBoldTag = htmlTagName.span;
                preTag        = htmlTagName.pre;
                divTag        = htmlTagName.div;
                break;
            }
        }
Beispiel #13
0
        public override FileInfo saveDocument(string name, getWritableFileMode mode, reportOutputFormatName format = reportOutputFormatName.none)
        {
            if (format == reportOutputFormatName.none)
            {
                format = reportOutputFormatName.textMdFile;
            }

            String str_output = ContentToString(false, format);

            String filename = name;

            if (!Path.HasExtension(name))
            {
                filename = formats.getFilename(name, format);
            }
            FileInfo fi = filename.getWritableFile(getWritableFileMode.newOrExisting);

            return(str_output.saveStringToFile(fi.FullName, getWritableFileMode.overwrite, System.Text.Encoding.UTF8));

            //if (format == reportOutputFormatName.htmlViaMD)
            //{
            //    FileInfo fi = filename.getWritableFile(getWritableFileMode.newOrExisting);
            //    getLastLine();

            //    //String markdown =  //contentElements.ToDelimitedString(Environment.NewLine);
            //    String html = markdown.markdigMD2HTML();

            //    saveBase.saveToFile(fi.FullName, html);
            //    return fi;

            //}
            //else
            //{
            //    return base.saveDocument(name, mode, format);
            //}
        }
Beispiel #14
0
 /// <summary>
 /// Saves the current document, returns <c>FileInfo</c> pointing to it
 /// </summary>
 /// <param name="name">The name without extension</param>
 /// <param name="mode">Existing file mode</param>
 /// <returns>File info pointing to</returns>
 /// \ingroup_disabled renderapi_service
 public abstract FileInfo saveDocument(String name, getWritableFileMode mode, reportOutputFormatName format = reportOutputFormatName.none);
Beispiel #15
0
 /// <summary>
 /// Adds new page, drives cursor to upper-left corner
 /// </summary>
 /// <param name="name">The name of newly created page.</param>
 /// <param name="mode">In case page with the same name already exists</param>
 /// <returns>Page object - usually not directly used</returns>
 /// \ingroup_disabled renderapi_service
 public abstract TPage addPage(String name, Boolean scopeToNew = true, getWritableFileMode mode = getWritableFileMode.autoRenameThis, reportOutputFormatName format = reportOutputFormatName.none);
Beispiel #16
0
 /// <summary>
 /// Loads the document from filepath into internal object of TDoc type as current document
 /// </summary>
 /// <param name="filepath">The filepath.</param>
 /// <returns>FileInfo pointing to the loaded document</returns>
 /// \ingroup_disabled renderapi_service
 public abstract FileInfo loadDocument(String filepath, String name = "", reportOutputFormatName format = reportOutputFormatName.none);
Beispiel #17
0
 /// <summary>
 /// Creates new document both in filesytem and internal memory. Location for new file is current directory.
 /// </summary>
 /// <param name="name">Name of new document. It will transform it to filename version and add proper file extension. No problem if you put extension alone.</param>
 /// <param name="mode">How any existing file should be handled</param>
 /// <returns>Newly created document</returns>
 /// \ingroup_disabled renderapi_service
 public abstract Object addDocument(String name, Boolean scopeToNew = true, getWritableFileMode mode = getWritableFileMode.autoRenameExistingOnOtherDate, reportOutputFormatName format = reportOutputFormatName.none);
        public static string GetOutputPath(this IMetaContentNested scoped, deliveryInstance context, reportOutputFormatName format, List <reportElementLevel> levels, bool makeAppApsolut = true)
        {
            string filename = ""; // context.data.getProperString("", templateFieldBasic.path_file);

            if (scoped == null)
            {
            }
            string filename_withExtension = scoped.name.add(format.getDefaultExtension(), ".");

            filename = context.GetDirectoryPath(scoped, levels, makeAppApsolut).add(filename_withExtension, "\\");
            //   Console.WriteLine("file: [" + filename + "]");
            return(filename);
        }
        /// <summary>
        /// Gets the link collection
        /// </summary>
        /// <param name="scoped">The scoped.</param>
        /// <param name="context">The context.</param>
        /// <param name="format">The format.</param>
        /// <param name="levels">The levels.</param>
        /// <param name="makeAppApsolut">if set to <c>true</c> [make application apsolut].</param>
        /// <returns></returns>
        public static reportLinkCollectionSet GetLinkCollection(this IMetaContentNested scoped, deliveryInstance context, reportOutputFormatName format, List <reportElementLevel> levels, bool makeAppApsolut = true)
        {
            reportLinkCollectionSet menu  = new reportLinkCollectionSet();
            reportElementLevel      level = scoped.getElementLevel();

            IMetaContentNested linkFrom = scoped;

            switch (level)
            {
            case reportElementLevel.document:

            //metaDocument document = (metaDocument)linkFrom;
            //menu.Add(document.documentTitle, document.GetLinkCollection(context, format));
            //break;
            case reportElementLevel.page:
                linkFrom = scoped.document;

                if (linkFrom != null)
                {
                    metaDocument document2 = (metaDocument)linkFrom;
                    menu.Add(document2.documentTitle, document2.GetLinkCollection(context, format, levels, makeAppApsolut));
                }
                else
                {
                    if (scoped.parent != null)
                    {
                        return(GetLinkCollection(scoped.parent, context, format, levels, makeAppApsolut));
                    }
                }

                break;

            case reportElementLevel.documentSet:

                metaDocumentSet documentSet = (metaDocumentSet)linkFrom;

                menu.AddInGroup(documentSet.documentSetTitle, documentSet.GetServicePageLinkCollection(context, format, levels, makeAppApsolut));

                menu.AddInGroup(documentSet.documentSetTitle, documentSet.GetDocumentSetsLinkCollection(context, format, levels, makeAppApsolut));
                menu.currentItem.GetMainGroup().name = "Report sections";

                foreach (metaDocument docum in linkFrom)
                {
                    menu.Add(docum.documentTitle, docum.GetLinkCollection(context, format, levels, makeAppApsolut));
                }
                break;
            }

            return(menu);
        }
Beispiel #20
0
 public reportElementFormSet(reportOutputForm __form, reportOutputFormatName __format, String __nametemplate = "{{{name}}}")
 {
     form         = __form;
     nametemplate = __nametemplate;
     fileformat   = __format;
 }
        /// <summary>
        /// Gets the out file path using template
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="content">The content.</param>
        /// <param name="pc">The pc.</param>
        /// <param name="format">The format.</param>
        /// <param name="dir">The dir.</param>
        /// <returns></returns>
        public string getOutFilePath(IRenderExecutionContext context, IMetaContentNested content, PropertyCollection pc, reportOutputFormatName format = reportOutputFormatName.none, DirectoryInfo dir = null)
        {
            if (pc == null)
            {
                pc = new PropertyCollection();
            }

            if (content == null)
            {
                content = context.scope as IMetaContentNested;
            }
            if (dir == null)
            {
                dir = context.directoryScope;
            }

            if (format == reportOutputFormatName.none)
            {
                if (!pc.ContainsKey("ext"))
                {
                    pc.Add("ext", "");
                }
                else
                {
                    pc["ext"] = "txt";
                }
            }
            else
            {
                if (!pc.ContainsKey("ext"))
                {
                    pc.Add("ext", format.getFilenameExtension());
                }
                else
                {
                    pc["ext"] = format.getFilenameExtension();
                }
            }
            if (content != null)
            {
                if (!pc.ContainsKey("name"))
                {
                    pc.Add("name", content.name.getFilename());
                }
                else
                {
                    pc["name"] = content.name.getFilename();
                }
                //pc.Add("name", content.name);
            }

            string path = filenameTemplate.applyToContent(false, pc);

            if (outputpath != null)
            {
                if (!outputpath.directoryPath.isNullOrEmpty())
                {
                    path = outputpath.directoryPath.add(path, "\\");
                }
            }

            path = dir.FullName.add(path, "\\");

            return(path);
        }
 public object addDocument(string name, bool scopeToNew = true, getWritableFileMode mode = getWritableFileMode.autoRenameExistingOnOtherDate, reportOutputFormatName format = reportOutputFormatName.none)
 {
     throw new NotImplementedException();
 }
 public object addPage(string name, bool scopeToNew = true, getWritableFileMode mode = getWritableFileMode.autoRenameThis, reportOutputFormatName format = reportOutputFormatName.none)
 {
     throw new NotImplementedException();
 }
 public FileInfo savePage(string name, reportOutputFormatName format = reportOutputFormatName.none)
 {
     throw new NotImplementedException();
 }
        /// <summary>
        /// Gets the filename extension for <c>format</c>. String is without starting dot.
        /// </summary>
        /// <param name="format">The format.</param>
        /// <returns></returns>
        public static String getFilenameExtension(this reportOutputFormatName format)
        {
            String extension = "bin";

            switch (format)
            {
            case reportOutputFormatName.sheetPDF:
            case reportOutputFormatName.docPDF:
                extension = "pdf";
                break;

            case reportOutputFormatName.sheetCsv:
            case reportOutputFormatName.csv:
                extension = "csv";
                break;

            case reportOutputFormatName.sheetExcel:
            case reportOutputFormatName.Excel:

                extension = "xlsx";

                break;

            case reportOutputFormatName.folderReadme:
            case reportOutputFormatName.textMdFile:
            case reportOutputFormatName.markdown:
                extension = "md";

                break;

            case reportOutputFormatName.textLog:
                extension = "log";
                break;

            case reportOutputFormatName.emailPlainText:
            case reportOutputFormatName.unknown:
            case reportOutputFormatName.textFile:
                extension = "txt";
                break;

            case reportOutputFormatName.sheetXML:
            case reportOutputFormatName.textXml:
            case reportOutputFormatName.serXml:
            case reportOutputFormatName.xml:
                extension = "xml";
                break;

            case reportOutputFormatName.sheetHtml:
            case reportOutputFormatName.textHtml:
            case reportOutputFormatName.emailHTML:
            case reportOutputFormatName.docHTML:
            case reportOutputFormatName.htmlViaMD:
            case reportOutputFormatName.htmlReport:
                extension = "html";
                break;

            case reportOutputFormatName.docRTF:
                extension = "rtf";
                break;

            case reportOutputFormatName.docJPG:
                extension = "jpg";
                break;

            case reportOutputFormatName.docTIFF:
                extension = "tiff";
                break;

            case reportOutputFormatName.docPNG:
                extension = "png";
                break;

            case reportOutputFormatName.rdf:
                extension = "rdf";
                break;

            case reportOutputFormatName.owl:
                extension = "owl";
                break;

            case reportOutputFormatName.json:
                extension = "json";
                break;

            case reportOutputFormatName.Writter:
                extension = "odt";
                break;

            case reportOutputFormatName.Calc:
                extension = "ods";
                break;

            case reportOutputFormatName.textCss:
                extension = "css";
                break;

            case reportOutputFormatName.docXAML:
                extension = "xaml";
                break;

            case reportOutputFormatName.Word:
                extension = "docx";
                break;

            case reportOutputFormatName.none:
                extension = "";
                break;

            default:

                extension = format.ToString();
                if (extension.StartsWith("text"))
                {
                    extension = "txt";
                }
                else if (extension.EndsWith("log"))
                {
                    extension = "log";
                }
                else
                {
                    throw new ArgumentOutOfRangeException("format", "Extension not defined yet -> aceCommonTypes.extensions.imbEnumConverterExtensions.getFilenameExtension(this reportOutputFormatName format)");
                }

                break;
            }

            return(extension);
        }
Beispiel #26
0
 public FileInfo savePage(string name, reportOutputFormatName format = reportOutputFormatName.none)
 {
     return(saveDocument(name, getWritableFileMode.autoRenameExistingOnOtherDate, format));
 }
Beispiel #27
0
 /// <summary>
 /// Saves the document containing this page.
 /// </summary>
 /// <returns></returns>
 /// \ingroup_disabled renderapi_service
 public abstract FileInfo savePage(String name, reportOutputFormatName format = reportOutputFormatName.none);
Beispiel #28
0
 public object addPage(string name, bool scopeToNew = true, getWritableFileMode mode = getWritableFileMode.autoRenameThis, reportOutputFormatName format = reportOutputFormatName.none)
 {
     return(saveDocument(name, mode, format));
 }
Beispiel #29
0
#pragma warning disable CS1066 // The default value specified for parameter 'format' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments
        /// <summary>
        /// Adds new page, drives cursor to upper-left corner
        /// </summary>
        /// <param name="name">The name of newly created page.</param>
        /// <param name="scopeToNew"></param>
        /// <param name="mode">In case page with the same name already exists</param>
        /// <returns>
        /// Page object - usually not directly used
        /// </returns>
        /// \ingroup_disabled renderapi_service
        object ITextRender.addPage(string name, bool scopeToNew, getWritableFileMode mode, reportOutputFormatName format = reportOutputFormatName.none)
#pragma warning restore CS1066 // The default value specified for parameter 'format' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments
        {
            return(addPage(name, scopeToNew, mode));
        }
 /// <summary>
 /// Alias of <see cref="getFilenameExtension(reportOutputFormatName)"/>
 /// </summary>
 /// <param name="outputFormat"></param>
 /// <returns></returns>
 public static String getDefaultExtension(this reportOutputFormatName outputFormat)
 {
     return(outputFormat.getFilenameExtension());
 }