Imports MyControlOLEDBv2
Public Class MyAuth '//각종인증방법을 이용한다.
Public Function GetDateAuth(ByVal 만기일자 As Date) As Boolean '//날짜인증시 사용가능한지
'//사용가능한 날짜인지 확인하고 만약 날짜정보가 없으면은 날짜를 setdataeauth 를 실행합니다
'//인터넷에 연결되어있을시 현재 시간정보를 인터넷에서 받아온ㄷ
'//콘솔의 현재날짜가 설치된 날짜보다 더 뒤일경우 사용중지
'//레지 파일의 기록날짜가 서로다를경우 사용중지
'//레지,파일의 기록날짜가 동일하고 콘솔의 현재날짜가 기한을 넘지않았을경우에만 true 한다.
Dim isAvailable As Boolean = My.Computer.Network.IsAvailable '//인터넷사용여부
Dim CurrentDate As Date
If isAvailable Then '//인터넷에서 날짜정보를 가져온다 기록된 날짜와 오늘의 날짜를 확인한다.
Dim Itime As Date
Try
CurrentDate = Itime
Catch ex As Exception '//에러발생시 콘솔날짜로 세팅한다.
CurrentDate = Now
End Try
Else
MsgBox("인터넷사용불가")
CurrentDate = Now
End If
If 만기일자 > CurrentDate Then Return False
Return True
End Function
Public Sub SetAuth(ByVal Newkey As Long, ByVal Fn As String)
' Dim auth As New ARINCLASS
Dim Arinini As New MyINI2(Fn)
Arinini.Write("main", "install2", Newkey)
Arinini.Write("main", "installkey2", Newkey.GetHashCode)
Dim A As New System.Text.StringBuilder
A.AppendLine("인증정보가 파일에 기록되었습니다")
A.AppendLine("만기일 : " & Date.FromFileTimeUtc(Newkey))
MsgBox(A.ToString, MsgBoxStyle.Information, "기록완료")
End Sub
'''
''' 미지원 함수
'''
'''
'''
Public Function SetDateAuth() As Boolean '//레지와 파일에 해당 인증정보를 기록합니다
Return True
End Function
'''
''' 미지원함수
'''
'''
'''
Public Function GetCurrentDate() As Date '//오늘날짜를 가져옵니다
Return Now
End Function
Public Function GetDateNumber(ByVal 시작일 As Date) As Long
Return 시작일.ToFileTimeUtc
End Function
Public Function GetDateNumberEnc(ByVal 시작일 As Date) As String
Return 시작일.ToFileTimeUtc.ToString.GetHashCode '//날짜로 들어가면 날짜의 해쉬코드를 넘겨준다.
End Function
Public Function GetDateNumberEnc(ByVal 시작일 As Long) As String
Return 시작일.ToString.GetHashCode
End Function
End Class