Update of /cvsroot/jcframework/FrameworkMapper In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv697 Added Files: AssemblyInfo.vb AtomsFrameworkMapper.sln CAssociationEntry.vb CAssociationEntryCollection.vb CAttributeList.vb CMappedAssociation.vb CMappedAttribute.vb CMappedAttributeCollection.vb CMappedClass.vb CMappedClassCollection.vb CMappedDatabase.vb COptions.vb CProject.vb FrameworkMapper.vbproj FrmMain.resx FrmMain.vb MappedDatabaseList.vb README.txt XMLMapper.vb frmAddDatabase.resx frmAddDatabase.vb frmClassInfo.resx frmClassInfo.vb frmClasses.resx frmClasses.vb frmDatabases.resx frmDatabases.vb frmOptions.resx frmOptions.vb frmProjectProperties.resx frmProjectProperties.vb frmProperties.resx frmProperties.vb Log Message: Initial Import of sources. --- NEW FILE: CMappedClassCollection.vb --- Public Class CMappedClassCollection Inherits CollectionBase Public Sub Add(ByVal a As CMappedClass) list.Add(a) End Sub Public Sub Remove(ByVal index As Integer) If index > Count - 1 Or index < 0 Then Throw New Exception("index value is outside of bounds") End If list.RemoveAt(index) End Sub Public Sub Remove(ByVal value As CMappedClass) list.Remove(value) End Sub Default Public ReadOnly Property Item(ByVal index As Integer) As CMappedClass Get Return CType(list.Item(index), CMappedClass) End Get End Property Default Public ReadOnly Property Item(ByVal _name As String) As CMappedClass Get For Each ma As CMappedClass In Me If ma.ClassName = _name Then Return ma End If Next End Get End Property End Class --- NEW FILE: CMappedDatabase.vb --- Public Class CMappedDatabase Public dbname As String Public dbType As String Public serverName As String Public user As String Public password As String Public OIDTable As String Public portNumber As String Public options As String Public NameParam As String Public Expanded As Boolean Public tables As New Collection Public Sub getDBSchema() Select Case dbType Case "CMSSQLDatabase" GetMSSQLDB() Case Else End Select End Sub Private Sub GetMSSQLDB() Dim conn As New SqlClient.SqlConnection Try 'If user Is Nothing OrElse user.Length = 0 Then ' m_user = "" ' m_password = "" ' GetLoginDetails(m_user, m_password) 'End If conn.ConnectionString = _ "Data Source=" & serverName & ";" & _ "Initial Catalog=" & NameParam & ";" & _ "Integrated Security=false;" & _ "Persist Security Info=False;" & _ "User Id=" & user & ";" & _ "Password=" & password conn.Open() Catch ex As SqlClient.SqlException MsgBox("Connection to " & serverName & " couldn't be established") Return End Try Dim schemaDA As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter("SELECT * FROM INFORMATION_SCHEMA.TABLES " & _ "ORDER BY TABLE_TYPE, TABLE_NAME", _ conn) Dim schemaTable As DataTable = New DataTable schemaDA.Fill(schemaTable) tables = New Collection Dim table As dbTable Dim col As dbColumn For Each dr As DataRow In schemaTable.Rows table = New dbTable table.tableName = dr("TABLE_NAME") table.tableOwner = dr("TABLE_SCHEMA") If dr("TABLE_TYPE") = "BASE TABLE" Then table.tableType = "TABLE" Else table.tableType = "VIEW" End If table.parentDB = Me tables.Add(table, table.ToString) Dim fieldDA As SqlClient.SqlDataAdapter = _ New SqlClient.SqlDataAdapter("SELECT * FROM INFORMATION_SCHEMA.COLUMNS " & _ "where table_schema = '" & dr("TABLE_SCHEMA") & "' and Table_name = '" & dr("TABLE_NAME") & "' " & _ "ORDER BY ORDINAL_POSITION", _ conn) Dim schemaTableCols As DataTable = New DataTable fieldDA.Fill(schemaTableCols) For Each colrow As DataRow In schemaTableCols.Rows col = New dbColumn col.colName = colrow("COLUMN_NAME") col.colType = colrow("DATA_TYPE") Select Case col.colType Case "bigint" col.dotnetTypeName = "long" Case "binary" col.dotnetTypeName = "Object" Case "bit" col.dotnetTypeName = "Boolean" Case "char" col.dotnetTypeName = "String" Case "datetime" col.dotnetTypeName = "DateTime" Case "decimal" col.dotnetTypeName = "Decimal" Case "float" col.dotnetTypeName = "Double" Case "image" col.dotnetTypeName = "Byte()" Case "int" col.dotnetTypeName = "Integer" Case "money" col.dotnetTypeName = "Decimal" Case "nchar" col.dotnetTypeName = "String" Case "ntext" col.dotnetTypeName = "String" Case "numeric" col.dotnetTypeName = "Decimal" Case "nvarchar" col.dotnetTypeName = "String" Case "real" col.dotnetTypeName = "Single" Case "smalldatetime" col.dotnetTypeName = "DateTime" Case "smallint" col.dotnetTypeName = "Short" Case "smallmoney" col.dotnetTypeName = "Decimal" Case "text" col.dotnetTypeName = "String" Case "timestamp" col.dotnetTypeName = "Byte()" Case "tinyint" col.dotnetTypeName = "Byte" Case "uniqueidentifier" col.dotnetTypeName = "Guid" Case "varbinary" col.dotnetTypeName = "Byte()" Case "varchar" col.dotnetTypeName = "String" Case "sql_variant" col.dotnetTypeName = "Object" End Select col.parentTable = table table.columns.Add(col, col.colName) Next Dim constraintDA As SqlClient.SqlDataAdapter = _ New SqlClient.SqlDataAdapter("SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS " & _ "where table_schema = '" & dr("TABLE_SCHEMA") & "' and Table_name = '" & dr("TABLE_NAME") & "' " & _ "and CONSTRAINT_TYPE = 'PRIMARY KEY'", conn) Dim TableConstraintCols As DataTable = New DataTable constraintDA.Fill(TableConstraintCols) If TableConstraintCols.Rows.Count > 0 Then Dim constraintRow As DataRow = TableConstraintCols.Rows(0) Dim cname As String = constraintRow("CONSTRAINT_NAME") Dim primaryKeyDA As SqlClient.SqlDataAdapter = _ New SqlClient.SqlDataAdapter("SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE " & _ "where table_schema = '" & dr("TABLE_SCHEMA") & "' and Table_name = '" & dr("TABLE_NAME") & "' " & _ "and CONSTRAINT_NAME = '" & cname & "'", conn) Dim constraintCols As DataTable = New DataTable primaryKeyDA.Fill(constraintCols) For Each conColrow As DataRow In constraintCols.Rows col = table.columns(conColrow("COLUMN_NAME")) col.isPrimaryKey = True Next End If Next End Sub End Class Public Class dbTable Public tableName As String Public tableOwner As String Public parentDB As CMappedDatabase Public Expanded As Boolean Public columns As New Collection Public tableType As String Public Overrides Function ToString() As String Return tableOwner & "." & tableName End Function End Class Public Class dbColumn Public colName As String Public colType As String Public dotnetTypeName As String Public parentTable As dbTable Public isPrimaryKey As Boolean End Class --- NEW FILE: XMLMapper.vb --- Option Strict Off Option Explicit On Imports System.Collections.Specialized Imports System.Xml Public Class CXMLMapper Private m_FileName As String Private p As CProject Public Sub New(ByVal xmlFile As String, ByRef inProj As CProject) MyBase.New() m_FileName = xmlFile p = inProj End Sub Public Sub Load() p.databases = New Collection p.classes = New CMappedClassCollection Dim doc As New XmlDocument Try doc.Load(m_FileName) Catch ex As Exception Exit Sub End Try Dim node As XmlNode Dim elem As XmlElement Dim reldb As CMappedDatabase Dim clm As CMappedClass Dim elementRoot As XmlElement elementRoot = doc.DocumentElement node = elementRoot.FirstChild While Not node Is Nothing If node.NodeType = XmlNodeType.Element Then elem = node If node.Name = "database" Then reldb = getRelationalDatabase(elem) Try p.databases.Add(reldb, reldb.dbname) Catch ex As Exception Throw New Exception("Could not add database " & reldb.dbname & vbCrLf & ex.Message, ex) End Try ElseIf node.Name = "class" Then clm = getClassMap(elem) Try p.classes.Add(clm) Catch ex As Exception Throw New Exception("Could not add classmap " & clm.ClassName & vbCrLf & ex.Message, ex) End Try ElseIf node.Name = "association" Then processAssociation(elem) End If End If node = node.NextSibling() End While End Sub Private Function getRelationalDatabase(ByRef node As XmlElement) As CMappedDatabase Dim relDb As CMappedDatabase relDb = Nothing Dim attrPMName As String Dim attrClassName As XmlAttribute attrPMName = node.GetAttribute("name") attrClassName = node.GetAttributeNode("class") Dim params As HybridDictionary Dim nodeChild As XmlNode Dim elementChild As XmlElement Dim attrName, attrValue As XmlAttribute If ((Not attrPMName Is Nothing) And (Not attrClassName Is Nothing)) Then relDb = New CMappedDatabase relDb.dbType = attrClassName.Value relDb.dbname = attrPMName nodeChild = node.FirstChild() Do While Not nodeChild Is Nothing If nodeChild.NodeType = XmlNodeType.Element Then elementChild = nodeChild If elementChild.Name = "parameter" Then attrName = elementChild.GetAttributeNode("name") attrValue = elementChild.GetAttributeNode("value") Select Case attrName.Value Case "name" relDb.NameParam = attrValue.Value Case "serverName" relDb.serverName = attrValue.Value Case "user" relDb.user = attrValue.Value Case "password" If attrValue.Value = "N/A" Then relDb.password = Nothing Else relDb.password = attrValue.Value End If Case "OIDTable" relDb.OIDTable = attrValue.Value Case "port" relDb.portNumber = attrValue.Value Case "options" relDb.options = attrValue.Value End Select End If End If nodeChild = nodeChild.NextSibling Loop End If relDb.getDBSchema() Return relDb End Function Private Function getClassMap(ByVal node As XmlElement) As CMappedClass Dim attrClassName As XmlAttribute, attrTable As XmlAttribute, attrTableOwner As XmlAttribute Dim attrDatabase As XmlAttribute, attrSuperClassName As XmlAttribute, attrReadOnly As XmlAttribute, attrModifyOnly As XmlAttribute Dim attrClassNameSpace As XmlAttribute Dim attrSharedField As XmlAttribute, attrSharedValue As XmlAttribute attrClassName = node.GetAttributeNode("name") attrTable = node.GetAttributeNode("table") attrDatabase = node.GetAttributeNode("database") attrSuperClassName = node.GetAttributeNode("superclass") attrReadOnly = node.GetAttributeNode("readonly") attrModifyOnly = node.GetAttributeNode("modifyonly") attrTableOwner = node.GetAttributeNode("owner") attrSharedField = node.GetAttributeNode("sharedtablefield") attrSharedValue = node.GetAttributeNode("sharedtablevalue") attrClassNameSpace = node.GetAttributeNode("namespace") Dim ClassMap As CMappedClass Dim dbMap As CMappedDatabase Dim nodeChild As XmlNode Dim elementChild As XmlElement Dim AttrMap As CMappedAttribute If ((Not attrClassName Is Nothing) And (Not attrDatabase Is Nothing)) Then ClassMap = New CMappedClass ClassMap.Project = p ClassMap.ClassName = attrClassName.Value If Not attrSuperClassName Is Nothing Then ClassMap.SuperClass = p.classes.Item(attrSuperClassName.Value) If Not attrSharedValue Is Nothing Then ClassMap.SharedValue = attrSharedValue.Value End If If Not attrSharedField Is Nothing Then ClassMap.SharedField = attrSharedField.Value End If End If If attrReadOnly Is Nothing Then ClassMap.ReadOnlyFlag = False Else ClassMap.ReadOnlyFlag = attrReadOnly.Value End If If attrModifyOnly Is Nothing Then ClassMap.ModifyOnlyFlag = False Else ClassMap.ModifyOnlyFlag = attrModifyOnly.Value End If If Not attrClassNameSpace Is Nothing Then ClassMap.ClassNameSpace = attrClassNameSpace.Value End If ClassMap.Database = p.databases.Item(attrDatabase.Value) ClassMap.Table = attrTable.Value If attrTableOwner Is Nothing Then ClassMap.TableOwner = "dbo" Else ClassMap.TableOwner = attrTableOwner.Value End If If Not ClassMap.Database Is Nothing Then For Each tbl As dbTable In ClassMap.Database.tables If tbl.tableName = ClassMap.Table AndAlso tbl.tableOwner = ClassMap.TableOwner Then ClassMap.MappedTable = tbl End If Next End If nodeChild = node.FirstChild Do While Not nodeChild Is Nothing If nodeChild.NodeType = XmlNodeType.Element Then elementChild = nodeChild If elementChild.Name = "attribute" Then AttrMap = getAttributeMap(elementChild, ClassMap) If Not AttrMap.Column Is Nothing AndAlso Not ClassMap.MappedTable Is Nothing Then For Each col As dbColumn In ClassMap.MappedTable.columns If col.colName = AttrMap.Column Then AttrMap.MappedColumn = col AttrMap.DataType = col.colType End If Next End If ClassMap.Attributes.Add(AttrMap) End If End If nodeChild = nodeChild.NextSibling Loop End If getClassMap = ClassMap End Function Private Function getAttributeMap(ByVal node As XmlElement, ByVal clMap As CMappedClass) As CMappedAttribute Dim attrColumn, attrName, attrKey, attrFind, attrProxy, attrTimeStamp, attrIdentity As XmlAttribute Dim attrReference As XmlAttribute attrName = node.GetAttributeNode("name") attrColumn = node.GetAttributeNode("column") attrKey = node.GetAttributeNode("key") attrReference = node.GetAttributeNode("reference") attrFind = node.GetAttributeNode("find") attrProxy = node.GetAttributeNode("proxy") attrTimeStamp = node.GetAttributeNode("timestamp") attrIdentity = node.GetAttributeNode("identity") Dim AttrMap As CMappedAttribute Dim refAttr As CMappedAttribute If Not attrName Is Nothing Then AttrMap = New CMappedAttribute AttrMap.Name = attrName.Value AttrMap.isKey = False If Not attrColumn Is Nothing Then AttrMap.Column = attrColumn.Value If Not attrKey Is Nothing Then If UCase(attrKey.Value) = "PRIMARY" Then AttrMap.isKey = True End If End If If Not attrFind Is Nothing Then AttrMap.isFind = CBool(attrFind.Value) End If If Not attrIdentity Is Nothing Then AttrMap.isIdentity = CBool(attrIdentity.Value) End If If Not attrTimeStamp Is Nothing Then AttrMap.isTimeStamp = CBool(attrTimeStamp.Value) Else AttrMap.isTimeStamp = False ' Default is not a timestamp End If End If If Not attrProxy Is Nothing Then AttrMap.isProxy = CBool(attrProxy.Value) Else AttrMap.isProxy = True End If If ((Not attrReference Is Nothing) And (Not clMap.SuperClass Is Nothing)) Then refAttr = clMap.SuperClass.Attributes.Item(attrReference.Value) If Not refAttr Is Nothing Then AttrMap.Reference = refAttr.Name End If End If getAttributeMap = AttrMap End If End Function Private Sub processAssociation(ByVal node As XmlElement) Dim attrToClass, attrFromClass, attrTarget As Object Dim attrCardinality As XmlAttribute Dim fromClassMap As CMappedClass Dim toClassMap As CMappedClass Dim udaAm As CMappedAssociation Dim nodeChild As XmlNode Dim elementChild As XmlElement Dim entry As CAssociationEntry Dim amFromAttribute As Object Dim amToAttribute As CMappedAttribute Dim attrFromAttribute As Object Dim attrToAttribute As XmlAttribute Dim attrName As XmlAttribute attrFromClass = node.GetAttributeNode("fromClass") attrToClass = node.GetAttributeNode("toClass") attrTarget = node.GetAttributeNode("target") attrCardinality = node.GetAttributeNode("cardinality") attrName = node.GetAttributeNode("name") If ((Not attrFromClass Is Nothing) And (Not attrToClass Is Nothing) And (Not attrTarget Is Nothing)) Then fromClassMap = p.classes.Item(attrFromClass.Value) toClassMap = p.classes.Item(attrToClass.Value) udaAm = New CMappedAssociation udaAm.fromClass = fromClassMap udaAm.toClass = toClassMap udaAm.targetAttribute = fromClassMap.Attributes.Item(attrTarget.Value) udaAm.deleteAuto = node.GetAttributeNode("deleteAutomatic").Value udaAm.saveAuto = node.GetAttributeNode("saveAutomatic").Value udaAm.retrieveAuto = node.GetAttributeNode("retrieveAutomatic").Value If attrName Is Nothing Then udaAm.name = udaAm.targetAttribute.Name Else udaAm.name = attrName.Value End If If Not attrCardinality Is Nothing Then If UCase(attrCardinality.Value) = "ONETOONE" Then udaAm.Cardinality = Cardinalities.OneToOne ElseIf UCase(attrCardinality.Value) = "ONETOMANY" Then udaAm.Cardinality = Cardinalities.OneToMany End If End If nodeChild = node.FirstChild Do While Not nodeChild Is Nothing If nodeChild.NodeType = XmlNodeType.Element Then elementChild = nodeChild If elementChild.Name = "entry" Then attrFromAttribute = elementChild.GetAttributeNode("fromAttribute") attrToAttribute = elementChild.GetAttributeNode("toAttribute") If ((Not attrFromAttribute Is Nothing) And (Not attrToAttribute Is Nothing)) Then amFromAttribute = fromClassMap.Attributes.Item(attrFromAttribute.Value) amToAttribute = toClassMap.Attributes.Item(attrToAttribute.Value) If amFromAttribute Is Nothing Then Throw New Exception("Error in association definition") End If If amToAttribute Is Nothing Then Throw New Exception("Error in association definition") End If entry = New CAssociationEntry entry.fromAttribute = amFromAttribute entry.toAttribute = amToAttribute udaAm.entries.Add(entry) End If End If End If nodeChild = nodeChild.NextSibling Loop fromClassMap.Associations.Add(udaAm, udaAm.name) Else Throw New Exception("Error in association definition: Missing FromClass, ToClass or Target attributes") End If End Sub Public Sub Save() Dim doc As New XmlDocument Dim elem As XmlElement Dim node As XmlNode Dim attr As XmlAttribute node = doc.CreateElement("map") For Each db As CMappedDatabase In p.databases elem = doc.CreateElement("database") saveDatabase(doc, elem, db) node.AppendChild(elem) Next For Each cls As CMappedClass In p.classes elem = doc.CreateElement("class") saveClass(doc, elem, cls) node.AppendChild(elem) Next For Each cls As CMappedClass In p.classes For Each ass As CMappedAssociation In cls.Associations elem = doc.CreateElement("association") saveassociation(doc, elem, ass) node.AppendChild(elem) Next Next doc.AppendChild(node) doc.Save(m_FileName) End Sub Private Sub saveDatabase(ByVal doc As XmlDocument, ByVal elem As XmlElement, ByVal db As CMappedDatabase) Dim attr As XmlAttribute Dim param As XmlElement 'db name CreateAttributeValue(doc, elem, "name", db.dbname) CreateAttributeValue(doc, elem, "class", db.dbType) 'Now add parameters If db.NameParam <> String.Empty Then param = doc.CreateElement("parameter") CreateAttributeValue(doc, param, "name", "name") CreateAttributeValue(doc, param, "value", db.NameParam) elem.AppendChild(param) End If If db.serverName <> String.Empty Then param = doc.CreateElement("parameter") CreateAttributeValue(doc, param, "name", "serverName") CreateAttributeValue(doc, param, "value", db.serverName) elem.AppendChild(param) End If If db.user <> String.Empty Then param = doc.CreateElement("parameter") CreateAttributeValue(doc, param, "name", "user") CreateAttributeValue(doc, param, "value", db.user) elem.AppendChild(param) End If If db.password <> String.Empty Then param = doc.CreateElement("parameter") CreateAttributeValue(doc, param, "name", "password") CreateAttributeValue(doc, param, "value", db.password) elem.AppendChild(param) End If If db.OIDTable <> String.Empty Then param = doc.CreateElement("parameter") CreateAttributeValue(doc, param, "name", "OIDTable") CreateAttributeValue(doc, param, "value", db.OIDTable) elem.AppendChild(param) End If If db.portNumber <> String.Empty Then param = doc.CreateElement("parameter") CreateAttributeValue(doc, param, "name", "port") CreateAttributeValue(doc, param, "value", db.portNumber) elem.AppendChild(param) End If If db.options <> String.Empty Then param = doc.CreateElement("parameter") CreateAttributeValue(doc, param, "name", "options") CreateAttributeValue(doc, param, "value", db.options) elem.AppendChild(param) End If End Sub Private Sub SaveClass(ByVal doc As XmlDocument, ByVal elem As XmlElement, ByVal cls As CMappedClass) Dim mappedAttr As XmlElement CreateAttributeValue(doc, elem, "name", cls.ClassName) CreateAttributeValue(doc, elem, "table", cls.Table) CreateAttributeValue(doc, elem, "database", cls.DatabaseName) If cls.TableOwner <> "dbo" AndAlso cls.TableOwner <> String.Empty Then CreateAttributeValue(doc, elem, "owner", cls.TableOwner) End If If Not cls.SuperClass Is Nothing Then CreateAttributeValue(doc, elem, "superclass", cls.SuperClass.ClassName) If cls.SharedField <> String.Empty Then CreateAttributeValue(doc, elem, "sharedtablefield", cls.SharedField) CreateAttributeValue(doc, elem, "sharedtablevalue", cls.SharedValue) End If End If If cls.ReadOnlyFlag Then CreateAttributeValue(doc, elem, "readonly", "true") End If If cls.ModifyOnlyFlag Then CreateAttributeValue(doc, elem, "modifyonly", "true") End If If cls.ClassNameSpace <> String.Empty Then CreateAttributeValue(doc, elem, "namespace", cls.ClassNameSpace) End If For Each attr As CMappedAttribute In cls.Attributes mappedAttr = doc.CreateElement("attribute") CreateAttributeValue(doc, mappedAttr, "name", attr.Name) If attr.Column <> String.Empty Then CreateAttributeValue(doc, mappedAttr, "column", attr.Column) End If If attr.isKey Then CreateAttributeValue(doc, mappedAttr, "key", "primary") End If If attr.isFind Then CreateAttributeValue(doc, mappedAttr, "find", "true") End If If attr.Reference <> String.Empty Then CreateAttributeValue(doc, mappedAttr, "reference", attr.Reference) End If If attr.isProxy = False Then CreateAttributeValue(doc, mappedAttr, "proxy", "false") End If If attr.isTimeStamp Then CreateAttributeValue(doc, mappedAttr, "timestamp", "true") End If If attr.isIdentity Then CreateAttributeValue(doc, mappedAttr, "identity", "true") End If elem.AppendChild(mappedAttr) Next End Sub Private Sub SaveAssociation(ByVal doc As XmlDocument, ByVal elem As XmlElement, ByVal ass As CMappedAssociation) Dim assEntry As XmlElement CreateAttributeValue(doc, elem, "fromClass", ass.fromClass.ClassName) CreateAttributeValue(doc, elem, "toClass", ass.ToClass.ClassName) If ass.TargetAttribute Is Nothing Then CreateAttributeValue(doc, elem, "target", "No Target") Else CreateAttributeValue(doc, elem, "target", ass.TargetAttribute.Name) End If If ass.Cardinality = Cardinalities.OneToOne Then CreateAttributeValue(doc, elem, "cardinality", "OneToOne") Else CreateAttributeValue(doc, elem, "cardinality", "OneToMany") End If If ass.Name <> ass.TargetAttribute.Name Then CreateAttributeValue(doc, elem, "name", ass.Name) End If If ass.RetrieveAuto Then CreateAttributeValue(doc, elem, "retrieveAutomatic", "true") Else CreateAttributeValue(doc, elem, "retrieveAutomatic", "false") End If If ass.SaveAuto Then CreateAttributeValue(doc, elem, "saveAutomatic", "true") Else CreateAttributeValue(doc, elem, "saveAutomatic", "false") End If If ass.DeleteAuto Then CreateAttributeValue(doc, elem, "deleteAutomatic", "true") Else CreateAttributeValue(doc, elem, "deleteAutomatic", "false") End If For Each e As CAssociationEntry In ass.Entries assEntry = doc.CreateElement("entry") CreateAttributeValue(doc, assEntry, "fromAttribute", e.fromAttribute.Name) CreateAttributeValue(doc, assEntry, "toAttribute", e.toAttribute.Name) elem.AppendChild(assEntry) Next End Sub Private Sub CreateAttributeValue(ByVal doc As XmlDocument, ByVal elem As XmlElement, ByVal name As String, ByVal value As String) Dim attr As XmlAttribute attr = doc.CreateAttribute(name) attr.Value = value elem.Attributes.Append(attr) End Sub End Class --- NEW FILE: AssemblyInfo.vb --- Imports System Imports System.Reflection Imports System.Runtime.InteropServices ' General Information about an assembly is controlled through the following ' set of attributes. Change these attribute values to modify the information ' associated with an assembly. ' Review the values of the assembly attributes <Assembly: AssemblyTitle("")> <Assembly: AssemblyDescription("")> <Assembly: AssemblyCompany("")> <Assembly: AssemblyProduct("")> <Assembly: AssemblyCopyright("")> <Assembly: AssemblyTrademark("")> <Assembly: CLSCompliant(True)> 'The following GUID is for the ID of the typelib if this project is exposed to COM <Assembly: Guid("FD5B735C-1090-41C9-B094-E0E8EF75593C")> ' Version information for an assembly consists of the following four values: ' ' Major Version ' Minor Version ' Build Number ' Revision ' ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: <Assembly: AssemblyVersion("1.0.*")> --- NEW FILE: frmProjectProperties.resx --- <?xml version="1.0" encoding="utf-8"?> <root> <!-- Microsoft ResX Schema Version 1.3 The primary goals of this format is to allow a simple XML format that is mostly human readable. The generation and parsing of the various data types are done through the TypeConverter classes associated with the data types. Example: ... ado.net/XML headers & schema ... <resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="version">1.3</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <data name="Name1">this is my long string</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> [base64 mime encoded serialized .NET Framework object] </data> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> [base64 mime encoded string representing a byte array form of the .NET Framework object] </data> There are any number of "resheader" rows that contain simple name/value pairs. Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET class that support text/value conversion through the TypeConverter architecture. Classes that don't support this are serialized and stored with the mimetype set. The mimetype is used forserialized objects, and tells the ResXResourceReader how to depersist the object. This is currently not extensible. For a given mimetype the value must be set accordingly: Note - application/x-microsoft.net.object.binary.base64 is the format that the ResXResourceWriter will generate, however the reader can read any of the formats listed below. mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with : System.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Soap.SoapFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.bytearray.base64 value : The object must be serialized into a byte array : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>1.3</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <data name="Label1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="Label1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="TextBox1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="TextBox1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="TextBox1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label2.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="Label2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="TextBox2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="TextBox2.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="TextBox2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Button1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="Button1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Button1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Button2.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="Button2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Button2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label3.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="Label3.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label3.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="TextBox3.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="TextBox3.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="TextBox3.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="cmbTemplateSet.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="cmbTemplateSet.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="cmbTemplateSet.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label4.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="Label4.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label4.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>(Default)</value> </data> <data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.Name"> <value>frmProjectProperties</value> </data> <data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>2, 2</value> </data> <data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </data> <data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>80</value> </data> <data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </data> <data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> AAABAAIAICAQAAAAAADoAgAAJgAAABAQAAAAAAAAaAUAAA4DAAAoAAAAIAAAAEAAAAABAAQAAAAAAAAC AAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAMDAwACAgIAAAAD/AAD/ AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //8oAAAAEAAAACAAAAABAAgAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAgAAAgAAAAICAAIAA AACAAIAAgIAAAMDAwADA3MAA8MqmAAQEBAAICAgADAwMABEREQAWFhYAHBwcACIiIgApKSkAVVVVAE1N TQBCQkIAOTk5AIB8/wBQUP8AkwDWAP/szADG1u8A1ufnAJCprQAAADMAAABmAAAAmQAAAMwAADMAAAAz MwAAM2YAADOZAAAzzAAAM/8AAGYAAABmMwAAZmYAAGaZAABmzAAAZv8AAJkAAACZMwAAmWYAAJmZAACZ zAAAmf8AAMwAAADMMwAAzGYAAMyZAADMzAAAzP8AAP9mAAD/mQAA/8wAMwAAADMAMwAzAGYAMwCZADMA zAAzAP8AMzMAADMzMwAzM2YAMzOZADMzzAAzM/8AM2YAADNmMwAzZmYAM2aZADNmzAAzZv8AM5kAADOZ MwAzmWYAM5mZADOZzAAzmf8AM8wAADPMMwAzzGYAM8yZADPMzAAzzP8AM/8zADP/ZgAz/5kAM//MADP/ /wBmAAAAZgAzAGYAZgBmAJkAZgDMAGYA/wBmMwAAZjMzAGYzZgBmM5kAZjPMAGYz/wBmZgAAZmYzAGZm ZgBmZpkAZmbMAGaZAABmmTMAZplmAGaZmQBmmcwAZpn/AGbMAABmzDMAZsyZAGbMzABmzP8AZv8AAGb/ MwBm/5kAZv/MAMwA/wD/AMwAmZkAAJkzmQCZAJkAmQDMAJkAAACZMzMAmQBmAJkzzACZAP8AmWYAAJlm MwCZM2YAmWaZAJlmzACZM/8AmZkzAJmZZgCZmZkAmZnMAJmZ/wCZzAAAmcwzAGbMZgCZzJkAmczMAJnM /wCZ/wAAmf8zAJnMZgCZ/5kAmf/MAJn//wDMAAAAmQAzAMwAZgDMAJkAzADMAJkzAADMMzMAzDNmAMwz mQDMM8wAzDP/AMxmAADMZjMAmWZmAMxmmQDMZswAmWb/AMyZAADMmTMAzJlmAMyZmQDMmcwAzJn/AMzM AADMzDMAzMxmAMzMmQDMzMwAzMz/AMz/AADM/zMAmf9mAMz/mQDM/8wAzP//AMwAMwD/AGYA/wCZAMwz AAD/MzMA/zNmAP8zmQD/M8wA/zP/AP9mAAD/ZjMAzGZmAP9mmQD/ZswAzGb/AP+ZAAD/mTMA/5lmAP+Z mQD/mcwA/5n/AP/MAAD/zDMA/8xmAP/MmQD/zMwA/8z/AP//MwDM/2YA//+ZAP//zABmZv8AZv9mAGb/ /wD/ZmYA/2b/AP//ZgAhAKUAX19fAHd3dwCGhoYAlpaWAMvLywCysrIA19fXAN3d3QDj4+MA6urqAPHx 8QD4+PgA8Pv/AKSgoACAgIAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////AAoKCgoKCgoKCgoKCgoK CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoK CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgr/////////////CgoKCgoK/woK/woKCgoK/woKCgoKCv////// ///s//8KCgoKCgr/Cgr///8KBwr/CgoKCgoK/woHCv8KBwoHCgoKBAQKCv//CgcKBwoHCgcHCgQECgoK CgoKBwoHCgcHBwcEBAoKCgoKCgoHCgcHBwcHBAQKCgoKCgoKCgcHBwcHCgQECgoKCgoKCgoKCgoKCgoE BAr//wAA//8AAP//AAD//wAA//8AAAAPAAAADwAAAA8AAAAPAAAADwAAAAkAAAABAAAAAQAA+AEAAPwB AAD+CQAA </value> </data> </root> --- NEW FILE: frmOptions.vb --- Imports System.IO Public Class frmOptions Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents txtTemplateDir As System.Windows.Forms.TextBox <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.Label1 = New System.Windows.Forms.Label Me.txtTemplateDir = New System.Windows.Forms.TextBox Me.Button2 = New System.Windows.Forms.Button Me.Button1 = New System.Windows.Forms.Button Me.SuspendLayout() ' 'Label1 ' Me.Label1.Location = New System.Drawing.Point(16, 26) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(108, 23) Me.Label1.TabIndex = 0 Me.Label1.Text = "Template Directory" ' 'txtTemplateDir ' Me.txtTemplateDir.Location = New System.Drawing.Point(146, 28) Me.txtTemplateDir.Name = "txtTemplateDir" Me.txtTemplateDir.Size = New System.Drawing.Size(166, 20) Me.txtTemplateDir.TabIndex = 1 Me.txtTemplateDir.Text = "" ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(130, 126) Me.Button2.Name = "Button2" Me.Button2.TabIndex = 7 Me.Button2.Text = "Cancel" ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(38, 126) Me.Button1.Name = "Button1" Me.Button1.TabIndex = 6 Me.Button1.Text = "OK" ' 'frmOptions ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(368, 158) Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.txtTemplateDir) Me.Controls.Add(Me.Label1) Me.Name = "frmOptions" Me.Text = "Options" Me.ResumeLayout(False) End Sub #End Region Public o As COptions Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim d As Directory If d.Exists(txtTemplateDir.Text) Then o.TemplateDirectory = txtTemplateDir.Text o.Save() Me.Close() Else If MsgBox("Template directory does not exist. Do you wish to create it?", MsgBoxStyle.YesNo, "Create Template Directory") = MsgBoxResult.Yes Then d.CreateDirectory(txtTemplateDir.Text) o.TemplateDirectory = txtTemplateDir.Text o.Save() Me.Close() End If End If End Sub Private Sub frmOptions_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load txtTemplateDir.Text = o.TemplateDirectory End Sub Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End Sub End Class --- NEW FILE: frmClasses.vb --- Imports WeifenLuo.WinFormsUI Public Class frmClasses Inherits WeifenLuo.WinFormsUI.DockContent #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents TreeView1 As System.Windows.Forms.TreeView Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu Friend WithEvents mnuNewClass As System.Windows.Forms.MenuItem Friend WithEvents mnuClassProperties As System.Windows.Forms.MenuItem Friend WithEvents ImageList1 As System.Windows.Forms.ImageList Friend WithEvents mnuDelete As System.Windows.Forms.MenuItem <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmClasses)) Me.TreeView1 = New System.Windows.Forms.TreeView Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components) Me.ContextMenu1 = New System.Windows.Forms.ContextMenu Me.mnuNewClass = New System.Windows.Forms.MenuItem Me.mnuClassProperties = New System.Windows.Forms.MenuItem Me.mnuDelete = New System.Windows.Forms.MenuItem Me.SuspendLayout() ' 'TreeView1 ' Me.TreeView1.Dock = System.Windows.Forms.DockStyle.Fill Me.TreeView1.ImageList = Me.ImageList1 Me.TreeView1.Location = New System.Drawing.Point(0, 0) Me.TreeView1.Name = "TreeView1" Me.TreeView1.Nodes.AddRange(New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("Classes")}) Me.TreeView1.Size = New System.Drawing.Size(198, 266) Me.TreeView1.TabIndex = 0 ' 'ImageList1 ' Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16) Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer) Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent ' 'ContextMenu1 ' Me.ContextMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuNewClass, Me.mnuDelete, Me.mnuClassProperties}) ' 'mnuNewClass ' Me.mnuNewClass.Index = 0 Me.mnuNewClass.Text = "New" ' 'mnuClassProperties ' Me.mnuClassProperties.Index = 2 Me.mnuClassProperties.Text = "Properties" ' 'mnuDelete ' Me.mnuDelete.Index = 1 Me.mnuDelete.Text = "Delete" ' 'frmClasses ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(198, 266) Me.Controls.Add(Me.TreeView1) Me.DockableAreas = CType(((((WeifenLuo.WinFormsUI.DockAreas.Float Or WeifenLuo.WinFormsUI.DockAreas.DockLeft) _ Or WeifenLuo.WinFormsUI.DockAreas.DockRight) _ Or WeifenLuo.WinFormsUI.DockAreas.DockTop) _ Or WeifenLuo.WinFormsUI.DockAreas.DockBottom), WeifenLuo.WinFormsUI.DockAreas) Me.HideOnClose = True Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Name = "frmClasses" Me.ShowHint = WeifenLuo.WinFormsUI.DockState.DockLeft Me.Text = "Classes" Me.ResumeLayout(False) End Sub #End Region Public frmMain As frmMain Public Sub ReloadTreeView() If frmMain Is Nothing Then Exit Sub End If Dim root As TreeNode TreeView1.BeginUpdate() TreeView1.Nodes.Clear() root = TreeView1.Nodes.Add("Classes") root.ImageIndex = 0 'loop to add databases Dim n As TreeNode For Each c As CMappedClass In frmMain.p.classes n = New TreeNode(c.ClassName) n.Tag = c root.ImageIndex = 0 If c.SuperClass Is Nothing Then root.Nodes.Add(n) Else Dim n1 As TreeNode = findNode(root, c.SuperClass.ClassName) If n1 Is Nothing Then root.Nodes.Add(n) Else n1.Nodes.Add(n) If c.SuperClass.Expanded Then n1.Expand() End If End If End If Next root.Expand() TreeView1.EndUpdate() End Sub Private Function findNode(ByVal root As TreeNode, ByVal name As String) As TreeNode For Each n As TreeNode In root.Nodes If n.Text = name Then Return n Else Dim n1 As TreeNode = findNode(n, name) If Not n1 Is Nothing Then Return n1 End If End If Next Return Nothing End Function Private Sub TreeView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.DoubleClick If TreeView1.SelectedNode Is Nothing Then Exit Sub End If ShowClass() End Sub Private Function FindDocument(ByVal cname As String) As DockContent For Each content As DockContent In DockPanel.Documents If content.Text = cname Then Return content End If Next Return Nothing End Function Private Sub TreeView1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseUp If e.Button = MouseButtons.Right Then Dim n As TreeNode = Me.TreeView1.GetNodeAt(e.X, e.Y) If Not n Is Nothing Then Me.TreeView1.SelectedNode = n If n.Parent Is Nothing Then 'On the root node Me.mnuNewClass.Visible = True Me.mnuClassProperties.Visible = False Me.mnuDelete.Visible = False Else Me.mnuClassProperties.Text = "Properties" Me.mnuNewClass.Visible = True Me.mnuClassProperties.Visible = True Me.mnuDelete.Visible = True End If Else Me.mnuClassProperties.Text = "(no item selected)" Me.mnuNewClass.Visible = False Me.mnuClassProperties.Visible = True Me.mnuDelete.Visible = False End If Me.ContextMenu1.Show(Me.TreeView1, New Point(e.X, e.Y)) End If End Sub Private Sub mnuNewClass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuNewClass.Click Dim parentClass As CMappedClass If Not TreeView1.SelectedNode.Tag Is Nothing Then If TreeView1.SelectedNode.Tag.GetType Is GetType(CMappedClass) Then parentClass = TreeView1.SelectedNode.Tag End If End If Dim c As New CMappedClass If Not parentClass Is Nothing Then c.SuperClass = parentClass End If c.Project = frmMain.p frmMain.p.classes.Add(c) ReloadTreeView() Dim tn As TreeNode = findNode(TreeView1.Nodes(0), c.ClassName) tn.EnsureVisible() TreeView1.SelectedNode = tn ShowClass() End Sub Private Sub ShowClass() Dim cname As String cname = TreeView1.SelectedNode.Text If cname = "classes" Then Exit Sub End If Dim dc As DockContent = FindDocument(cname) If Not dc Is Nothing Then dc.Show(frmMain.DockPanel1) dc.Focus() Return End If Dim fc As frmClassInfo = New frmClassInfo fc.frmMain = frmMain fc.Text = cname fc.Show(frmMain.DockPanel1) End Sub Private Sub TreeView1_AfterExpand(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterExpand If e.Node.Tag Is Nothing Then Exit Sub If e.Node.Tag.GetType Is GetType(CMappedClass) Then CType(e.Node.Tag, CMappedClass).Expanded = True End If End Sub Private Sub TreeView1_AfterCollapse(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterCollapse If e.Node.Tag Is Nothing Then Exit Sub If e.Node.Tag.GetType Is GetType(CMappedClass) Then CType(e.Node.Tag, CMappedClass).Expanded = False End If End Sub Private Sub mnuDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuDelete.Click Dim cname As String cname = TreeView1.SelectedNode.Text If cname = "classes" Then Exit Sub End If RemoveClass(cname) End Sub Private Sub RemoveClass(ByVal cname As String) Dim cls As CMappedClass Dim classesToRemove As New Collection For Each cls In frmMain.p.classes If Not cls.SuperClass Is Nothing Then If cls.SuperClass.ClassName = cname Then classesToRemove.Add(cls) End If End If Next For Each cls In classesToRemove RemoveClass(cls.ClassName) Next Dim dc As DockContent = FindDocument(cname) If Not dc Is Nothing Then 'Close the class window dc.Close() End If cls = frmMain.p.classes(cname) frmMain.p.classes.Remove(cls) Dim tn As TreeNode = findNode(TreeView1.Nodes(0), cname) TreeView1.Nodes.Remove(tn) End Sub Private Sub mnuClassProperties_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuClassProperties.Click ShowClass() End Sub Private Sub TreeView1_ItemDrag(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemDragEventArgs) Handles TreeView1.ItemDrag If e.Button = MouseButtons.Left Then DoDragDrop(e.Item, DragDropEffects.Copy) End If End Sub End Class --- NEW FILE: FrameworkMapper.vbproj --- <VisualStudioProject> <VisualBasic ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{F656650C-9484-4E0F-AC0B-0358E133FB96}" > <Build> <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" AssemblyName = "FrameworkMapper" AssemblyOriginatorKeyFile = "" AssemblyOriginatorKeyMode = "None" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "WinExe" OptionCompare = "Binary" OptionExplicit = "On" OptionStrict = "Off" RootNamespace = "FrameworkMapper" StartupObject = "FrameworkMapper.FrmMain" > <Config Name = "Debug" BaseAddress = "285212672" ConfigurationOverrideFile = "" DefineConstants = "" DefineDebug = "true" DefineTrace = "true" DebugSymbols = "true" IncrementalBuild = "true" Optimize = "false" OutputPath = "bin\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "1" /> <Config Name = "Release" BaseAddress = "285212672" ConfigurationOverrideFile = "" DefineConstants = "" DefineDebug = "false" DefineTrace = "true" DebugSymbols = "false" IncrementalBuild = "false" Optimize = "true" OutputPath = "bin\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "1" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" /> <Reference Name = "System.Data" AssemblyName = "System.Data" /> <Reference Name = "System.Drawing" AssemblyName = "System.Drawing" /> <Reference Name = "System.Windows.Forms" AssemblyName = "System.Windows.Forms" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" /> <Reference Name = "Microsoft.VisualBasic" AssemblyName = "Microsoft.VisualBasic" HintPath = "..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Microsoft.VisualBasic.dll" /> <Reference Name = "WeifenLuo.WinFormsUI" AssemblyName = "WeifenLuo.WinFormsUI" HintPath = "WinFormsUI\bin\Debug\WeifenLuo.WinFormsUI.dll" /> </References> <Imports> <Import Namespace = "Microsoft.VisualBasic" /> <Import Namespace = "System" /> <Import Namespace = "System.Collections" /> <Import Namespace = "System.Data" /> <Import Namespace = "System.Drawing" /> <Import Namespace = "System.Diagnostics" /> <Import Namespace = "System.Windows.Forms" /> </Imports> </Build> <Files> <Include> <File RelPath = "AssemblyInfo.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CAssociationEntry.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CAssociationEntryCollection.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CAttributeList.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CMappedAssociation.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CMappedAttribute.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CMappedAttributeCollection.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CMappedClass.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CMappedClassCollection.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CMappedDatabase.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "COptions.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CProject.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "frmAddDatabase.vb" SubType = "Form" BuildAction = "Compile" /> <File RelPath = "frmAddDatabase.resx" DependentUpon = "frmAddDatabase.vb" BuildAction = "EmbeddedResource" /> <File RelPath = "frmClasses.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "frmClasses.resx" DependentUpon = "frmClasses.vb" BuildAction = "EmbeddedResource" /> <File RelPath = "frmClassInfo.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "frmClassInfo.resx" ... [truncated message content] |