コード例 #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>
        /// After document was parsed, now it's time for charts, processed concurrent with presentation
        /// </summary>
        /// <param name="path">Source document path</param>
        /// <param name="worker">Background Worker</param>
        /// <param name="document">Current KineSis Document</param>
        public static void CreateNewDocumentCharts(String path, BackgroundWorker worker, Document document)
        {
            FileInfo file = new FileInfo(path);

            DocumentHelper helper = GetHelperForDocument(path);

            if (helper != null)
            {
                ProcessingProgress pp = new ProcessingProgress(worker);
                try
                {
                    if (helper is PowerPointDocumentHelper)
                    {
                        PowerPointDocumentHelper h = (PowerPointDocumentHelper)helper;
                        h.ParseNewDocumentCharts(path, pp, document);
                    }
                    else if (helper is ExcelDocumentHelper)
                    {
                        ExcelDocumentHelper h = (ExcelDocumentHelper)helper;
                        h.ParseNewDocumentCharts(path, pp, document);
                    }
                    else if (helper is WordDocumentHelper)
                    {
                        WordDocumentHelper h = (WordDocumentHelper)helper;
                        h.ParseNewDocumentCharts(path, pp, document);
                    }
                }
                catch (Exception ex)
                {
                    pp.OverallOperationName = "[Exception] " + ex.Message;
                    //    pp.OverallOperationTotalElements = 1;
                    //    MessageBox.Show(ex.Message);
                }

                Document.serialize(document, TEMP_DIRECTORY + "\\" + document.Location + ".xml");

                ProfileManager.AddDocumentToActive(document.Name, document.Location);
                ProfileManager.Serialize();
            }
        }
コード例 #3
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;
        }