권한 기능 업데이트

This commit is contained in:
Chikyun
2019-05-05 22:25:20 +09:00
parent 750cdf9fd0
commit 3d7b335a06
14 changed files with 206 additions and 274 deletions

View File

@@ -3,7 +3,7 @@
Public NotInheritable Class SplashScreen
Dim install, installkey As Long
Dim auth As New ACC.MyAuth
Dim Runcnt As Integer = 0
'Dim Runcnt As Integer = 0
Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If My.Application.Info.Title <> "" Then
@@ -19,13 +19,30 @@ Public NotInheritable Class SplashScreen
Me.Show() : My.Application.DoEvents()
If Not LoadINI() Then End '//환경파일 불러오기실패시 종료한다.
ReadAuth()
If Command().ToUpper = "ARIN2506" Then
UserInfo.Type = E_AuthType.Admin '//파라미터로 운영자모드 가능하게
If Command() <> "ARIN" AndAlso Not ReadAuth() Then '//에러났을떄는 카운터를 확인
'//사용횟수가 10번ㅇ르 초과했는지 확인
Runcnt = Me.ReadAuthcount
Dim f As New fAuth()
If (f.ShowDialog <> Windows.Forms.DialogResult.OK) Then
End
End If
'If Runcnt >= 10 Then
' Dim NewKey As String = InputBox("인증번호를 입력하세요 (인증번호는 숫자로만 이루어져 있습니다)")
' If IsNumeric(NewKey) = False Then
' MsgBox("프로그램을 재실행 하세요", MsgBoxStyle.Information, "확인")
' End
' End If
' auth.SetAuth(NewKey, My.Application.Info.DirectoryPath & "\epole.ini")
' MsgBox("프로그램을 재실행 하세요", MsgBoxStyle.Information, "확인")
' End
'Else
' MsgBox(CStr(10 - Runcnt) & "번의 사용횟수가 남았습니다", MsgBoxStyle.Critical, "실행확인")
'End If
End If
'If Command().ToUpper = "ARIN2506" Then
' UserInfo.Type = E_AuthType.Admin '//파라미터로 운영자모드 가능하게
'End If
'If Not ReadAuth() Then DemoDlg.ShowDialog()
@@ -36,109 +53,77 @@ Public NotInheritable Class SplashScreen
MakeList.Show()
Me.Dispose()
End Sub
Private Function ReadAuth() As Boolean
'//기능해제 160516
UserInfo.Permission = New Char() {"B"}
UserInfo.Cnt = 1
UserInfo.ExpireDate = Date.Now.AddYears(1)
UserInfo.Type = E_AuthType.Normal
Return True
'//먼저파일에 있는 키를 체크한다.
Dim Key1 As String = ini.Read("main", "key1", "")
Dim key2 As String = ini.Read("main", "key2", "")
Dim KeyCnt As String = ini.Read("main", "keycount", "11" & CStr(11).GetHashCode) '//없으면 최대로한다.
If key2 = "" Then UserInfo.Permission = "A" '//아무것도 없으면 1번메뉴만 실행가능하게한다.
Try
If IsNumeric(KeyCnt.Substring(2)) = False Then
UserInfo.Cnt = 11
UserInfo.Type = E_AuthType.Demo
UserInfo.Permission = "A"
Return False
Private Function ReadAuthcount() As Integer
Dim RunCnt As Integer = 0
Dim ini As New MyINI(My.Application.Info.DirectoryPath & "\epole.ini")
Dim RegDate As String = ini.Read("main", "regdate2", "")
Dim CurDate As String = Me.auth.GetDateNumberEnc(Today.AddDays(-10))
If RegDate = "" Then '//등록일이없으면 10번카운터를 셋팅한다.
RunCnt = 1
ini.Write("main", "reg2", RunCnt) '//1일로한다.
ini.Write("main", "regdate2", Me.auth.GetDateNumberEnc(Today)) '//1일로한다.
Else
'//상요자가 숫자를 임의로 고칠수있으니 설치된 날짜랑 오늘이랑 10일이상차이나면 횟수에상관없이 사용불가로한다.
If CurDate > RegDate Then
MsgBox("프로그램을 사용할 수 없습니다" & vbCrLf & "배포업체에 문의하세요", MsgBoxStyle.Information, "확인")
Return 10
End If
Catch ex As Exception
UserInfo.Cnt = 11
UserInfo.Type = E_AuthType.Demo
UserInfo.Permission = "A"
Return False
End Try
'//둘다비어있으면 데모상태로한다.
If Key1 = "" AndAlso key2 = "" Then
UserInfo.Type = E_AuthType.Demo
If CStr(11).GetHashCode = KeyCnt.Substring(2) Then '//가져온 카운트랑 10이랑같으면 다썻다는 말이다.
UserInfo.Cnt = 11
Else '//아니라면 아직 무료횟수가 남았다는ㄱ다
Dim Cnt As Integer = KeyCnt.Substring(0, 2) '//02 라고치자
Cnt += 1 '//하나증가해서 기록한다.
ini.Write("main", "keycount", Format(Cnt, "00") & Format(Cnt, "00").GetHashCode)
UserInfo.Cnt = Cnt
RunCnt = ini.Read("main", "reg2", 10) '//없으면 10으로한다 즉 사용못하게하겠다는거다
If RunCnt < 10 Then
RunCnt += 1
ini.Write("main", "reg2", RunCnt) '//1일로한다.
End If
Return False
End If
Dim auth As New CEpole.Auth
If Key1.IndexOf("%") = -1 Then Key1 = "0%" & Key1
If Not auth.check_key1(Key1) OrElse Not auth.Check_key2(key2) Then '//키중에 오류가있다면 사용불가로한다.
UserInfo.Cnt = 11
UserInfo.Type = E_AuthType.Demo
UserInfo.Permission = "A"
Return False
End If
'//여기까지왓다면 둘다 정상이란소리다. :
'//IP가 맞는지 확인
Dim Cip() As String = GetFirstIP.Split(".")
Dim Cipsum As Short = 0
Dim IPok As Boolean = False
For Each a As String In Cip
Try
Cipsum += Val(a)
Catch ex As Exception
IPok = True
'//아이피에 문제가잇다 이거는 메일보낸다. 그리고 사용은 가능하게한다.
End Try
Next
'If IPok = False Then
' If Cipsum <> Val(Key1.Split("%")(0)) Then '//인증코드의 아이피의 합과 현재아이피의 합이 틀리다면
' UserInfo.Cnt = 11 '//데모상태로 전환한다.
' UserInfo.Type = E_AuthType.Demo
' UserInfo.Permission = "A"
' Return False
' End If
'End If
'//권한정보셋팅
UserInfo.Permission = key2.Split("%")(0).ToCharArray
Dim k() As String = Key1.Split("%")
'//닐짜비교()
Dim Curdate As Date = Today
Dim UserDate As Date = CDate(k(1).Substring(0, 4) & "-" & k(1).Substring(4, 2) & "-" & k(1).Substring(6, 2))
If Curdate > UserDate Then '//지정된날짜가 오늘보다 컷을경우 즉 기간을 오버했다는것이다. 사용불가이다.
UserInfo.Cnt = 11
UserInfo.Type = E_AuthType.Demo
Return False
Else '//정상사용자이다
UserInfo.ExpireDate = UserDate.ToShortDateString
UserInfo.Type = E_AuthType.Normal
Return True
End If
If RunCnt >= 10 Then Return 10
Return RunCnt
End Function
Private Function ReadAuth() As Boolean
If install = 0 OrElse installkey = 0 Then
' MsgBox("인증정보가 존재하지 않습니다." & vbCrLf & vbCrLf & "홈페이지 [자료실] 에서 인증번호를 확인하세요" & vbCrLf & "062-382-0411" & vbCrLf & Common.HomePage, MsgBoxStyle.Critical, "확인")
'Process.Start(HomePage)
Return False
End If
Dim 현재날짜값 As Long = auth.GetDateNumber(Now)
If 현재날짜값 > install Then
' MsgBox("사용기간이 초과되었습니다." & vbCrLf & vbCrLf & "홈페이지 [자료실] 에서 인증번호를 확인하세요" & vbCrLf & "062-382-0411" & vbCrLf & Common.HomePage, MsgBoxStyle.Critical, "확인")
'Process.Start(HomePage)
Return False '//만기일을 초과했다면
End If
'Dim FI As New System.IO.FileInfo(My.Application.Info.DirectoryPath & "\epole.ini")
'If (auth.GetDateNumber(FI.LastAccessTimeUtc)) > Now.ToFileTimeUtc Then '//설정파일을 접근한 날짜가 오늘보다 크면 즉 오늘이 조작디었을경우다
' ' MsgBox("사용기간이 초과되었습니다." & vbCrLf & vbCrLf & "홈페이지 [자료실] 에서 인증번호를 확인하세요" & vbCrLf & "062-382-0411" & vbCrLf & Common.HomePage, MsgBoxStyle.Critical, "확인")
' 'Process.Start(HomePage)
' Return False '//만기일을 초과했다면
'End If
Dim 해쉬값 As Integer = install.GetHashCode()
If installkey.ToString <> 해쉬값 Then '//인증정보가 손상되었다면
' MsgBox("인증정보가 손상되었습니다" & vbCrLf & vbCrLf & "홈페이지 [자료실] 에서 인증번호를 확인하세요" & vbCrLf & "062-382-0411" & vbCrLf & Common.HomePage, MsgBoxStyle.Critical, "확인")
'Process.Start(HomePage)
Return False
End If
Rundate = Date.FromFileTimeUtc(install)
Return True
' MsgBox(auth.GetDateNumberEnc(Now))
End Function
Private Sub SetAuth(ByVal NewDate As Date)
Dim auth As New ACC.MyAuth
Dim auth As New MyAuth
Dim Arinini As New MyINI(My.Application.Info.DirectoryPath & "\epole.ini")
Arinini.Write("main", "install", auth.GetDateNumber(NewDate))
Arinini.Write("main", "installkey", auth.GetDateNumberEnc(NewDate))
Arinini.Write("main", "install2", auth.GetDateNumber(NewDate))
Arinini.Write("main", "installkey2", auth.GetDateNumberEnc(NewDate))
MsgBox("기록완료")
End Sub
Private Function LoadINI() As Boolean
Me.lb_msg.Text = "환경설정 데이터를 읽어옵니다"
@@ -163,8 +148,8 @@ Public NotInheritable Class SplashScreen
Common.ViewFont.FontName = buf(0)
Common.ViewFont.FontSize = buf(1)
Me.install = Arinini.Read("main", "install", 0)
Me.installkey = Arinini.Read("main", "installkey", 0)
Me.install = Arinini.Read("main", "install2", 0)
Me.installkey = Arinini.Read("main", "installkey2", 0)
buf = Arinini.Read("main", "menufont", "굴림,9").Split(",")
Common.MenuFont.FontName = buf(0)