コード例 #1
0
ファイル: DocumentService.cs プロジェクト: sidhub1/kinesis
        /// <summary>
        /// Get helper for processing a document, based on document extension
        /// </summary>
        /// <param name="path">Source document full path</param>
        /// <returns></returns>
        private static DocumentHelper GetHelperForDocument(String path)
        {
            DocumentHelper helper = null;
            FileInfo       fi     = new FileInfo(path);
            String         ext    = fi.Extension.Substring(1).ToLower();

            if (ext.Equals("docx"))
            {
                helper = new WordDocumentHelper();
            }
            else if (ext.Equals("xlsx"))
            {
                helper = new ExcelDocumentHelper();
            }
            else if (ext.Equals("pptx"))
            {
                helper = new PowerPointDocumentHelper();
            }
            else if (ext.Equals("jpeg") || ext.Equals("jpg") || ext.Equals("png") || ext.Equals("bmp") || ext.Equals("gif") || ext.Equals("tiff"))
            {
                helper = new PictureDocumentHelper();
            }
            else
            {
                if (TextHighlightConfiguration.GetTextHighlightForTextFile(path) != null)
                {
                    helper = new TextDocumentHelper();
                }
            }
            return(helper);
        }
コード例 #2
0
ファイル: DocumentService.cs プロジェクト: sidhub1/kinesis
        /// <summary>
        /// Get helper for processing a document, based on document extension
        /// </summary>
        /// <param name="path">Source document full path</param>
        /// <returns></returns>
        private static DocumentHelper GetHelperForDocument(String path)
        {
            DocumentHelper helper = null;
            FileInfo fi = new FileInfo(path);
            String ext = fi.Extension.Substring(1).ToLower();

            if (ext.Equals("docx"))
            {
                helper = new WordDocumentHelper();
            }
            else if (ext.Equals("xlsx"))
            {
                helper = new ExcelDocumentHelper();
            }
            else if (ext.Equals("pptx"))
            {
                helper = new PowerPointDocumentHelper();
            }
            else if (ext.Equals("jpeg") || ext.Equals("jpg") || ext.Equals("png") || ext.Equals("bmp") || ext.Equals("gif") || ext.Equals("tiff"))
            {
                helper = new PictureDocumentHelper();
            }
            else
            {
                if (TextHighlightConfiguration.GetTextHighlightForTextFile(path) != null)
                {
                    helper = new TextDocumentHelper();
                }
            }
            return helper;
        }