コード例 #1
0
ファイル: ProcessingForm.cs プロジェクト: sstundzia/replacer
 /// <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);
 }
コード例 #2
0
ファイル: ProcessingForm.cs プロジェクト: sstundzia/replacer
 /// <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);
 }
コード例 #3
0
 /// <summary>
 /// Receives the log message.
 /// </summary>
 /// <param name="message">The message.</param>
 void IReplacerObserver.ReceiveLogMessage(LogMessage message)
 {
     this.Log(message);
 }
コード例 #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();
     }
 }
コード例 #5
0
ファイル: ProcessingForm.cs プロジェクト: sstundzia/replacer
 /// <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;
     }
 }
コード例 #6
0
ファイル: ProcessingForm.cs プロジェクト: sstundzia/replacer
 /// <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);
     }
 }