我一直收到错误Conversion from string "" to type 'Double' is not valid
。我知道这意味着我试图将任何内容转换为整数并且编译器不喜欢它,但是我无法在程序中找到它,因为它只发生在我构建程序而不是在调试中。对不起,我无法提供更多信息。
Imports System.IO
Imports System.Text
Public Class frmindex
'Variables
Dim addworld As String
Dim root As String
Dim allownether As String
Dim pvp As String
Dim whitelist As String
Dim spawnmonsters As String
Dim onlinemode As String
Dim spawnanimals As String
Dim bit As String
Dim allowflight As String
Dim launch As String
Dim serverfile As String
Dim safeserverfile As String
Dim ram As ULong
Dim halfram As Integer
Dim serverapplication As String
Dim filter As String
Private Sub frmindex_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Finds Half of the ram of the computer and -1
ram = My.Computer.Info.TotalPhysicalMemory
halfram = ((ram / "1,048,576") / "2") - "1"
nudram.Maximum = halfram
If nudram.Value = "" Or "1024" Then
nudram.Value = halfram
End If
If txbserverfile.Text = "" Then
txbserverfile.Text = CurDir() + "\" + serverapplication
End If
If cmbserverapplication.Text = "Exe Server" Then
serverapplication = "minecraft_server.exe"
lblram.Visible = False
nudram.Visible = False
filter = "Exe Server|*.exe|All Files|*.*"
ElseIf cmbserverapplication.Text = "Jar Server" Then
serverapplication = "minecraft_server.jar"
lblram.Visible = True
nudram.Visible = True
filter = "Jar Server|*.jar|All Files|*.*"
ElseIf cmbserverapplication.Text = "Bukkit Server" Then
serverapplication = "craftbukkit-0.0.1-SNAPSHOT.jar"
lblram.Visible = False
nudram.Visible = False
filter = "Bukkit Server|*.jar|All Files|*.*"
End If
If nudviewdistance.Text = "" Then
nudviewdistance.Text = "10"
End If
'finds load files
If cmbserverapplication.Text = "Exe Server" Then
lblram.Visible = False
nudram.Visible = False
ElseIf cmbserverapplication.Text = "Jar Server" Then
lblram.Visible = True
nudram.Visible = True
ElseIf cmbserverapplication.Text = "Bukkit Server" Then
lblram.Visible = False
nudram.Visible = False
End If
'Checks if save folder exists if not creates one
If (Not System.IO.Directory.Exists(root + "\setting")) Then
System.IO.Directory.CreateDirectory(root + "\setting")
End If
'loads world settings
If File.Exists(root + "\setting\world.txt") Then
For Each line As String In File.ReadLines(root + "\setting\world.txt")
If line.Length <> 0 Then
cmbworld.Items.Add(line)
End If
Next line
End If
'loads ip
If File.Exists(root + "\setting\ip.txt") Then
For Each line As String In File.ReadLines(root + "\setting\ip.txt")
If line.Length <> 0 Then
cmbip.Items.Add(line)
End If
Next line
End If
'loads levelseed
If File.Exists(root + "\setting\levelseed.txt") Then
For Each line As String In File.ReadLines(root + "\setting\levelseed.txt")
If line.Length <> 0 Then
cmblevelseed.Items.Add(line)
End If
Next line
End If
If File.Exists(root + "\banned-players.txt") Then
For Each line As String In File.ReadLines(root + "\banned-players.txt")
If line.Length <> 0 Then
cmbbannedplayers.Items.Add(line)
End If
Next line
End If
If File.Exists(root + "\banned-ips.txt") Then
For Each line As String In File.ReadLines(root + "\banned-ips.txt")
If line.Length <> 0 Then
cmbbannedips.Items.Add(line)
End If
Next line
End If
If File.Exists(root + "\ops.txt") Then
For Each line As String In File.ReadLines(root + "\ops.txt")
If line.Length <> 0 Then
cmbops.Items.Add(line)
End If
Next line
End If
If File.Exists(root + "\white-list.txt") Then
For Each line As String In File.ReadLines(root + "\white-list.txt")
If line.Length <> 0 Then
cmbwhitelist.Items.Add(line)
End If
Next line
End If
End Sub
Private Sub btnlaunch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlaunch.Click
If System.IO.Directory.Exists(root + "\setting") = True Then
Else
System.IO.Directory.CreateDirectory(root + "\setting")
End If
Dim sbcmbworld As New StringBuilder()
For Each item As Object In cmbworld.Items
sbcmbworld.AppendFormat("{0} {1}", item, Environment.NewLine)
Next
Dim cmbworldsave As String = root + "\setting\world.txt"
If System.IO.File.Exists(cmbworldsave) = True Then
Else
System.IO.File.Create(root + "\setting\world.txt").Dispose()
End If
Dim worldWriter As New System.IO.StreamWriter(cmbworldsave)
worldWriter.Write(sbcmbworld.ToString()) 'Use the stringbuilder here
worldWriter.WriteLine()
worldWriter.Close()
Dim sbcmbip As New StringBuilder()
For Each item As Object In cmbworld.Items
sbcmbip.AppendFormat("{0} {1}", item, Environment.NewLine)
Next
Dim cmbipsave As String = root + "\setting\ip.txt"
If System.IO.File.Exists(cmbworldsave) = True Then
Else
System.IO.File.Create(root + "\setting\ip.txt").Dispose()
End If
Dim ipwriter As New System.IO.StreamWriter(cmbipsave)
ipwriter.Write(sbcmbip.ToString()) 'Use the stringbuilder here
ipwriter.WriteLine()
ipwriter.Close()
Dim sbcmblevelseed As New StringBuilder()
For Each item As Object In cmbworld.Items
sbcmbip.AppendFormat("{0} {1}", item, Environment.NewLine)
Next
Dim cmblevelseedsave As String = root + "\setting\levelseed.txt"
If System.IO.File.Exists(cmbworldsave) = True Then
Else
System.IO.File.Create(root + "\setting\levelseed.txt").Dispose()
End If
Dim levelseedWriter As New System.IO.StreamWriter(cmbipsave)
levelseedWriter.Write(sbcmblevelseed.ToString()) 'Use the stringbuilder here
levelseedWriter.WriteLine()
levelseedWriter.Close()
Dim sbcmbbannedplayers As New StringBuilder()
For Each item As Object In cmbbannedplayers.Items
sbcmbbannedplayers.AppendFormat("{0} {1}", item, Environment.NewLine)
Dim cmbbannedplayerssave As String = root + "\banned-players.txt"
If System.IO.File.Exists(cmbbannedplayerssave) = True Then
Else
System.IO.File.Create(cmbbannedplayerssave).Dispose()
End If
Dim bannedplayersWriter As New System.IO.StreamWriter(cmbbannedplayerssave)
bannedplayersWriter.Write(sbcmbbannedplayers.ToString()) 'Use the stringbuilder here
bannedplayersWriter.WriteLine()
bannedplayersWriter.Close()
Next
Dim sbcmbbannedips As New StringBuilder()
For Each item As Object In cmbbannedips.Items
sbcmbbannedips.AppendFormat("{0} {1}", item, Environment.NewLine)
Dim cmbbannedipssave As String = root + "\banned-ips.txt"
If System.IO.File.Exists(cmbbannedipssave) = True Then
Else
System.IO.File.Create(cmbbannedipssave).Dispose()
End If
Dim bannedipsWriter As New System.IO.StreamWriter(cmbbannedipssave)
bannedipsWriter.Write(sbcmbbannedips.ToString()) 'Use the stringbuilder here
bannedipsWriter.WriteLine()
bannedipsWriter.Close()
Next
Dim sbcmbops As New StringBuilder()
For Each item As Object In cmbops.Items
sbcmbops.AppendFormat("{0} {1}", item, Environment.NewLine)
Dim cmbopssave As String = root + "\ops.txt"
If System.IO.File.Exists(cmbopssave) = True Then
Else
System.IO.File.Create(cmbopssave).Dispose()
End If
Dim opsWriter As New System.IO.StreamWriter(cmbopssave)
opsWriter.Write(sbcmbops.ToString()) 'Use the stringbuilder here
opsWriter.WriteLine()
opsWriter.Close()
Next
Dim sbcmbwhitelist As New StringBuilder()
For Each item As Object In cmbwhitelist.Items
sbcmbwhitelist.AppendFormat("{0} {1}", item, Environment.NewLine)
Dim cmbwhitelistsave As String = root + "\white-list.txt"
If System.IO.File.Exists(cmbwhitelistsave) = True Then
Else
System.IO.File.Create(cmbwhitelistsave).Dispose()
End If
Dim whitelistWriter As New System.IO.StreamWriter(cmbwhitelistsave)
whitelistWriter.Write(sbcmbwhitelist.ToString()) 'Use the stringbuilder here
whitelistWriter.WriteLine()
whitelistWriter.Close()
Next
If System.IO.File.Exists(root + "\server.properties") = True Then
Else
System.IO.File.Create(root + "\server.properties").Dispose()
End If
If cmbip.Text = "Lan" Then
cmbip.Text = ""
End If
If cmblevelseed.Text = "None" Then
cmblevelseed.Text = ""
End If
Dim propertyWriter As New System.IO.StreamWriter(root + "\server.properties")
propertyWriter.Write("#ServerCraft, Created By Bradley Smithies - Kuzon")
propertyWriter.WriteLine("")
propertyWriter.Write("#Minecraft server properties")
propertyWriter.WriteLine("")
propertyWriter.Write("#Created: " + DateTime.Now.ToLongDateString + " at " + DateTime.Now.ToLongTimeString)
propertyWriter.WriteLine("")
propertyWriter.WriteLine("")
propertyWriter.Write("level-name=" + cmbworld.Text)
propertyWriter.WriteLine("")
propertyWriter.Write("allow-nether=" + allownether)
propertyWriter.WriteLine("")
propertyWriter.Write("view-distance=" + nudviewdistance.Text)
propertyWriter.WriteLine("")
propertyWriter.Write("spawn-monsters=" + spawnmonsters)
propertyWriter.WriteLine("")
propertyWriter.Write("online-mode=" + onlinemode)
propertyWriter.WriteLine("")
propertyWriter.Write("spawn-monsters=" + spawnmonsters)
propertyWriter.WriteLine("")
propertyWriter.Write("max-players=" + nudmaxplayers.Text)
propertyWriter.WriteLine("")
propertyWriter.Write("server-ip=" + cmbip.Text)
propertyWriter.WriteLine("")
propertyWriter.Write("pvp=" + pvp)
propertyWriter.WriteLine("")
propertyWriter.Write("level-seed=" + cmblevelseed.Text)
propertyWriter.WriteLine("")
propertyWriter.Write("server-port=" + txbseverport.Text)
propertyWriter.WriteLine("")
propertyWriter.Write("allow-flight=" + allowflight)
propertyWriter.WriteLine("")
propertyWriter.Write("white-list=" + whitelist)
propertyWriter.WriteLine("")
propertyWriter.Close()
If cmbip.Text = "" Then
cmbip.Text = "Lan"
End If
If cmblevelseed.Text = "" Then
cmblevelseed.Text = "None"
End If
If cbxlaunch.Checked Then
Dim serverpath As String
If cmbserverapplication.Text = "Jar Server" Then
If System.IO.File.Exists(serverfile) = True Then
If Environment.Is64BitOperatingSystem = True Then
bit = "64"
Else
bit = "32"
End If
Dim javapath As String
Dim launchcode As String
If bit = 64 Then
If System.IO.File.Exists("C:\Program Files (x86)\Java\jre7\bin\java.exe") = True Then
javapath = "C:\Program Files (x86)\Java\jre7\bin\java.exe"
Else
javapath = "C:\Program Files (x86)\Java\jre6\bin\java.exe"
End If
Else
If System.IO.File.Exists("C:\Program Files\Java\jre7\bin\java.exe") = True Then
javapath = "C:\Program Files\Java\jre7\bin\java.exe"
Else
javapath = "C:\Program Files\Java\jre6\bin\java.exe"
End If
End If
launchcode = "-Xmx" + nudram.Value + "M -Xms" + nudram.Value + "M -jar " + safeserverfile + " nogui"
' Dim pi As New ProcessStartInfo(javapath)
' pi.Arguments = launchcode
' Process.Start(pi)
Dim jarbatchserver As String = (root + "\runbjarbatchserver.bat")
If System.IO.File.Exists(jarbatchserver) = True Then
Else
System.IO.File.Create(jarbatchserver).Dispose()
End If
Dim jarbatchwriter As New System.IO.StreamWriter(jarbatchserver)
If cbxechooff.Checked = True Then
jarbatchwriter.Write("@ECHO OFF")
jarbatchwriter.WriteLine("")
End If
jarbatchwriter.Write("""" + javapath + """" + " " + launchcode)
jarbatchwriter.WriteLine("")
jarbatchwriter.Write("pause")
jarbatchwriter.WriteLine("")
jarbatchwriter.Close()
System.Diagnostics.Process.Start(jarbatchserver)
Me.Close()
Else
MsgBox("The server file does not exist. Please make sure that you have select the right file type and that it has not been renamed.")
End If
ElseIf cmbserverapplication.Text = "Exe Server" Then
If System.IO.File.Exists(serverfile) = True Then
Dim startInfo As System.Diagnostics.ProcessStartInfo
Dim pStart As New System.Diagnostics.Process
startInfo = New System.Diagnostics.ProcessStartInfo(serverfile)
pStart.StartInfo = startInfo
pStart.Start()
Me.Close()
Else
MsgBox("The server file does not exist. Please make sure that you have select the right file type and that it has not been renamed.")
End If
ElseIf cmbserverapplication.Text = "Bukkit Server" Then
If System.IO.File.Exists(serverfile) = True Then
If Environment.Is64BitOperatingSystem = True Then
bit = "64"
Else
bit = "32"
End If
serverpath = "craftbukkit-0.0.1-SNAPSHOT.jar"
Dim javapath As String
If bit = 64 Then
If System.IO.File.Exists("C:\Program Files (x86)\Java\jre7\bin\java.exe") = True Then
javapath = "C:\Program Files (x86)\Java\jre7\bin\java.exe"
Else
javapath = "C:\Program Files (x86)\Java\jre6\bin\java.exe"
End If
Else
If System.IO.File.Exists("C:\Program Files\Java\jre7\bin\java.exe") = True Then
javapath = "C:\Program Files\Java\jre7\bin\java.exe"
Else
javapath = "C:\Program Files\Java\jre6\bin\java.exe"
End If
End If
Dim bukkitbatchserver As String = (root + "\runbukkitbatchserver.bat")
If System.IO.File.Exists(bukkitbatchserver) = True Then
Else
System.IO.File.Create(bukkitbatchserver).Dispose()
End If
Dim bukkitbatchwriter As New System.IO.StreamWriter(bukkitbatchserver)
If cbxechooff.Checked = True Then
bukkitbatchwriter.Write("@ECHO OFF")
bukkitbatchwriter.WriteLine("")
End If
bukkitbatchwriter.Write("SET BINDIR=%~dp0")
bukkitbatchwriter.WriteLine("")
bukkitbatchwriter.Write("CD /D ""%BINDIR%""")
bukkitbatchwriter.WriteLine("")
bukkitbatchwriter.Write("""" + javapath + """" + " -Xincgc -Xmx1G -jar " + safeserverfile)
bukkitbatchwriter.WriteLine("")
bukkitbatchwriter.Write("pause")
bukkitbatchwriter.Close()
System.Diagnostics.Process.Start(bukkitbatchserver)
Me.Close()
Else
MsgBox("The server file does not exist. Please make sure that you have select the right file type and that it has not been renamed.")
End If
End If
Else
MsgBox("Properties Changed")
End If
End Sub
Private Sub btnaddworld_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnaddworld.Click
If Not cmbworld.Text = "" Then
cmbworld.Items.Add(cmbworld.Text)
cmbworld.Text = ""
End If
For i As Int16 = 0 To Me.cmbworld.Items.Count - 2
For j As Int16 = Me.cmbworld.Items.Count - 1 To i + 1 Step -1
If Me.cmbworld.Items(i).ToString = Me.cmbworld.Items(j).ToString Then
Me.cmbworld.Items.RemoveAt(j)
End If
Next
Next
End Sub
Private Sub btnremoveworld_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnremoveworld.Click
cmbworld.Items.Remove(cmbworld.Text)
cmbworld.Text = ""
End Sub
Private Sub btnaddip_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnaddip.Click
If Not cmbip.Text = "" Then
cmbip.Items.Add(cmbip.Text)
cmbip.Text = ""
End If
For i As Int16 = 0 To Me.cmbip.Items.Count - 2
For j As Int16 = Me.cmbip.Items.Count - 1 To i + 1 Step -1
If Me.cmbip.Items(i).ToString = Me.cmbip.Items(j).ToString Then
Me.cmbip.Items.RemoveAt(j)
End If
Next
Next
End Sub
Private Sub btnremoveip_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnremoveip.Click
If Not cmbip.Text = "Lan" Then
cmbip.Items.Remove(cmbip.Text)
cmbip.Text = ""
End If
End Sub
Private Sub btnaddlevelseed_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnaddlevelseed.Click
If Not cmblevelseed.Text = "" Then
cmblevelseed.Items.Add(cmblevelseed.Text)
cmblevelseed.Text = ""
For i As Int16 = 0 To Me.cmblevelseed.Items.Count - 2
For j As Int16 = Me.cmblevelseed.Items.Count - 1 To i + 1 Step -1
If Me.cmblevelseed.Items(i).ToString = Me.cmblevelseed.Items(j).ToString Then
Me.cmblevelseed.Items.RemoveAt(j)
End If
Next
Next
End If
End Sub
Private Sub btnremovelevelseed_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnremovelevelseed.Click
If Not cmbip.Text = "none" Then
cmblevelseed.Items.Remove(cmblevelseed.Text)
cmblevelseed.Text = ""
End If
End Sub
Private Sub cbxwhitelist_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbxwhitelist.CheckedChanged
If cbxwhitelist.Checked Then
lblwhitelist.Visible = True
cmbwhitelist.Visible = True
btnaddwhitelist.Visible = True
btnremovewhitelist.Visible = True
Else
lblwhitelist.Visible = False
cmbwhitelist.Visible = False
btnaddwhitelist.Visible = False
btnremovewhitelist.Visible = False
End If
End Sub
Private Sub btnaddbannedplayers_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnaddbannedplayers.Click
If Not cmbbannedplayers.Text = "" Then
cmbbannedplayers.Items.Add(cmbbannedplayers.Text)
cmbbannedplayers.Text = ""
For i As Int16 = 0 To Me.cmbbannedplayers.Items.Count - 2
For j As Int16 = Me.cmbbannedplayers.Items.Count - 1 To i + 1 Step -1
If Me.cmbbannedplayers.Items(i).ToString = Me.cmbbannedplayers.Items(j).ToString Then
Me.cmbbannedplayers.Items.RemoveAt(j)
End If
Next
Next
End If
End Sub
Private Sub btnremovebannedplayers_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnremovebannedplayers.Click
cmbbannedplayers.Items.Remove(cmbbannedplayers.Text)
cmbbannedplayers.Text = ""
End Sub
Private Sub btnaddbannedips_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnaddbannedips.Click
If Not cmbbannedips.Text = "" Then
cmbbannedips.Items.Add(cmbbannedips.Text)
cmbbannedips.Text = ""
For i As Int16 = 0 To Me.cmbbannedips.Items.Count - 2
For j As Int16 = Me.cmbbannedips.Items.Count - 1 To i + 1 Step -1
If Me.cmbbannedips.Items(i).ToString = Me.cmbbannedips.Items(j).ToString Then
Me.cmbbannedips.Items.RemoveAt(j)
End If
Next
Next
End If
End Sub
Private Sub lblremovebannedips_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblremovebannedips.Click
cmbbannedips.Items.Remove(cmbbannedips.Text)
cmbbannedips.Text = ""
End Sub
Private Sub btnaddops_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnaddops.Click
If Not cmbops.Text = "" Then
cmbops.Items.Add(cmbops.Text)
cmbops.Text = ""
For i As Int16 = 0 To Me.cmbops.Items.Count - 2
For j As Int16 = Me.cmbops.Items.Count - 1 To i + 1 Step -1
If Me.cmbops.Items(i).ToString = Me.cmbops.Items(j).ToString Then
Me.cmbops.Items.RemoveAt(j)
End If
Next
Next
End If
End Sub
Private Sub btnremoveops_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnremoveops.Click
cmbops.Items.Remove(cmbops.Text)
cmbops.Text = ""
End Sub
Private Sub btnaddwhitelist_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnaddwhitelist.Click
If Not cmbwhitelist.Text = "" Then
cmbwhitelist.Items.Add(cmbwhitelist.Text)
cmbwhitelist.Text = ""
For i As Int16 = 0 To Me.cmbwhitelist.Items.Count - 2
For j As Int16 = Me.cmbwhitelist.Items.Count - 1 To i + 1 Step -1
If Me.cmbwhitelist.Items(i).ToString = Me.cmbwhitelist.Items(j).ToString Then
Me.cmbwhitelist.Items.RemoveAt(j)
End If
Next
Next
End If
End Sub
Private Sub btnremovewhitelist_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnremovewhitelist.Click
cmbwhitelist.Items.Remove(cmbwhitelist.Text)
cmbwhitelist.Text = ""
End Sub
Private Sub cmbip_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbip.SelectedIndexChanged
If cmbip.Text = "Lan" Then
cbxonlinemode.Checked = False
End If
End Sub
Private Sub cbxonlinemode_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbxonlinemode.CheckedChanged
If cmbip.Text = "Lan" Then
If cbxonlinemode.Checked Then
cbxonlinemode.Checked = False
MsgBox("If you would like to run your server in online mode then please enter an ip other than the Lan option")
End If
End If
End Sub
Private Sub txbroot_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
cmbbannedplayers.Items.Clear()
cmbip.Items.Clear()
cmbbannedips.Items.Clear()
cmbops.Items.Clear()
If File.Exists(root + "\banned-players.txt") Then
For Each line As String In File.ReadLines(root + "\banned-players.txt")
If line.Length <> 0 Then
cmbbannedplayers.Items.Add(line)
End If
Next line
End If
If File.Exists(root + "\banned-ips.txt") Then
For Each line As String In File.ReadLines(root + "\banned-ips.txt")
If line.Length <> 0 Then
cmbbannedips.Items.Add(line)
End If
Next line
End If
If File.Exists(root + "\ops.txt") Then
For Each line As String In File.ReadLines(root + "\ops.txt")
If line.Length <> 0 Then
cmbops.Items.Add(line)
End If
Next line
End If
If File.Exists(root + "\white-list.txt") Then
For Each line As String In File.ReadLines(root + "\white-list.txt")
If line.Length <> 0 Then
cmbwhitelist.Items.Add(line)
End If
Next line
End If
End Sub
Private Sub btnserverfilebrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnserverfilebrowse.Click
Dim ofdserverfile As New OpenFileDialog
'Dialog
With ofdserverfile
.Title = "Please Select Server File"
' Desktop is the root folder in the dialog.
.InitialDirectory = root
.Filter = filter
' Prompt the user with a custom message.
root = .FileName
If .ShowDialog = DialogResult.OK Then
serverfile = .FileName
safeserverfile = .SafeFileName
txbserverfile.Text = serverfile
root = Path.GetDirectoryName(serverfile)
End If
End With
End Sub
Private Sub cmbserverapplication_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbserverapplication.SelectedIndexChanged
If cmbserverapplication.Text = "Exe Server" Then
serverapplication = "minecraft_server.exe"
lblram.Visible = False
nudram.Visible = False
filter = "Exe Server|*.exe|All Files|*.*"
ElseIf cmbserverapplication.Text = "Jar Server" Then
serverapplication = "minecraft_server.jar"
lblram.Visible = True
nudram.Visible = True
filter = "Jar Server|*.jar|All Files|*.*"
ElseIf cmbserverapplication.Text = "Bukkit Server" Then
serverapplication = "craftbukkit-0.0.1-SNAPSHOT.jar"
lblram.Visible = False
nudram.Visible = False
filter = "Bukkit Server|*.jar|All Files|*.*"
End If
Dim CurrrentDirectory As String = CurDir.ToString
If txbserverfile.Text = "" Or txbserverfile.Text = CurDir.ToString + "\minecraft_server.exe" Or txbserverfile.Text = CurDir.ToString + "\minecraft_server.jar" Or txbserverfile.Text = CurDir.ToString + "\craftbukkit-0.0.1-SNAPSHOT.jar" Then
txbserverfile.Text = CurDir.ToString + "\" + serverapplication
End If
End Sub
End Class
答案 0 :(得分:2)
而不是
halfram = ((ram / "1,048,576") / "2") - "1"
nudram.Maximum = halfram
If nudram.Value = "" Or "1024" Then
nudram.Value = halfram
End If
码
halfram = ((ram / 1048576) / 2) - 1
nudram.Maximum = halfram
If nudram.Value = 0 Or nudram.Value = 1024 Then
nudram.Value = halfram
End If
但是为了您自己的目的,将选项strict设置为ON,以便声明您的变量。想想那些在10年内编辑你的资源的穷人。
答案 1 :(得分:0)
尝试If nudram.Value = 0 Or nudram.Value = 1024 Then
答案 2 :(得分:0)
您可以尝试将“1,048,576”更改为“1.048.576”或将其用作数字,而不是1048576。
十进制/千位分隔符在不同系统上可能不同,有些会将1,048,576解释为百万,并将(,
更改为千位分隔符),而其他将尝试将其解释为double(并且会在第二个小数分隔符。)
答案 3 :(得分:0)
If bit = 64
应为If bit = "64"