Skip to content

Commit

Permalink
MentoRUSH 2!
Browse files Browse the repository at this point in the history
  • Loading branch information
CYRO4S committed Nov 21, 2017
1 parent ee4ef53 commit 9178ae9
Show file tree
Hide file tree
Showing 14 changed files with 8,354 additions and 251 deletions.
15 changes: 9 additions & 6 deletions MentoRUSH.sln
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
VisualStudioVersion = 15.0.27004.2009
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "MentoRUSH", "MentoRUSH\MentoRUSH.vbproj", "{B2D1D51D-EA31-459C-AA52-5CE3018602C2}"
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "MentoRUSH", "MentoRUSH\MentoRUSH.vbproj", "{45BD4E05-44FE-4C8A-89D9-2B015E0F4A20}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B2D1D51D-EA31-459C-AA52-5CE3018602C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2D1D51D-EA31-459C-AA52-5CE3018602C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2D1D51D-EA31-459C-AA52-5CE3018602C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2D1D51D-EA31-459C-AA52-5CE3018602C2}.Release|Any CPU.Build.0 = Release|Any CPU
{45BD4E05-44FE-4C8A-89D9-2B015E0F4A20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45BD4E05-44FE-4C8A-89D9-2B015E0F4A20}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45BD4E05-44FE-4C8A-89D9-2B015E0F4A20}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45BD4E05-44FE-4C8A-89D9-2B015E0F4A20}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8F743873-F785-4410-BD7C-AD00BA748E41}
EndGlobalSection
EndGlobal

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
88 changes: 88 additions & 0 deletions MentoRUSH/Forms/AutoForm.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Imports System.ComponentModel

Public Class AutoForm

Private Sub AutoForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If Not IO.File.Exists(Application.StartupPath & "\MentoRUSH.settings") Then
GuideForm.Show()
Me.Close()
End If

bgwMain.RunWorkerAsync()
End Sub

Private Sub bgwMain_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles bgwMain.DoWork

Dim pro8021x() As Process = Process.GetProcessesByName("8021x")
If pro8021x.Length > 0 Then
bgwMain.ReportProgress(0, "关闭 8021x.exe...")
pro8021x(0).Kill()
End If

Dim proMento() As Process = Process.GetProcessesByName("MentoHUST")
If proMento.Length > 0 Then
bgwMain.ReportProgress(0, "关闭 MentoHUST.exe...")
proMento(0).Kill()
End If

bgwMain.ReportProgress(1, "启动锐捷...")
bgwMain.ReportProgress(2, 20)
Dim strRJPath As String = INIGet("General", "RJPath", "", Application.StartupPath & "\MentoRUSH.settings")
bgwMain.ReportProgress(0, $"锐捷主程序位置:{strRJPath}")
bgwMain.ReportProgress(0, $"启动 RuijieSupplicant.exe...")
Shell(strRJPath, AppWinStyle.MinimizedNoFocus, False)
Threading.Thread.Sleep(3000)

bgwMain.ReportProgress(1, "检测网络连接...")
bgwMain.ReportProgress(2, 40)
Dim req As New Net.WebClient
Dim Res As String = ""
TestInternet:
Try
bgwMain.ReportProgress(0, "访问 http://d.ralf.ren/resources/portal.php...")
Res = req.DownloadString("http://d.ralf.ren/resources/portal.php")
Catch ex As Exception
Res = ""
bgwMain.ReportProgress(0, $"连线失败,将于三秒后重试:{ex.Message}")
Threading.Thread.Sleep(3000)
End Try
If Not Res = "success" Then
bgwMain.ReportProgress(0, $"得到了不正确的返回结果,将于三秒后重试。")
Threading.Thread.Sleep(3000)
GoTo TestInternet
End If

bgwMain.ReportProgress(0, "得到了正确的返回结果:success")
bgwMain.ReportProgress(0, "已建立互联网连接。")

bgwMain.ReportProgress(1, "启动 MentoHUST...")
bgwMain.ReportProgress(2, 60)
bgwMain.ReportProgress(0, "启动 MentoHUST.exe...")
Shell(Application.StartupPath & "\Assets\MentoHUST.exe", AppWinStyle.MinimizedNoFocus, False)
Threading.Thread.Sleep(2000)

bgwMain.ReportProgress(1, "中止锐捷主进程...")
bgwMain.ReportProgress(2, 90)
bgwMain.ReportProgress(0, "关闭 8021x.exe...")
Dim proRJ() As Process = Process.GetProcessesByName("8021x")
If proRJ.Length > 0 Then
proRJ(0).Kill()
End If

bgwMain.ReportProgress(1, "完成。")
bgwMain.ReportProgress(2, 100)
bgwMain.ReportProgress(0, "完成。")

End Sub

Private Sub bgwMain_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles bgwMain.ProgressChanged
Select Case e.ProgressPercentage
Case 0
txtInfo.Text = txtInfo.Text & e.UserState & vbCrLf
Case 1
lblTitle.Text = e.UserState
Case 2
proMain.Value = e.UserState
End Select
End Sub
End Class
Loading

0 comments on commit 9178ae9

Please sign in to comment.