/* KeePass Password Safe - The Open-Source Password Manager Copyright (C) 2003-2012 Dominik Reichl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ using System; using System.Collections.Generic; namespace KeePassLib.Interfaces { /// /// Status message types. /// public enum LogStatusType { /// /// Default type: simple information type. /// Info = 0, /// /// Warning message. /// Warning, /// /// Error message. /// Error, /// /// Additional information. Depends on lines above. /// AdditionalInfo } /// /// Status logging interface. /// public interface IStatusLogger { /// /// Function which needs to be called when logging is started. /// /// This string should roughly describe /// the operation, of which the status is logged. /// Specifies whether the /// operation is written to the log or not. void StartLogging(string strOperation, bool bWriteOperationToLog); /// /// Function which needs to be called when logging is ended /// (i.e. when no more messages will be logged and when the /// percent value won't change any more). /// void EndLogging(); /// /// Set the current progress in percent. /// /// Percent of work finished. /// Returns true if the caller should continue /// the current work. bool SetProgress(uint uPercent); /// /// Set the current status text. /// /// Status text. /// Type of the message. /// Returns true if the caller should continue /// the current work. bool SetText(string strNewText, LogStatusType lsType); /// /// Check if the user cancelled the current work. /// /// Returns true if the caller should continue /// the current work. bool ContinueWork(); } public sealed class NullStatusLogger : IStatusLogger { public void StartLogging(string strOperation, bool bWriteOperationToLog) { } public void EndLogging() { } public bool SetProgress(uint uPercent) { return true; } public bool SetText(string strNewText, LogStatusType lsType) { return true; } public bool ContinueWork() { return true; } } }