Exemplo n.º 1
0
 /// <summary>
 /// Files the processing.
 /// </summary>
 /// <param name="fileFullName">Full name of the file.</param>
 void IReplacerObserver.FileProcessing(string fileFullName)
 {
     this.fileProcessingStartTime = DateTime.Now;
     this.processingMessage = new LogMessage();
     this.processingMessage.FileName = fileFullName;
     this.processingMessage.Message =
         string.Format("Processing file: {0}",
                       fileFullName);
     this.AddMessage(this.processingMessage);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Files the processed.
 /// </summary>
 /// <param name="fileFullName">Full name of the file.</param>
 /// <param name="sourceText">The source text.</param>
 /// <param name="resultText">The result text.</param>
 /// <returns>Whether file should be saved</returns>
 bool IReplacerObserver.FileProcessed(string fileFullName, string sourceText, string resultText)
 {
     DateTime time = DateTime.Now;
     TimeSpan timeTaken = time - this.fileProcessingStartTime;
     this.processingMessage.TimeStamp = time;
     this.processingMessage.Message =
         string.Format("File processed in {0:hh\\:mm\\:ss\\.fff} : {1}",
                       timeTaken,
                       fileFullName);
     this.processingMessage = null;
     return !string.Equals(sourceText, resultText, StringComparison.Ordinal);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Receives the log message.
 /// </summary>
 /// <param name="message">The message.</param>
 void IReplacerObserver.ReceiveLogMessage(LogMessage message)
 {
     this.Log(message);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Logs the specified message.
 /// </summary>
 /// <param name="message">The message.</param>
 private void Log(LogMessage message)
 {
     if (this.logToConsole)
         System.Console.WriteLine(message);
     if (this.logFile != null)
     {
         this.logFile.WriteLine(message.ToString());
         this.logFile.Flush();
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Adds the message core.
 /// </summary>
 /// <param name="message">The message.</param>
 private void AddMessageCore(LogMessage message)
 {
     this.messageList.Add(message);
     if (this.listMessages.Rows.Count > 0 && (this.listMessages.FirstDisplayedScrollingRowIndex + this.listMessages.DisplayedRowCount(true)) >= this.listMessages.Rows.Count - 1)
     {
         this.listMessages.ClearSelection();
         this.listMessages.Rows[this.listMessages.Rows.Count - 1].Selected = true;
         this.listMessages.FirstDisplayedScrollingRowIndex = this.listMessages.Rows.Count - 1;
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Adds the message.
 /// </summary>
 /// <param name="message">The message.</param>
 private void AddMessage(LogMessage message)
 {
     ISynchronizeInvoke sync = this;
     if (sync.InvokeRequired)
     {
         Action<LogMessage> action = this.AddMessageCore;
         sync.Invoke(action, new object[]{message});
     }
     else
     {
         this.AddMessageCore(message);
     }
 }