Files
LimitEditor/Union/Form1.vb
2023-10-01 23:07:39 +09:00

110 lines
4.2 KiB
VB.net

Public Class Form1
Dim install, installkey As Long
Dim fn As String
Dim auth As New MyAuth
''' <summary>
''' 인증정보를 읽어옵니다.
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Private Function ReadAuth() As Boolean
If install = 0 OrElse installkey = 0 Then
MsgBox("인증정보가 존재하지 않습니다." & vbCrLf & vbCrLf & "관리자에 문의하세요", MsgBoxStyle.Critical, "확인")
' Process.Start(HomePage)
Return False
End If
If (auth.GetDateNumber(Now)) > install Then
MsgBox("사용기일이 초과되었습니다." & vbCrLf & vbCrLf & "관리자에 문의하세요", MsgBoxStyle.Critical, "확인")
' Process.Start(HomePage)
Return False '//만기일을 초과했다면
End If
If installkey.ToString <> auth.GetDateNumberEnc(install) Then '//인증정보가 손상되었다면
MsgBox("인증정보가 손상되었습니다" & vbCrLf & vbCrLf & "관리자에 문의하세요", MsgBoxStyle.Critical, "확인")
'Process.Start(HomePage)
Return False
End If
Return True
' MsgBox(auth.GetDateNumberEnc(Now))
End Function
Private Sub SetAuth(ByVal NewDate As Date)
Dim auth As New MyAuth
Dim Arinini As New MyINI2(fn)
Arinini.Write("main", "install", auth.GetDateNumber(NewDate))
Arinini.Write("main", "installkey", auth.GetDateNumberEnc(NewDate))
Dim A As New System.Text.StringBuilder
A.AppendLine("인증정보가 파일에 기록되었습니다")
A.AppendLine("파일명 = " & fn)
A.AppendLine("해당파일을 사용자에게 복사,자동패치,수동패치파일 방법을 사용하여")
A.AppendLine("배포를 하면됩니다")
A.AppendLine("------------------")
A.AppendLine("만기일 : " & Me.DateTimePicker1.Value.ToString)
MsgBox(A.ToString, MsgBoxStyle.Information, "기록완료")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'//변경
'//ip가 제대로들어왓는지 확인
'Dim IP() As String = Me.tb_ip.Text.Split(".")
'If IP.Length <> 4 Then
' MsgBox("정상적인 IP주소체계가 아닙니다" & vbCrLf & "아이피는 192.168.0.1 의 형태입니다", MsgBoxStyle.Information, "확인")
' Return
'End If
'Dim ipsum As Short = 0
'For Each a As String In IP
' If IsNumeric(a) = False Then
' MsgBox("각클래스 사이는 숫자로만 입력하세요." & vbCrLf & "아이피는 192.168.0.1 의 형태입니다", MsgBoxStyle.Information, "확인")
' Return
' Else
' ipsum += Val(a) '//아이피를 더한다
' End If
'Next
Dim yymmdd As String = Format(Me.DateTimePicker1.Value.Date, "yyyy-MM-dd 23:59:59")
Dim textenc As New EnDec("HAEGWANGSIMP")
Dim textHash As Integer = yymmdd.GetHashCode()
Me.tb_key1.Text = textenc.EncryptData(yymmdd + "|SIMP|" + yymmdd.GetHashCode().ToString())
Dim Auth As New MyAuth
'If Auth.check_key1(Me.tb_key1.Text) = False Then
'MsgBox("인증번호1생성프로그램 오류", MsgBoxStyle.Critical, "확인")
'End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim bit64 As String = "x86"
If (Environment.Is64BitProcess) Then bit64 = "x64"
Me.Text = $"번호찰 관리프로그램 인증키 생성 (tindevil@nate.com) - {bit64}"
End Sub
'Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
' Dim key2 As String = ""
' For Each C As Control In Me.GroupBox2.Controls
' ' MsgBox(C.GetType.ToString)
' If C.GetType.ToString.ToUpper = "SYSTEM.WINDOWS.FORMS.CHECKBOX" Then '//체크박스만 확인한다.
' If CType(C, CheckBox).Checked Then key2 &= C.Tag.ToString.ToUpper
' End If
' Next
' If key2 = "" Then
' Me.tb_key2.Text = ""
' Else
' Me.tb_key2.Text = key2 & "%" & key2.GetHashCode
' Dim Auth As New MyAuth
' If Auth.Check_key2(Me.tb_key2.Text) = False Then
' MsgBox("인증번호2생성프로그램 오류", MsgBoxStyle.Critical, "확인")
' End If
' End If
'End Sub
End Class