【开源项目】花密(Flower Password)VB版之数据库加载模块

来源:互联网 发布:java的脚本语言 编辑:程序博客网 时间:2024/06/05 03:45
'*****************************************************************' Copyright (c) 2011-2012 FlowerPassword.com All rights reserved.'      Author : xLsDg @ Xiao Lu Software Development Group'        Blog : http://hi.baidu.com/xlsdg'          QQ : 4 4 7 4 0 5 7 4 0'     Version : 1 . 0 . 0 . 0'        Date : 2 0 1 2 / 0 4 / 0 7' Description :'     History :'*****************************************************************Option ExplicitPublic strDomains   As StringPublic strPassWords As StringPublic Sub LoadData()    Call LoadDomains    Call LoadPasswordsEnd SubPrivate Function LoadDomains() As Boolean    Dim strPath As String    strPath = App.Path + "\Domains.dat"    ReleaseDataFromRes "DATA", "DOMAINS", strPath    strDomains = ReadDataFromFile(strPath)    Kill strPath    If Len(strDomains) > 0 Then        LoadDomains = True    Else        LoadDomains = False    End IfEnd FunctionPrivate Function LoadPasswords() As Boolean    Dim strPath As String    strPath = App.Path + "\Domains.dat"    ReleaseDataFromRes "DATA", "PASSWORDS", strPath    strPassWords = ReadDataFromFile(strPath)    Kill strPath    If Len(strPassWords) > 0 Then        LoadPasswords = True    Else        LoadPasswords = False    End IfEnd FunctionPrivate Function ReadDataFromFile(ByVal strFilePath As String) As String    If Len(strFilePath) > 0 Then        If Dir$(strFilePath, vbHidden + vbNormal + vbReadOnly + vbSystem) <> "" Then            Dim bytData() As Byte            Open strFilePath For Binary Access Read As #1            ReDim bytData(1 To LOF(1)) As Byte            Get #1, , bytData            Close #1            ReadDataFromFile = StrConv(bytData, vbUnicode)        End If    Else        ReadDataFromFile = vbNullString    End IfEnd FunctionPrivate Function ReleaseDataFromRes(ByVal strType As String, _                                    ByVal strID As String, _                                    ByVal strFilePath As String) As Boolean    If Len(strType) > 0 And Len(strID) > 0 And Len(strFilePath) > 0 Then        If Dir$(strFilePath, vbHidden + vbNormal + vbReadOnly + vbSystem) <> "" Then            Kill strFilePath        End If        Dim bytData() As Byte        bytData = LoadResData(strID, strType)        Open strFilePath For Binary Access Write As #1        Put #1, , bytData        Close #1        ReleaseDataFromRes = True    Else        ReleaseDataFromRes = False    End IfEnd Function


原创粉丝点击