예제 #1
0
        /// <summary>
        /// Adds the document indicated by the specified path string to the project
        /// </summary>
        /// <param name="path">The path string of the document file to add to the project</param>
        ///
        /// <returns>An InputFile object which acts as a wrapper around the project relative path of the newly added file.</returns>
        public static InputFile AddFile(string path)
        {
            ThrowIfUninitialized();
            var extension = Path.GetExtension(path).ToLower();

            try
            {
                var originalFile = WrapperMap[extension](path);
                var newPath      =
                    extension == ".doc" ? DocFilesDirectory :
                    extension == ".docx" ? DocxFilesDirectory :
                    extension == ".txt" ? TxtFilesDirectory :
                    extension == ".pdf" ? PdfFilesDirectory :
                    extension == ".tagged" ? TaggedFilesDirectory : string.Empty;

                newPath += "\\" + originalFile.FileName;

                File.Copy(originalFile.FullPath, newPath, overwrite: true);
                var newFile = WrapperMap[extension](newPath);

                AddToTypedList(newFile as dynamic);
                return(newFile);
            }
            catch (UnsupportedFileTypeException e)
            {
                throw new UnsupportedFileTypeException(extension, e);
            }
        }
예제 #2
0
 /// <summary>
 /// Private constructor to prevent object creation
 /// </summary>
 public JLogManager()
 {
     log4net.Config.XmlConfigurator.Configure();
     s_wrapperMap = new WrapperMap(new WrapperCreationHandler(WrapperCreationHandler));
 }
예제 #3
0
 // Methods
 static MFAppLoggerManager()
 {
     s_wrapperMap = new WrapperMap(new WrapperCreationHandler(MFAppLoggerManager.WrapperCreationHandler));
 }