Skip to content

Commit

Permalink
v1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
OnCloud125252 committed Sep 7, 2022
1 parent bef87d7 commit a060ebf
Show file tree
Hide file tree
Showing 15 changed files with 378 additions and 181 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

Releases

# User-specific files
*.rsuser
*.suo
Expand Down
2 changes: 0 additions & 2 deletions KILLTWG.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
KILLTWG|Any CPU = KILLTWG|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5CDBA091-99D7-41B4-B53A-B53B8457DAAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5CDBA091-99D7-41B4-B53A-B53B8457DAAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5CDBA091-99D7-41B4-B53A-B53B8457DAAA}.KILLTWG|Any CPU.ActiveCfg = Release|Any CPU
{5CDBA091-99D7-41B4-B53A-B53B8457DAAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5CDBA091-99D7-41B4-B53A-B53B8457DAAA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
Expand Down
18 changes: 13 additions & 5 deletions KILLTWG/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup><requestedExecutionLevel level="asInvoker" uiAccess="false" />
</configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
10 changes: 10 additions & 0 deletions KILLTWG/ApplicationEvents.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Namespace My
' MyApplication 可以使用下列事件:
' Startup:在應用程式啟動時,但尚未建立啟動表單之前引發。
' Shutdown:在所有應用程式表單關閉之後引發。如果應用程式不正常終止,就不會引發此事件。
' UnhandledException:在應用程式發生未處理的例外狀況時引發。
' StartupNextInstance:在啟動單一執行個體應用程式且應用程式已於使用中時引發。
' NetworkAvailabilityChanged:在建立或中斷網路連線時引發。
Partial Friend Class MyApplication
End Class
End Namespace
66 changes: 0 additions & 66 deletions KILLTWG/Form1.vb

This file was deleted.

22 changes: 12 additions & 10 deletions KILLTWG/Form1.Designer.vb → KILLTWG/KILLTWG.Designer.vb

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

File renamed without changes.
100 changes: 100 additions & 0 deletions KILLTWG/KILLTWG.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
Imports System.IO
Imports System.Net

Public Class KILLTWG_form
Private Sub Setup() Handles Me.Activated
KILLTWGver_linklabel.Text = AppVersion()
StatusValue()
End Sub
Function AppVersion()
Try
Dim request As HttpWebRequest = WebRequest.Create("https://api.github.com/repos/Anonymous-AAAA/KILLTWG-App/releases/latest")
request.Method = "GET"
request.UserAgent = "request"
Dim response As WebResponse = request.GetResponse()
Dim dataStream = response.GetResponseStream()
Dim reader As New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
reader.Close()
dataStream.Close()
response.Close()
Return Mid(responseFromServer, InStr(responseFromServer, """tag_name""") + 12, InStr(responseFromServer, """target_commitish""") - InStr(responseFromServer, """tag_name""") - 14)
Catch ex As Exception
Return "Can't get latest version"
Exit Try
End Try
End Function

Public Sub StatusValue()
If Process.GetProcessesByName("REDAgent").Count > 0 Then
StatusValue_label.Text = "ON"
StatusValue_label.ForeColor = Color.Green
Else
StatusValue_label.Text = "OFF"
StatusValue_label.ForeColor = Color.Red
End If
End Sub
Private Sub KILL_Click(sender As Object, e As EventArgs) Handles KILL_button.Click
Try
Dim dir = My.Computer.FileSystem.GetDirectories("C:\Program Files (x86)\TWG")(0)
My.Computer.FileSystem.RenameDirectory(dir, "Classroom")
Catch ex As Exception
Exit Try
End Try
Try
If Process.GetProcessesByName("REDAgent").Count > 0 Then
For Each proc As Process In Process.GetProcessesByName("REDAgent")
proc.Kill()
Next
Threading.Thread.Sleep(100)
StatusValue()
Else
StatusValue_label.Text = "OFF"
StatusValue_label.ForeColor = Color.Red
End If
Catch ex As Exception
Exit Try
End Try
End Sub

Private Sub RESUME_button_Click(sender As Object, e As EventArgs) Handles RESUME_button.Click
Try
Dim dir = My.Computer.FileSystem.GetDirectories("C:\Program Files (x86)\TWG")(0)
My.Computer.FileSystem.RenameDirectory(dir, "eClassroom")
Catch ex As Exception
Exit Try
End Try
Threading.Thread.Sleep(200)
Try
If Process.GetProcessesByName("REDAgent").Count = 0 Then
Dim redagent As New ProcessStartInfo With {
.FileName = "C:\Program Files (x86)\TWG\eClassroom\REDAgent.exe"
}
Dim redagentStats = Process.Start(redagent)
Threading.Thread.Sleep(100)
StatusValue()
Else
StatusValue_label.Text = "ON"
StatusValue_label.ForeColor = Color.Green
End If
Catch ex As Exception
Exit Try
End Try
End Sub

Private Sub KILLTWGver_linklabel_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles KILLTWGver_linklabel.LinkClicked
If AppVersion() <> "Can't get latest version" Then
Process.Start("https://github.com/Anonymous-AAAA/KILLTWG-App/releases/tag/" + AppVersion())
Else
Process.Start("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
End If
End Sub

Private Sub WrittenBy_linklabel_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles WrittenBy_linklabel.LinkClicked
Process.Start("https://github.com/Anonymous-AAAA")
End Sub

Private Sub GithubRepo_linklabel_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles GithubRepo_linklabel.LinkClicked
Process.Start("https://github.com/Anonymous-AAAA/KILLTWG-App")
End Sub
End Class
Loading

0 comments on commit a060ebf

Please sign in to comment.