Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.81 KB | None | 0 0
  1. Imports System.Text
  2. Imports System.IO
  3. Imports System.Net.Sockets
  4. Imports System.Xml
  5. Imports System.Data
  6.  
  7. Module Server
  8.  
  9.     Private DT As DataTable
  10.     Private DS As New DataSet
  11.  
  12.     Sub Main()
  13.         Console.Clear()
  14.         Console.WriteLine("Project Slam Daemon")
  15.         Console.WriteLine("v1.00.51111")
  16.         Console.WriteLine("")
  17.         Console.WriteLine("")
  18.         Console.WriteLine("Checking configuration file...")
  19.         Console.WriteLine("")
  20.         XMLConfigReader()
  21.  
  22.     End Sub
  23.  
  24.     Sub XMLConfigReader()
  25.         If File.Exists("C:\Program Files\Project Slam\Daemon\PSDaemon.xml") = False Then
  26.             Console.WriteLine("Configuration doesn't exist! Starting config maker...")
  27.             Console.WriteLine("")
  28.             Console.WriteLine("Project Slam Daemon Setup")
  29.             Console.WriteLine("-------------------------")
  30.             Console.WriteLine("")
  31.             Console.WriteLine("What port do you want clients to connect to?")
  32.  
  33.             Dim iPort As Integer = Console.ReadLine()
  34.  
  35.             Console.WriteLine("")
  36.             Console.WriteLine("[" & iPort & "] is now set.")
  37.  
  38.             DT = New DataTable()
  39.  
  40.             DT.Columns.Add(New DataColumn("ServerPort", Type.GetType("System.Int32")))
  41.             FillTable(1, "ServerPort", iPort)
  42.  
  43.             DS.Tables.Add(DT)
  44.             DS.Tables(0).TableName = "Settings"
  45.             DS.WriteXml("PSDaemon.xml")
  46.  
  47.             Console.WriteLine("")
  48.             Console.WriteLine("Settings have been stored in PSDaemon.xml")
  49.             Console.ReadLine()
  50.  
  51.         End If
  52.  
  53.     End Sub
  54.  
  55.     Sub FillTable(ByVal pID As Integer, ByVal pName As String, ByVal iPort As Integer)
  56.         Dim DR As DataRow
  57.         DR = DT.NewRow
  58.  
  59.         DR("ServerPort") = pID
  60.  
  61.         DT.Rows.Add(DR)
  62.     End Sub
  63. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement