mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
created classes that tie the logging options to the settings file
This commit is contained in:
@@ -36,13 +36,7 @@ namespace mRemoteNG.App
|
||||
private static IMessageWriter BuildTextLogMessageWriter()
|
||||
{
|
||||
return new MessageTypeFilterDecorator(
|
||||
new MessageTypeFilteringOptions
|
||||
{
|
||||
AllowDebugMessages = Settings.Default.TextLogMessageWriterWriteDebugMsgs,
|
||||
AllowInfoMessages = Settings.Default.TextLogMessageWriterWriteInfoMsgs,
|
||||
AllowWarningMessages = Settings.Default.TextLogMessageWriterWriteWarningMsgs,
|
||||
AllowErrorMessages = Settings.Default.TextLogMessageWriterWriteErrorMsgs
|
||||
},
|
||||
new LogMessageTypeFilteringOptions(),
|
||||
new TextLogMessageWriter(Logger.Instance)
|
||||
);
|
||||
}
|
||||
@@ -52,21 +46,10 @@ namespace mRemoteNG.App
|
||||
|
||||
return new OnlyLogMessageFilter(
|
||||
new MessageTypeFilterDecorator(
|
||||
new MessageTypeFilteringOptions
|
||||
{
|
||||
AllowDebugMessages = Settings.Default.NotificationPanelWriterWriteDebugMsgs,
|
||||
AllowInfoMessages = Settings.Default.NotificationPanelWriterWriteInfoMsgs,
|
||||
AllowWarningMessages = Settings.Default.NotificationPanelWriterWriteWarningMsgs,
|
||||
AllowErrorMessages = Settings.Default.NotificationPanelWriterWriteErrorMsgs
|
||||
},
|
||||
new NotificationPanelMessageFilteringOptions(),
|
||||
new MessageFocusDecorator(
|
||||
Windows.ErrorsForm,
|
||||
new MessageTypeFilteringOptions
|
||||
{
|
||||
AllowInfoMessages = Settings.Default.SwitchToMCOnInformation,
|
||||
AllowWarningMessages = Settings.Default.SwitchToMCOnWarning,
|
||||
AllowErrorMessages = Settings.Default.SwitchToMCOnError
|
||||
},
|
||||
new NotificationPanelSwitchOnMessageFilteringOptions(),
|
||||
new NotificationPanelMessageWriter(Windows.ErrorsForm)
|
||||
)
|
||||
)
|
||||
@@ -77,13 +60,7 @@ namespace mRemoteNG.App
|
||||
{
|
||||
return new OnlyLogMessageFilter(
|
||||
new MessageTypeFilterDecorator(
|
||||
new MessageTypeFilteringOptions
|
||||
{
|
||||
AllowDebugMessages = Settings.Default.PopupMessageWriterWriteDebugMsgs,
|
||||
AllowInfoMessages = Settings.Default.PopupMessageWriterWriteInfoMsgs,
|
||||
AllowWarningMessages = Settings.Default.PopupMessageWriterWriteWarningMsgs,
|
||||
AllowErrorMessages = Settings.Default.PopupMessageWriterWriteErrorMsgs
|
||||
},
|
||||
new PopupMessageFilteringOptions(),
|
||||
new PopupMessageWriter()
|
||||
)
|
||||
);
|
||||
|
||||
31
mRemoteV1/Messages/LogMessageTypeFilteringOptions.cs
Normal file
31
mRemoteV1/Messages/LogMessageTypeFilteringOptions.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using mRemoteNG.Messages.MessageWriters;
|
||||
|
||||
namespace mRemoteNG.Messages
|
||||
{
|
||||
public class LogMessageTypeFilteringOptions : IMessageTypeFilteringOptions
|
||||
{
|
||||
public bool AllowDebugMessages
|
||||
{
|
||||
get { return Settings.Default.TextLogMessageWriterWriteDebugMsgs; }
|
||||
set { Settings.Default.TextLogMessageWriterWriteDebugMsgs = value; }
|
||||
}
|
||||
|
||||
public bool AllowInfoMessages
|
||||
{
|
||||
get { return Settings.Default.TextLogMessageWriterWriteInfoMsgs; }
|
||||
set { Settings.Default.TextLogMessageWriterWriteInfoMsgs = value; }
|
||||
}
|
||||
|
||||
public bool AllowWarningMessages
|
||||
{
|
||||
get { return Settings.Default.TextLogMessageWriterWriteWarningMsgs; }
|
||||
set { Settings.Default.TextLogMessageWriterWriteWarningMsgs = value; }
|
||||
}
|
||||
|
||||
public bool AllowErrorMessages
|
||||
{
|
||||
get { return Settings.Default.TextLogMessageWriterWriteErrorMsgs; }
|
||||
set { Settings.Default.TextLogMessageWriterWriteErrorMsgs = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using mRemoteNG.Messages.MessageWriters;
|
||||
|
||||
namespace mRemoteNG.Messages
|
||||
{
|
||||
public class NotificationPanelMessageFilteringOptions : IMessageTypeFilteringOptions
|
||||
{
|
||||
public bool AllowDebugMessages
|
||||
{
|
||||
get { return Settings.Default.NotificationPanelWriterWriteDebugMsgs; }
|
||||
set { Settings.Default.NotificationPanelWriterWriteDebugMsgs = value; }
|
||||
}
|
||||
|
||||
public bool AllowInfoMessages
|
||||
{
|
||||
get { return Settings.Default.NotificationPanelWriterWriteInfoMsgs; }
|
||||
set { Settings.Default.NotificationPanelWriterWriteInfoMsgs = value; }
|
||||
}
|
||||
|
||||
public bool AllowWarningMessages
|
||||
{
|
||||
get { return Settings.Default.NotificationPanelWriterWriteWarningMsgs; }
|
||||
set { Settings.Default.NotificationPanelWriterWriteWarningMsgs = value; }
|
||||
}
|
||||
|
||||
public bool AllowErrorMessages
|
||||
{
|
||||
get { return Settings.Default.NotificationPanelWriterWriteErrorMsgs; }
|
||||
set { Settings.Default.NotificationPanelWriterWriteErrorMsgs = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using mRemoteNG.Messages.MessageWriters;
|
||||
|
||||
namespace mRemoteNG.Messages
|
||||
{
|
||||
public class NotificationPanelSwitchOnMessageFilteringOptions : IMessageTypeFilteringOptions
|
||||
{
|
||||
public bool AllowDebugMessages
|
||||
{
|
||||
get { return false; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public bool AllowInfoMessages
|
||||
{
|
||||
get { return Settings.Default.SwitchToMCOnInformation; }
|
||||
set { Settings.Default.SwitchToMCOnInformation = value; }
|
||||
}
|
||||
|
||||
public bool AllowWarningMessages
|
||||
{
|
||||
get { return Settings.Default.SwitchToMCOnWarning; }
|
||||
set { Settings.Default.SwitchToMCOnWarning = value; }
|
||||
}
|
||||
|
||||
public bool AllowErrorMessages
|
||||
{
|
||||
get { return Settings.Default.SwitchToMCOnError; }
|
||||
set { Settings.Default.SwitchToMCOnError = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
31
mRemoteV1/Messages/PopupMessageFilteringOptions.cs
Normal file
31
mRemoteV1/Messages/PopupMessageFilteringOptions.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using mRemoteNG.Messages.MessageWriters;
|
||||
|
||||
namespace mRemoteNG.Messages
|
||||
{
|
||||
public class PopupMessageFilteringOptions : IMessageTypeFilteringOptions
|
||||
{
|
||||
public bool AllowDebugMessages
|
||||
{
|
||||
get { return Settings.Default.PopupMessageWriterWriteDebugMsgs; }
|
||||
set { Settings.Default.PopupMessageWriterWriteDebugMsgs = value; }
|
||||
}
|
||||
|
||||
public bool AllowInfoMessages
|
||||
{
|
||||
get { return Settings.Default.PopupMessageWriterWriteInfoMsgs; }
|
||||
set { Settings.Default.PopupMessageWriterWriteInfoMsgs = value; }
|
||||
}
|
||||
|
||||
public bool AllowWarningMessages
|
||||
{
|
||||
get { return Settings.Default.PopupMessageWriterWriteWarningMsgs; }
|
||||
set { Settings.Default.PopupMessageWriterWriteWarningMsgs = value; }
|
||||
}
|
||||
|
||||
public bool AllowErrorMessages
|
||||
{
|
||||
get { return Settings.Default.PopupMessageWriterWriteErrorMsgs; }
|
||||
set { Settings.Default.PopupMessageWriterWriteErrorMsgs = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,8 +69,6 @@ namespace mRemoteNG.UI.Forms.OptionsPages
|
||||
SaveLoggingSettings();
|
||||
SavePopupSettings();
|
||||
Settings.Default.Save();
|
||||
Runtime.MessageWriters.Clear();
|
||||
MessageCollectorSetup.BuildMessageWritersFromSettings(Runtime.MessageWriters);
|
||||
}
|
||||
|
||||
private void LoadNotificationPanelSettings()
|
||||
|
||||
@@ -218,6 +218,7 @@
|
||||
<Compile Include="Credential\ICredentialProvider.cs" />
|
||||
<Compile Include="Credential\ICredentialList.cs" />
|
||||
<Compile Include="Credential\INotifyingCredentialRecord.cs" />
|
||||
<Compile Include="Messages\LogMessageTypeFilteringOptions.cs" />
|
||||
<Compile Include="Messages\MessageTypeFilterDecorator.cs" />
|
||||
<Compile Include="Messages\MessageWriters\DebugConsoleMessageWriter.cs" />
|
||||
<Compile Include="Messages\IMessage.cs" />
|
||||
@@ -231,6 +232,9 @@
|
||||
<Compile Include="Messages\MessageWriters\OnlyLogMessageFilter.cs" />
|
||||
<Compile Include="Messages\MessageWriters\PopupMessageWriter.cs" />
|
||||
<Compile Include="Messages\MessageWriters\TextLogMessageWriter.cs" />
|
||||
<Compile Include="Messages\NotificationPanelMessageFilteringOptions.cs" />
|
||||
<Compile Include="Messages\NotificationPanelSwitchOnMessageFilteringOptions.cs" />
|
||||
<Compile Include="Messages\PopupMessageFilteringOptions.cs" />
|
||||
<Compile Include="Security\Authentication\PasswordAuthenticator.cs" />
|
||||
<Compile Include="Security\BlockCipherEngines.cs" />
|
||||
<Compile Include="Security\BlockCipherModes.cs" />
|
||||
|
||||
Reference in New Issue
Block a user