From 2b77b1addca50ec3fc6fdc1bd4e2e4cfff3c2c57 Mon Sep 17 00:00:00 2001 From: xieguigang Date: Mon, 24 Oct 2022 20:21:58 +0800 Subject: [PATCH] implements idispatch interface --- .../Debugger/Exception/ExceptionData.vb | 88 ++++++++++--------- .../Debugger/Exception/MethodFrame.vb | 86 +++++++++--------- .../Debugger/Exception/StackFrame.vb | 86 +++++++++--------- src/ComponentModel/Settings/ConfigEngine.vb | 15 +++- 4 files changed, 151 insertions(+), 124 deletions(-) diff --git a/src/ApplicationServices/Debugger/Exception/ExceptionData.vb b/src/ApplicationServices/Debugger/Exception/ExceptionData.vb index 4d94b7d2..6e0f5bc7 100644 --- a/src/ApplicationServices/Debugger/Exception/ExceptionData.vb +++ b/src/ApplicationServices/Debugger/Exception/ExceptionData.vb @@ -1,62 +1,65 @@ #Region "Microsoft.VisualBasic::204e09ebeaac170c1afe111ad2ba299c, sciBASIC#\Microsoft.VisualBasic.Core\src\ApplicationServices\Debugger\Exception\ExceptionData.vb" - ' Author: - ' - ' asuka (amethyst.asuka@gcmodeller.org) - ' xie (genetics@smrucc.org) - ' xieguigang (xie.guigang@live.com) - ' - ' Copyright (c) 2018 GPL3 Licensed - ' - ' - ' GNU GENERAL PUBLIC LICENSE (GPL3) - ' - ' - ' 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 3 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, see . +' Author: +' +' asuka (amethyst.asuka@gcmodeller.org) +' xie (genetics@smrucc.org) +' xieguigang (xie.guigang@live.com) +' +' Copyright (c) 2018 GPL3 Licensed +' +' +' GNU GENERAL PUBLIC LICENSE (GPL3) +' +' +' 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 3 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, see . - ' /********************************************************************************/ +' /********************************************************************************/ - ' Summaries: +' Summaries: - ' Code Statistics: +' Code Statistics: - ' Total Lines: 82 - ' Code Lines: 59 - ' Comment Lines: 12 - ' Blank Lines: 11 - ' File Size: 3.05 KB +' Total Lines: 82 +' Code Lines: 59 +' Comment Lines: 12 +' Blank Lines: 11 +' File Size: 3.05 KB - ' Class ExceptionData - ' - ' Properties: Message, Source, StackTrace, TypeFullName - ' - ' Function: CreateFromObject, CreateInstance, Exception, GetCurrentStackTrace, getMessages - ' ParseStackTrace, ToString - ' - ' - ' /********************************************************************************/ +' Class ExceptionData +' +' Properties: Message, Source, StackTrace, TypeFullName +' +' Function: CreateFromObject, CreateInstance, Exception, GetCurrentStackTrace, getMessages +' ParseStackTrace, ToString +' +' +' /********************************************************************************/ #End Region +Imports System.Runtime.InteropServices Imports Microsoft.VisualBasic.Text Namespace ApplicationServices.Debugging.Diagnostics + + Public Class ExceptionData Public Property TypeFullName As String @@ -68,6 +71,9 @@ Namespace ApplicationServices.Debugging.Diagnostics Public Property Source As String Public Property StackTrace As StackFrame() + Sub New() + End Sub + ''' ''' Create exception object for throw exception expression ''' diff --git a/src/ApplicationServices/Debugger/Exception/MethodFrame.vb b/src/ApplicationServices/Debugger/Exception/MethodFrame.vb index fd21d174..3eed6a84 100644 --- a/src/ApplicationServices/Debugger/Exception/MethodFrame.vb +++ b/src/ApplicationServices/Debugger/Exception/MethodFrame.vb @@ -1,60 +1,64 @@ #Region "Microsoft.VisualBasic::4be2c6aed1bae45a0ef0d6f229ed811e, sciBASIC#\Microsoft.VisualBasic.Core\src\ApplicationServices\Debugger\Exception\MethodFrame.vb" - ' Author: - ' - ' asuka (amethyst.asuka@gcmodeller.org) - ' xie (genetics@smrucc.org) - ' xieguigang (xie.guigang@live.com) - ' - ' Copyright (c) 2018 GPL3 Licensed - ' - ' - ' GNU GENERAL PUBLIC LICENSE (GPL3) - ' - ' - ' 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 3 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, see . +' Author: +' +' asuka (amethyst.asuka@gcmodeller.org) +' xie (genetics@smrucc.org) +' xieguigang (xie.guigang@live.com) +' +' Copyright (c) 2018 GPL3 Licensed +' +' +' GNU GENERAL PUBLIC LICENSE (GPL3) +' +' +' 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 3 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, see . - ' /********************************************************************************/ +' /********************************************************************************/ - ' Summaries: +' Summaries: - ' Code Statistics: +' Code Statistics: - ' Total Lines: 24 - ' Code Lines: 18 - ' Comment Lines: 0 - ' Blank Lines: 6 - ' File Size: 628 B +' Total Lines: 24 +' Code Lines: 18 +' Comment Lines: 0 +' Blank Lines: 6 +' File Size: 628 B - ' Class Method - ' - ' Properties: [Module], [Namespace], Method - ' - ' Constructor: (+2 Overloads) Sub New - ' Function: ToString - ' - ' - ' /********************************************************************************/ +' Class Method +' +' Properties: [Module], [Namespace], Method +' +' Constructor: (+2 Overloads) Sub New +' Function: ToString +' +' +' /********************************************************************************/ #End Region +Imports System.Runtime.InteropServices + Namespace ApplicationServices.Debugging.Diagnostics + + Public Class Method Public Property [Namespace] As String diff --git a/src/ApplicationServices/Debugger/Exception/StackFrame.vb b/src/ApplicationServices/Debugger/Exception/StackFrame.vb index 361c91d2..cd1a2ca5 100644 --- a/src/ApplicationServices/Debugger/Exception/StackFrame.vb +++ b/src/ApplicationServices/Debugger/Exception/StackFrame.vb @@ -1,58 +1,59 @@ #Region "Microsoft.VisualBasic::b1dcca44b61f51f96039a76ff90db4fa, sciBASIC#\Microsoft.VisualBasic.Core\src\ApplicationServices\Debugger\Exception\StackFrame.vb" - ' Author: - ' - ' asuka (amethyst.asuka@gcmodeller.org) - ' xie (genetics@smrucc.org) - ' xieguigang (xie.guigang@live.com) - ' - ' Copyright (c) 2018 GPL3 Licensed - ' - ' - ' GNU GENERAL PUBLIC LICENSE (GPL3) - ' - ' - ' 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 3 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, see . +' Author: +' +' asuka (amethyst.asuka@gcmodeller.org) +' xie (genetics@smrucc.org) +' xieguigang (xie.guigang@live.com) +' +' Copyright (c) 2018 GPL3 Licensed +' +' +' GNU GENERAL PUBLIC LICENSE (GPL3) +' +' +' 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 3 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, see . - ' /********************************************************************************/ +' /********************************************************************************/ - ' Summaries: +' Summaries: - ' Code Statistics: +' Code Statistics: - ' Total Lines: 95 - ' Code Lines: 62 - ' Comment Lines: 21 - ' Blank Lines: 12 - ' File Size: 3.10 KB +' Total Lines: 95 +' Code Lines: 62 +' Comment Lines: 21 +' Blank Lines: 12 +' File Size: 3.10 KB - ' Class StackFrame - ' - ' Properties: File, Line, Method - ' - ' Constructor: (+2 Overloads) Sub New - ' Function: FromUnknownLocation, Parser, parserImpl, ToString - ' - ' - ' /********************************************************************************/ +' Class StackFrame +' +' Properties: File, Line, Method +' +' Constructor: (+2 Overloads) Sub New +' Function: FromUnknownLocation, Parser, parserImpl, ToString +' +' +' /********************************************************************************/ #End Region +Imports System.Runtime.InteropServices Imports Microsoft.VisualBasic.Linq Namespace ApplicationServices.Debugging.Diagnostics @@ -61,6 +62,9 @@ Namespace ApplicationServices.Debugging.Diagnostics ''' Contains the necessary function calls information, source ''' file location information for traceback the runtime error ''' + ''' + + Public Class StackFrame ''' diff --git a/src/ComponentModel/Settings/ConfigEngine.vb b/src/ComponentModel/Settings/ConfigEngine.vb index ef741a63..85ef3afb 100644 --- a/src/ComponentModel/Settings/ConfigEngine.vb +++ b/src/ComponentModel/Settings/ConfigEngine.vb @@ -307,9 +307,22 @@ Namespace ComponentModel.Settings Return profilesData.FilePath End Function + ''' + ''' save the settings data in xml file format + ''' + ''' + ''' + ''' Public Function Save(FilePath$, Encoding As Encoding) As Boolean Implements ISaveHandle.Save - Dim Xml As String = profilesData.GetXml + ' 20221022 + ' + ' due to the reason of profilesData object is + ' an interface, then getxml on this interface + ' will throw exceptions, change the getxml extension + ' to the object general function to fix + ' this error + Dim xml As String = XmlExtensions.GetXml(profilesData, profilesData.GetType(), throwEx:=False) Return Xml.SaveTo(FilePath Or Me.FilePath.When(FilePath.StringEmpty), Encoding) End Function