Author: gedmurphy Date: Thu May 28 20:51:06 2009 New Revision: 41183
URL: http://svn.reactos.org/svn/reactos?rev=41183&view=rev Log: Add a log file and the ability to turn application logging on and off.
Added: trunk/tools/reactosdbg/RosDBG/FileDirChooser.cs Removed: trunk/tools/reactosdbg/RosDBG/DirectoryChooser.cs Modified: trunk/tools/reactosdbg/RosDBG/RosDBG.csproj trunk/tools/reactosdbg/RosDBG/Settings.cs
Removed: trunk/tools/reactosdbg/RosDBG/DirectoryChooser.cs URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/DirectoryCh... ============================================================================== --- trunk/tools/reactosdbg/RosDBG/DirectoryChooser.cs [iso-8859-1] (original) +++ trunk/tools/reactosdbg/RosDBG/DirectoryChooser.cs (removed) @@ -1,33 +1,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing.Design; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using System.IO; - -namespace RosDBG -{ - public class DirectoryEditor : UITypeEditor - { - public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) - { - return UITypeEditorEditStyle.Modal; - } - - public override object EditValue(ITypeDescriptorContext typedesc, IServiceProvider provider, object value) - { - FolderBrowserDialog fbd = new FolderBrowserDialog(); - fbd.Description = "Set path for " + typedesc.PropertyDescriptor.DisplayName; - if (fbd.ShowDialog() == DialogResult.OK) - return fbd.SelectedPath; - else - return value; - } - } - -}
Added: trunk/tools/reactosdbg/RosDBG/FileDirChooser.cs URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/FileDirChoo... ============================================================================== --- trunk/tools/reactosdbg/RosDBG/FileDirChooser.cs (added) +++ trunk/tools/reactosdbg/RosDBG/FileDirChooser.cs [iso-8859-1] Thu May 28 20:51:06 2009 @@ -1,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.Design; +using System.Drawing.Design; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.IO; + +namespace RosDBG +{ + public class DirectoryEditor : UITypeEditor + { + public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) + { + return UITypeEditorEditStyle.Modal; + } + + public override object EditValue(ITypeDescriptorContext typedesc, IServiceProvider provider, object value) + { + FolderBrowserDialog fbd = new FolderBrowserDialog(); + fbd.Description = "Set path for " + typedesc.PropertyDescriptor.DisplayName; + if (fbd.ShowDialog() == DialogResult.OK) + return fbd.SelectedPath; + else + return value; + } + } + + 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; + } + } +}
Modified: trunk/tools/reactosdbg/RosDBG/RosDBG.csproj URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/RosDBG.cspr... ============================================================================== --- trunk/tools/reactosdbg/RosDBG/RosDBG.csproj [iso-8859-1] (original) +++ trunk/tools/reactosdbg/RosDBG/RosDBG.csproj [iso-8859-1] Thu May 28 20:51:06 2009 @@ -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>
Modified: trunk/tools/reactosdbg/RosDBG/Settings.cs URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/Settings.cs... ============================================================================== --- trunk/tools/reactosdbg/RosDBG/Settings.cs [iso-8859-1] (original) +++ trunk/tools/reactosdbg/RosDBG/Settings.cs [iso-8859-1] Thu May 28 20:51:06 2009 @@ -106,6 +106,24 @@ 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 @@ } }
+ 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))]