Skip to content

Commit

Permalink
BUG 修復
Browse files Browse the repository at this point in the history
修復 minecraft 狀態BUG
  • Loading branch information
InterfaceGUI committed Mar 7, 2021
1 parent 6c99fe5 commit fce22c9
Show file tree
Hide file tree
Showing 149 changed files with 185 additions and 2,373 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ bld/

# Visual Studio 2015/2017 cache/options directory
.vs/
**/publish/*
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

Expand Down
65 changes: 59 additions & 6 deletions DiscordGameServersStatus/DiscordGameServersStatus/DGSS.Designer.vb

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

13 changes: 11 additions & 2 deletions DiscordGameServersStatus/DiscordGameServersStatus/DGSS.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,16 @@
<metadata name="UpdataTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>109, 17</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
<metadata name="BackgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>236, 17</value>
</metadata>
<metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>408, 17</value>
</metadata>
<metadata name="SaveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>528, 17</value>
</metadata>
<metadata name="OpenFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>672, 17</value>
</metadata>
</root>
115 changes: 81 additions & 34 deletions DiscordGameServersStatus/DiscordGameServersStatus/DGSS.vb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,36 @@ Public Class DGSS
ComboBox1.SelectedIndex = My.Settings.Timer
MainTimer.Interval = Time(My.Settings.Timer)
Button4.Enabled = False
AddHandler Discord.Ready, AddressOf Ready


If Not My.Settings.WMessage_ServerList Then
My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Exclamation)
MsgBox_ServerList.ShowDialog()
End If
End Sub

Function Ready() As Task
UpdateShowDialog()
End Function
Private Delegate Sub ShowDialogCallBack()
Private Sub UpdateShowDialog()
If Me.InvokeRequired() Then
Dim cb As New ShowDialogCallBack(AddressOf UpdateShowDialog)
Me.Invoke(cb, Nothing)
Else
StartButton.Enabled = True
Label2.Text = "已啟動"
Label2.ForeColor = Drawing.Color.Green
StartButton.Text = "停止"
MainTimer.Enabled = True
Button4.Enabled = True
Button1.Enabled = False
serverlistButton.Enabled = False
End If
End Sub


Private Async Sub StartButton_Click(sender As Object, e As EventArgs) Handles StartButton.Click
If My.Settings.token Is "" Then
MsgBox("請先設定DiscordBot", 0 + 48)
Expand All @@ -45,13 +68,7 @@ Public Class DGSS
Try
Await Discord.LoginAsync(TokenType.Bot, My.Settings.token)
Await Discord.StartAsync
Label2.Text = "已啟動"
Label2.ForeColor = Drawing.Color.Green
StartButton.Text = "停止"
MainTimer.Enabled = True
Button4.Enabled = True
Button1.Enabled = False
serverlistButton.Enabled = False
StartButton.Enabled = False
Catch ex As Exception
Start = False
Label2.Text = "錯誤"
Expand All @@ -62,6 +79,7 @@ Public Class DGSS
Button4.Enabled = False
Button1.Enabled = True
serverlistButton.Enabled = True
StartButton.Enabled = True
End Try
Else
Await Discord.LogoutAsync
Expand All @@ -73,6 +91,7 @@ Public Class DGSS
Button4.Enabled = False
Button1.Enabled = True
serverlistButton.Enabled = True
StartButton.Enabled = True
End If
End Sub

Expand Down Expand Up @@ -148,7 +167,7 @@ Public Class DGSS

If port Is Nothing Then port = 25565
Try
Dim ping As MinecraftServerInfo = MinecraftServerInfo.GetServerInformation(ip, port)
Dim ping As MinecraftServerInfo = MinecraftServerInfo.GetServerInformation(My.Settings.Serversip(i).Split(":")(0), port)
If ping.IsOnline Then

If port Is Nothing Then
Expand Down Expand Up @@ -239,7 +258,45 @@ Public Class DGSS
Return EmbedField
End Function
Dim message As Rest.RestUserMessage = Nothing
Private Async Sub MainTimer_Tick(sender As Object, e As EventArgs) Handles MainTimer.Tick, Button4.Click
Private Sub MainTimer_Tick(sender As Object, e As EventArgs) Handles MainTimer.Tick, Button4.Click
Static C As Int16 = 0
If BackgroundWorker1.IsBusy Then
C += 1
If C = 2 Then
BackgroundWorker1.CancelAsync()
C = 0
End If
Exit Sub
End If
BackgroundWorker1.RunWorkerAsync()

End Sub

Private Sub DisocrdBOT設定_Click(sender As Object, e As EventArgs) Handles Button1.Click
Discordsetting.ShowDialog()
End Sub

Private Sub 伺服器列表_Click(sender As Object, e As EventArgs) Handles serverlistButton.Click
ServerlistForm.ShowDialog()
End Sub

Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
My.Settings.Timer = ComboBox1.SelectedIndex
MainTimer.Interval = Time(ComboBox1.SelectedIndex)
My.Settings.Save()
My.Settings.Reload()
End Sub

Private Async Sub DGSS_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Try
Await Discord.LogoutAsync
Await Discord.StopAsync
Catch ex As Exception
End Try
End Sub

Private Async Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork

Dim embed As EmbedBuilder
Try
embed = New EmbedBuilder With {
Expand All @@ -250,19 +307,18 @@ Public Class DGSS
.Timestamp = Date.UtcNow,
.Footer = New EmbedFooterBuilder With {
.IconUrl = "https://i.imgur.com/UNPFf1f.jpg",
.Text = "BOT made by 科技狼(Tech wolf)"
.Text = "BOT made by 拉斯哈格(LarsHagrid)"
}
}

Catch ex As Exception
MsgBox(ex.Message)

End Try

Try
message = Await Discord.GetGuild(Discord.Guilds(0).Id).GetTextChannel(My.Settings.channel).GetMessageAsync(My.Settings.MessageID)
Catch ex As Exception


End Try

Try
Expand All @@ -278,36 +334,27 @@ Public Class DGSS
End If
Catch ex As Exception


MsgBox(ex.Message)

End Try



End Sub

Private Sub DisocrdBOT設定_Click(sender As Object, e As EventArgs) Handles Button1.Click
Discordsetting.ShowDialog()
End Sub

Private Sub 伺服器列表_Click(sender As Object, e As EventArgs) Handles serverlistButton.Click
ServerlistForm.ShowDialog()
End Sub
Private Sub 儲存設定檔ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 儲存設定檔ToolStripMenuItem.Click

Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
My.Settings.Timer = ComboBox1.SelectedIndex
MainTimer.Interval = Time(ComboBox1.SelectedIndex)
My.Settings.Save()
My.Settings.Reload()
End Sub

Private Async Sub DGSS_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Try
Await Discord.LogoutAsync
Await Discord.StopAsync
Catch ex As Exception
End Try
' Process.Start("explorer.exe", My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData)
Dim R = SaveFileDialog1.ShowDialog()
If R = DialogResult.OK Then
My.Computer.FileSystem.CopyFile(Application.StartupPath & "/DiscordGameServersStatus.exe.config", SaveFileDialog1.FileName)
End If
End Sub

Private Sub 載入設定檔ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 載入設定檔ToolStripMenuItem.Click
Dim R = OpenFileDialog1.ShowDialog()
If R = DialogResult.OK Then
My.Computer.FileSystem.CopyFile(OpenFileDialog1.FileName, Application.StartupPath & "/DiscordGameServersStatus.exe.config", True)
End If

End Sub
End Class
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>true</UpdateRequired>
<MapFileExtensions>false</MapFileExtensions>
<InstallUrl>https://cdn.jsdelivr.net/gh/InterfaceGUI/DiscordGameServersStatus%40master/DiscordGameServersStatus/DiscordGameServersStatus/publish/</InstallUrl>
<UpdateUrl>https://cdn.jsdelivr.net/gh/InterfaceGUI/DiscordGameServersStatus%40master/DiscordGameServersStatus/DiscordGameServersStatus/publish/</UpdateUrl>
<InstallUrl>https://interfacegui.github.io/publish/DGSS/</InstallUrl>
<UpdateUrl>https://interfacegui.github.io/publish/DGSS/</UpdateUrl>
<SupportUrl>https://github.com/InterfaceGUI/DiscordGameServersStatus/issues</SupportUrl>
<ErrorReportUrl>https://github.com/InterfaceGUI/DiscordGameServersStatus/issues</ErrorReportUrl>
<ProductName>DiscordGameServersStatusBot</ProductName>
<PublisherName>科技狼</PublisherName>
<PublisherName>科技狼 %28拉斯哈格%29</PublisherName>
<MinimumRequiredVersion>1.0.0.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<ApplicationRevision>11</ApplicationRevision>
<ApplicationRevision>40</ApplicationRevision>
<ApplicationVersion>1.5.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
Expand Down
Loading

0 comments on commit fce22c9

Please sign in to comment.