Jump to content

Recommended Posts

Posted

Hi again i found this tool us i see in MxC it was only v1.0 so was better to have newest version.

 

 

oq9lrmjpg.png

L2Hosts Manager - Information

 

This program can help you manage your hosts file and through that file play on servers.

Each server now uses hosts which is a legal way to play on emulator servers (L2 java powered)

well this application does it all for you , you just need to enter the ip address of the server

click "add" select it and click "Write to hosts" its that easy.

This program can also help you if you join a server which has dynamic ip.In that situation

the server's ip is automatically updated on every server machine restart or network restart

on the server machine which could create a lot of problems because when the server disconnects

you need to find his ip again through his hostname and close Lineage , open your hosts and

edit them with the ip , then save hosts and re-open Lineage II which could take a lot of time

this program updates hosts to the server's ip every 30 seconds.The only thing you need to do

is to give it the server's hostname and the rest are done automatically , you don't even need to

close Lineage II.

 

Download link: http://www.mediafire.com/?myqi3wdcowy

Password: oq9lrm

 

   1.  
   2. Imports System.IO
   3. Imports System.Net
   4.  
   5. Public Class Form1
   6. Public hostsfile = ""
   7. Public website = "http://tnuke.hostei.com/forum/index.php/topic,3.0.html"
   8. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   9. DetectHosts()
  10. Me.Text = Me.Text & " - " & website
  11. End Sub
  12.  
  13. Sub DetectHosts()
  14. If File.Exists("C:\windows\system32\drivers\etc\hosts") Then
  15. hostsfile = "C:\windows\system32\drivers\etc\hosts"
  16. Log("Hosts have been detected.")
  17. Log("[" & hostsfile & "]")
  18. File.SetAttributes(hostsfile, FileAttributes.Normal)
  19. Else
  20. hostsfile = Nothing
  21. Log("Hosts have not been detected!")
  22. Log("Please click the 'Find hosts' button and search for them.")
  23. Button3.Enabled = True
  24. End If
  25. End Sub
  26.  
  27. Sub Log(ByVal text As String)
  28. If TextBox1.Text.Length > 0 Then
  29. TextBox1.Text = TextBox1.Text & vbNewLine & text
  30. Else
  31. TextBox1.Text = TextBox1.Text & text
  32. End If
  33. End Sub
  34.  
  35. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  36. If TextBox1.Visible = True Then
  37. Button1.Text = "+"
  38. TextBox1.Visible = False
  39. Dim point As New Point(521, 252)
  40. Me.Size = point
  41. ElseIf TextBox1.Visible = False Then
  42. Button1.Text = "-"
  43. TextBox1.Visible = True
  44. Dim point As New Point(521, 335)
  45. Me.Size = point
  46. End If
  47. End Sub
  48.  
  49. Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
  50. TextBox1.HideSelection = False
  51. TextBox1.SelectionLength = 0
  52. TextBox1.SelectionStart = Len(TextBox1.Text)
  53. TextBox1.ScrollToCaret()
  54. End Sub
  55.  
  56. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  57. Dim o As OpenFileDialog = New OpenFileDialog
  58. o.Filter = "All files (*.*)|*.*"
  59. If o.ShowDialog = Windows.Forms.DialogResult.OK Then
  60. hostsfile = o.FileName
  61. If hostsfile.ToString.Length > 0 Then
  62. Button3.Enabled = False
  63. Else
  64. Button3.Enabled = True
  65. End If
  66. Else
  67. Button3.Enabled = True
  68. End If
  69. End Sub
  70.  
  71. Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  72. Me.Close()
  73. End Sub
  74.  
  75. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  76. If TextBox2.Text.Length > 0 Then
  77. ListBox1.Items.Add(TextBox2.Text)
  78. Else
  79. Log("Please enter a valid ip address.")
  80. End If
  81. End Sub
  82.  
  83. Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
  84. Try
  85. If ListBox1.SelectedItem > 0 Then
  86. ListBox1.Items.Remove(ListBox1.SelectedItem)
  87. Else
  88. Log("Please select an item.")
  89. End If
  90. Catch ex As Exception
  91. ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
  92. End Try
  93. End Sub
  94.  
  95. Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
  96. If ListBox1.SelectedItem > 0 Then
  97. If hostsfile.ToString.Length > 0 Then
  98. Dim o As IO.StreamWriter
  99. If File.Exists(hostsfile) Then
