Exemple #1
0
        public void Reload(string contents, DateTime lastModified)
        {
            lock (readWriteLock)
            {
                try
                {
                    isBusy = true;

                    this.Contents     = contents;
                    this.LastModified = lastModified;

                    initException    = null;
                    exprSeq          = 0;
                    timesRun         = 0;
                    ExecutionContext = new EvaluatorExecutionContext();
                    Compile(force: true);
                }
                catch (Exception ex)
                {
                    initException = ex;
                }
                isBusy = false;
                Monitor.PulseAll(readWriteLock);
            }
        }
Exemple #2
0
        public void Reload()
        {
            var fi           = new FileInfo(this.FilePath);
            var lastModified = fi.LastWriteTime;
            var contents     = File.ReadAllText(this.FilePath);

            lock (readWriteLock)
            {
                try
                {
                    isBusy = true;

                    this.Contents = contents;
                    foreach (var markdownReplaceToken in Markdown.MarkdownReplaceTokens)
                    {
                        this.Contents = this.Contents.Replace(markdownReplaceToken.Key, markdownReplaceToken.Value);
                    }

                    this.LastModified = lastModified;
                    initException     = null;
                    exprSeq           = 0;
                    timesRun          = 0;
                    ExecutionContext  = new EvaluatorExecutionContext();
                    Prepare();
                }
                catch (Exception ex)
                {
                    initException = ex;
                }
                isBusy = false;
                Monitor.PulseAll(readWriteLock);
            }
        }