Add a log file and the ability to turn application logging on and off.

svn path=/trunk/tools/reactosdbg/; revision=1025
This commit is contained in:
Ged Murphy 2009-05-28 16:51:06 +00:00
parent f81252333b
commit 30f3891f5b
3 changed files with 60 additions and 1 deletions

View File

@ -30,4 +30,28 @@ namespace RosDBG
}
}
public class FileEditor : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}
public override object EditValue(ITypeDescriptorContext typedesc, IServiceProvider provider, object value)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
ofd.CheckFileExists = false;
ofd.Filter = "log files (*.log)|*.log";
ofd.DefaultExt = "log";
ofd.AddExtension = true;
ofd.RestoreDirectory = true;
if (ofd.ShowDialog() == DialogResult.OK)
return ofd.FileName;
else
return value;
}
}
}

View File

@ -107,7 +107,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="DebugInfoFile.cs" />
<Compile Include="DirectoryChooser.cs">
<Compile Include="FileDirChooser.cs">
</Compile>
<Compile Include="Dockable Objects\ToolWindow.cs">
<SubType>Form</SubType>

View File

@ -106,6 +106,24 @@ namespace RosDBG
set { _pipeconnsettings = value; }
}
[Browsable(true)]
[CategoryAttribute("Logging"), DescriptionAttribute("Turn application logging on or off")]
[UserScopedSetting, DefaultSettingValue("true")]
[TypeConverter(typeof(AppLoggingSelection))]
public string AppLogging
{
get { return this["AppLogging"].ToString(); }
set { this["AppLogging"] = value; }
}
[CategoryAttribute("Logging"), DescriptionAttribute("The log file in which to store the app log")]
[UserScopedSetting, DefaultSettingValue(@".\rosdbg.log"), Editor(typeof(FileEditor), typeof(UITypeEditor))]
public string AppLogFile
{
get { return this["AppLogFile"].ToString(); }
set { this["AppLogFile"] = value; }
}
public SettingsPropertyValues()
{
Reload();
@ -149,6 +167,23 @@ namespace RosDBG
}
}
internal class AppLoggingSelection : StringConverter
{
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return true;
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(new string[] { "true", "false" });
}
}
#endregion
[TypeConverterAttribute(typeof(ExpandableObjectConverter))]