100. File.SetAttributes(hostsfile, FileAttributes.Normal)
101. File.Delete(hostsfile)
102. o = IO.File.AppendText(hostsfile)
103. o.WriteLine("## L2J Hosts Manager - " & website & " ##")
104. o.WriteLine("127.0.0.1 localhost")
105. o.WriteLine(ListBox1.SelectedItem & " L2authd.lineage2.com")
106. o.WriteLine("216.107.250.194 nprotect.lineage2.com")
107. o.WriteLine("216.107.250.194 update.nProtect.com")
108. o.Close()
109. Else
110. File.SetAttributes(hostsfile, FileAttributes.Normal)
111. o = IO.File.AppendText(hostsfile)
112. o.WriteLine("## L2J Hosts Manager - " & website & " ##")
113. o.WriteLine("127.0.0.1 localhost")
114. o.WriteLine(ListBox1.SelectedItem & " L2authd.lineage2.com")
115. o.WriteLine("216.107.250.194 nprotect.lineage2.com")
116. o.WriteLine("216.107.250.194 update.nProtect.com")
117. o.Close()
118. End If
119. End If
120. Log("IP {" & ListBox1.SelectedItem & "} has been written to hosts.")
121. Else
122. Log("Please select an item.")
123. End If
124. End Sub
125.  
126. Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
127. If TextBox3.ReadOnly = False Then
128. Button7.Text = "Unlock"
129. TextBox3.ReadOnly = True
130. Log("Hostname {" & TextBox3.Text & "} has been locked!")
131. If CheckBox1.Checked = True Then
132. Timer1.Start()
133. Log("Autoupdate is enabled!")
134. End If
135. Else
136. Button7.Text = "Lock"
137. TextBox3.ReadOnly = False
138. Log("Hostname {" & TextBox3.Text & "} has been unlocked!")
139. Timer1.Stop()
140. Log("Autoupdate is disabled!")
141. End If
142. End Sub
143.  
144. Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
145. If CheckBox1.Checked = True Then
146. If TextBox3.TextLength > 0 And TextBox3.ReadOnly = True Then
147. Log("Autoupdate is enabled!")
148. Timer1.Start()
149. Else
150. MsgBox("Please enter a hostname to update to and then lock the textbox to continue.")
151. CheckBox1.Checked = False
152. End If
153. Else
154. Log("Autoupdate is disabled!")
155. Timer1.Stop()
156. End If
157. End Sub
158.  
159. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
160. If TextBox3.TextLength > 0 And TextBox3.ReadOnly = True Then
161. If hostsfile.ToString.Length > 0 Then
162. File.SetAttributes(hostsfile, FileAttributes.Normal)
163. Dim o As IO.StreamWriter
164. If File.Exists(hostsfile) Then
165. File.SetAttributes(hostsfile, FileAttributes.Normal)
166. File.Delete(hostsfile)
167. o = IO.File.AppendText(hostsfile)
168. o.WriteLine("## L2J Hosts Manager - " & website & " ##")
169. o.WriteLine("127.0.0.1 localhost")
170. o.WriteLine(HostToIP(TextBox3.Text) & " L2authd.lineage2.com")
171. o.WriteLine("216.107.250.194 nprotect.lineage2.com")
172. o.WriteLine("216.107.250.194 update.nProtect.com")
173. o.Close()
174. Else
175. File.SetAttributes(hostsfile, FileAttributes.Normal)
176. o = IO.File.AppendText(hostsfile)
177. o.WriteLine("## L2J Hosts Manager - " & website & " ##")
178. o.WriteLine("127.0.0.1 localhost")
179. o.WriteLine(HostToIP(TextBox3.Text) & " L2authd.lineage2.com")
180. o.WriteLine("216.107.250.194 nprotect.lineage2.com")
181. o.WriteLine("216.107.250.194 update.nProtect.com")
182. o.Close()
183. End If
184. Log("Hosts have been updated to {" & TextBox3.Text & "} with {" & HostToIP(TextBox3.Text) & "} [" & DateTime.Now & "]")
185. End If
186. Else
187. Timer1.Stop()
188. Log("Autoupdate is disabled!")
189. End If
190. End Sub
191.  
192. Function HostToIP(ByVal host As String)
193. Dim hostname As IPHostEntry = Dns.GetHostByName(host)
194. Dim ip As IPAddress() = hostname.AddressList
195. Return ip(0).ToString()
196. End Function
197.  
198. Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click
199. TextBox1.Copy()
200. End Sub
201.  
202. Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
203. MsgBox("-- Log System v1.0.1 --" & vbNewLine & "Coded by Stealth.")
204. End Sub
205.  
206. Private Sub ClearToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearToolStripMenuItem.Click
207. If TextBox1.Text.Length > 0 Then
208. Dim j As String = MsgBox("Are you sure you wish to clear the textbox?", MsgBoxStyle.YesNo)
209. If j = MsgBoxResult.Yes Then
210. TextBox1.Clear()
211. ElseIf j = MsgBoxResult.No Then
212. 'Do nothin' here.
213. End If
214. End If
215. End Sub
216.  
217. Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
218. Dim s As SaveFileDialog = New SaveFileDialog
219. s.Filter = "Plain text (*.txt)|*.txt"
220. If s.ShowDialog = Windows.Forms.DialogResult.OK Then
221. Dim i As StreamWriter
222. i = IO.File.AppendText(s.FileName)
223. i.WriteLine(TextBox1.Text)
224. i.Close()
225. Else
226. End If
227. End Sub
228.  
229. Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
230. Process.Start(website)
231. End Sub
232.  
233. Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
234. If hostsfile.ToString.Length > 0 Then
235. File.SetAttributes(hostsfile, FileAttributes.ReadOnly)
236. Log("Hosts file {" & hostsfile & "} has been set to read-only.")
237. End If
238. End Sub
239. End Class
240.  

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...