public ProcessedDocumentCacheElement(string path, Preprocessor preprocessor, ProcessedDocumentCache cache)
            {
                this.path = path;
                this.preprocessor = preprocessor;
                this.cache = cache;

                Reload();
                
                watcher = new FileWatcher(path);
                watcher.Changed += (sender, args) => Reload();
            }
        public PreprocessedData(EMDocument document, ProcessedDocumentCache manager)
        {
            Excerpts = new ExcerptsManager(this);
            Variables = new VariableManager(this);
            Metadata = new MetadataManager(this);
            ReferenceLinks = new ReferenceLinksManager(this);
            TextMap = new PreprocessedTextLocationMap();
            PreprocessedTextBounds = new List<PreprocessedTextBound>();

            Document = document;

            this.manager = manager;
        }
        public TransformationData(Markdown markdown, List<ErrorDetail> errorList, List<ImageConversion> imageDetails,
            List<AttachmentConversionDetail> attachNames, FolderDetails currentFolderDetails, IEnumerable<string> languagesLinksToGenerate = null, bool nonDynamicHTMLOutput = false)
        {
            NonDynamicHTMLOutput = nonDynamicHTMLOutput;
            AttachNames = attachNames;
            CurrentFolderDetails = new FolderDetails(currentFolderDetails);
            ErrorList = errorList;
            ImageDetails = imageDetails;
            LanguagesLinksToGenerate = languagesLinksToGenerate ?? markdown.SupportedLanguages;

            HtmlBlocks = new Dictionary<string, string>();
            FoundDoxygenSymbols = new HashSet<string>();
            Markdown = markdown;

            processedDocumentCache = new ProcessedDocumentCache(currentFolderDetails.GetThisFileName(), this);
        }
        public static EMExcerpt Get(
            ProcessedDocumentCache manager, string folderPath, string lang, string excerptName, out bool languageChanged)
        {
            var folder = new DirectoryInfo(folderPath);

            if (!folder.Exists)
            {
                throw new ExcerptFolderNotFoundException(folder.FullName);
            }

            FileInfo chosenFile;
            languageChanged = false;

            if (lang.ToLower() != "int")
            {
                var languageFileInfo = folder.GetFiles("*." + lang + ".udn");

                if (languageFileInfo.Length == 0)
                {
                    var intFileInfo = folder.GetFiles("*.INT.udn");

                    if (intFileInfo.Length == 0)
                    {
                        throw new ExcerptLocFileNotFoundException(Path.Combine(folder.FullName, "*." + lang + ".udn"));
                    }

                    languageChanged = true;
                    chosenFile = intFileInfo[0];
                }
                else
                {
                    chosenFile = languageFileInfo[0];
                }
            }
            else
            {
                var intFileInfo = folder.GetFiles("*.INT.udn");

                if (intFileInfo.Length == 0)
                {
                    throw new ExcerptFileNotFoundException(Path.Combine(folder.FullName, "*.INT.udn"));
                }

                chosenFile = intFileInfo[0];
            }

            return manager.Get(chosenFile.FullName).Excerpts.GetExcerpt(excerptName);
        }
        protected virtual void Dispose(bool disposing)
        {
            if (disposed || !disposing)
            {
                return;
            }

            ProcessedDocumentCache.Dispose();
            processedDocumentCache = null;

            disposed = true;
        }