当前位置:编程学习 > C#/ASP.NET >>

用vb.net开发api viewer(4)

答案:在项目中添加新项---类(CTypes.vb)
代码如下
Namespace API
    Public Class CTypes
        Implements IStore
        Dim TypeList As SortedList
        Dim TypeListCSharp As SortedList
        Sub New()
            TypeList = New SortedList()
            TypeListCSharp = New SortedList()
        End Sub
        Sub Add(ByVal Key As String, ByVal Data As String, Optional ByVal bCSharp As Boolean = False) Implements IStore.Add
            If Not bCSharp Then
                If Not TypeList.ContainsKey(Key) Then
                    TypeList.Add(Key, Data)
                End If
            Else
                If Not TypeListCSharp.ContainsKey(Key) Then
                    TypeListCSharp.Add(Key, Data)
                End If
            End If
        End Sub

        Overloads Function GetData(ByVal Key As String) As String Implements IStore.GetData
            If TypeList.ContainsKey(Key) Then
                Return CType(TypeList.Item(Key), String)
            Else
                Return Nothing
            End If
        End Function
        Overloads Function GetData(ByVal index As Integer) As String Implements IStore.GetData
            If index < TypeList.Count Then
                Return CType(TypeList.GetByIndex(index), String)
            Else
                Return Nothing
            End If
        End Function
        ReadOnly Property Count() As Integer Implements IStore.Count
            Get
                Return TypeList.Count()
            End Get
        End Property
        ReadOnly Property GetKey(ByVal index As Integer) As String Implements IStore.GetKey
            Get
                If index < TypeList.Count Then
                    Return CType(TypeList.GetKey(index), String)
                Else
                    Return ""
                End If
            End Get
        End Property
        Overloads Function GetDataCSharp(ByVal Key As String) As String Implements IStore.GetDataCSharp
            If TypeListCSharp.ContainsKey(Key) Then
                Return CType(TypeListCSharp.Item(Key), String)
            Else
                Return Nothing
            End If
        End Function
        Overloads Function GetDataCSharp(ByVal index As Integer) As String Implements IStore.GetDataCSharp
            If index < TypeListCSharp.Count Then
                Return CType(TypeListCSharp.GetByIndex(index), String)
            Else
                Return Nothing
            End If
        End Function
    End Class
End Namespace
在项目中添加新项---类(FileHandling.vb)
代码如下
Imports System.IO
Imports System.Runtime.InteropServices
Imports Microsoft.VisualBasic
Imports System.Threading

Namespace API
    Module FileHandling
        Public Const APISEPERATOR = " <@> "
        Public Const APISIZEOFARRAY = "SIZEOFARRAY"
        Public Const APILONG = "Long"
        Public Const APIINTEGER = "Integer"
        Public Const APISCOPE = "^^SCOPE^^ "
        Public Const APIPUBLIC = "Public "
        Public Const APIPRIVATE = "Private "
        Public Const APITYPE = "<StructLayout(LayoutKind.Sequential)> "
        Public Const APISTRING = "<MarshalAs(UnmanagedType.ByValTStr,SizeConst:=SIZEOFARRAY)>"
        Public Const APISTRUCT = "<MarshalAs(UnmanagedType.Struct)> ByRef "
        Public Const APIARRAY = "<MarshalAs(UnmanagedType.ByValArray,SizeConst:=SIZEOFARRAY)>"
      &n

上一个:用vb.net开发api viewer(3)
下一个:看看这 ( 目录浏览 )

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,