Commit 56fb2919 authored by Michael Alexander's avatar Michael Alexander
Browse files

netIO somehow working

JSON WIP
parent 77e4c49f
Module GlobalVariables
' sets the Form's text property (title)
Public TOKEN As String = "Hello World!"
Public NETIO_SUCCESS As Integer = 0
Public SERVER_IP As String
Public SERVER_PORT As Integer
End Module
......@@ -22,109 +22,120 @@ Partial Class Login
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.TextBox2 = New System.Windows.Forms.TextBox()
Me.TextBox3 = New System.Windows.Forms.TextBox()
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.ServerIPLabel = New System.Windows.Forms.Label()
Me.UsernameLabel = New System.Windows.Forms.Label()
Me.PasswordLabel = New System.Windows.Forms.Label()
Me.ServerIPInput = New System.Windows.Forms.TextBox()
Me.UsernameInput = New System.Windows.Forms.TextBox()
Me.PasswordInput = New System.Windows.Forms.TextBox()
Me.LoginButton = New System.Windows.Forms.Button()
Me.RegisterButton = New System.Windows.Forms.Button()
Me.PortInput = New System.Windows.Forms.TextBox()
Me.SuspendLayout()
'
'Label1
'ServerIPLabel
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(75, 46)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(51, 13)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Server IP"
Me.ServerIPLabel.AutoSize = True
Me.ServerIPLabel.Location = New System.Drawing.Point(45, 50)
Me.ServerIPLabel.Name = "ServerIPLabel"
Me.ServerIPLabel.Size = New System.Drawing.Size(94, 13)
Me.ServerIPLabel.TabIndex = 0
Me.ServerIPLabel.Text = "Server IP and Port"
'
'Label2
'UsernameLabel
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(71, 89)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(55, 13)
Me.Label2.TabIndex = 1
Me.Label2.Text = "Username"
Me.UsernameLabel.AutoSize = True
Me.UsernameLabel.Location = New System.Drawing.Point(71, 89)
Me.UsernameLabel.Name = "UsernameLabel"
Me.UsernameLabel.Size = New System.Drawing.Size(55, 13)
Me.UsernameLabel.TabIndex = 1
Me.UsernameLabel.Text = "Username"
'
'Label3
'PasswordLabel
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(71, 119)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(53, 13)
Me.Label3.TabIndex = 2
Me.Label3.Text = "Password"
Me.PasswordLabel.AutoSize = True
Me.PasswordLabel.Location = New System.Drawing.Point(71, 119)
Me.PasswordLabel.Name = "PasswordLabel"
Me.PasswordLabel.Size = New System.Drawing.Size(53, 13)
Me.PasswordLabel.TabIndex = 2
Me.PasswordLabel.Text = "Password"
'
'TextBox1
'ServerIPInput
'
Me.TextBox1.Location = New System.Drawing.Point(145, 43)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(125, 20)
Me.TextBox1.TabIndex = 3
Me.ServerIPInput.Location = New System.Drawing.Point(145, 50)
Me.ServerIPInput.Name = "ServerIPInput"
Me.ServerIPInput.Size = New System.Drawing.Size(76, 20)
Me.ServerIPInput.TabIndex = 3
'
'TextBox2
'UsernameInput
'
Me.TextBox2.Location = New System.Drawing.Point(145, 86)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(125, 20)
Me.TextBox2.TabIndex = 4
Me.UsernameInput.Location = New System.Drawing.Point(145, 86)
Me.UsernameInput.Name = "UsernameInput"
Me.UsernameInput.Size = New System.Drawing.Size(125, 20)
Me.UsernameInput.TabIndex = 5
'
'TextBox3
'PasswordInput
'
Me.TextBox3.Location = New System.Drawing.Point(145, 116)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(125, 20)
Me.TextBox3.TabIndex = 5
Me.TextBox3.UseSystemPasswordChar = True
Me.PasswordInput.Location = New System.Drawing.Point(145, 116)
Me.PasswordInput.Name = "PasswordInput"
Me.PasswordInput.Size = New System.Drawing.Size(125, 20)
Me.PasswordInput.TabIndex = 6
Me.PasswordInput.UseSystemPasswordChar = True
'
'Button1
'LoginButton
'
Me.Button1.Location = New System.Drawing.Point(195, 162)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 23)
Me.Button1.TabIndex = 6
Me.Button1.Text = "Login"
Me.Button1.UseVisualStyleBackColor = True
Me.LoginButton.Location = New System.Drawing.Point(195, 162)
Me.LoginButton.Name = "LoginButton"
Me.LoginButton.Size = New System.Drawing.Size(75, 23)
Me.LoginButton.TabIndex = 8
Me.LoginButton.Text = "Login"
Me.LoginButton.UseVisualStyleBackColor = True
'
'Button2
'RegisterButton
'
Me.Button2.Location = New System.Drawing.Point(74, 162)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(75, 23)
Me.Button2.TabIndex = 7
Me.Button2.Text = "Register"
Me.Button2.UseVisualStyleBackColor = True
Me.RegisterButton.Location = New System.Drawing.Point(74, 162)
Me.RegisterButton.Name = "RegisterButton"
Me.RegisterButton.Size = New System.Drawing.Size(75, 23)
Me.RegisterButton.TabIndex = 7
Me.RegisterButton.Text = "Register"
Me.RegisterButton.UseVisualStyleBackColor = True
'
'PortInput
'
Me.PortInput.Location = New System.Drawing.Point(228, 50)
Me.PortInput.Name = "PortInput"
Me.PortInput.Size = New System.Drawing.Size(42, 20)
Me.PortInput.TabIndex = 4
'
'Login
'
Me.AcceptButton = Me.LoginButton
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(344, 251)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.RegisterButton)
Me.Controls.Add(Me.LoginButton)
Me.Controls.Add(Me.PasswordInput)
Me.Controls.Add(Me.UsernameInput)
Me.Controls.Add(Me.PortInput)
Me.Controls.Add(Me.ServerIPInput)
Me.Controls.Add(Me.PasswordLabel)
Me.Controls.Add(Me.UsernameLabel)
Me.Controls.Add(Me.ServerIPLabel)
Me.Name = "Login"
Me.Text = "Login-poi!"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents ServerIPLabel As System.Windows.Forms.Label
Friend WithEvents UsernameLabel As System.Windows.Forms.Label
Friend WithEvents PasswordLabel As System.Windows.Forms.Label
Friend WithEvents ServerIPInput As System.Windows.Forms.TextBox
Friend WithEvents PortInput As System.Windows.Forms.TextBox
Friend WithEvents UsernameInput As System.Windows.Forms.TextBox
Friend WithEvents PasswordInput As System.Windows.Forms.TextBox
Friend WithEvents LoginButton As System.Windows.Forms.Button
Friend WithEvents RegisterButton As System.Windows.Forms.Button
End Class
......@@ -4,4 +4,16 @@
End Sub
Private Sub Login_Click(sender As Object, e As EventArgs) Handles LoginButton.Click
SERVER_IP = ServerIPInput.Text
SERVER_PORT = PortInput.Text
Dim net As New NetIO
MsgBox(net.SendRecv("ASD"))
Map.Show()
Me.Close()
End Sub
End Class
......@@ -28,7 +28,7 @@ Partial Class Map
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(284, 261)
Me.ClientSize = New System.Drawing.Size(632, 333)
Me.Name = "Map"
Me.Text = "Map, poi!"
Me.ResumeLayout(False)
......
......@@ -27,7 +27,7 @@ Namespace My
Me.IsSingleInstance = false
Me.EnableVisualStyles = true
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterAllFormsClose
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
......
<?xml version="1.0" encoding="utf-16"?>
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>Login</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<ShutdownMode>1</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
......
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel node will disable file and registry virtualization.
If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of all Windows versions that this application is designed to work with.
Windows will automatically select the most compatible environment.-->
<!-- If your application is designed to work with Windows Vista, uncomment the following supportedOS node-->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>-->
<!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
<!-- If your application is designed to work with Windows 8, uncomment the following supportedOS node-->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>-->
<!-- If your application is designed to work with Windows 8.1, uncomment the following supportedOS node-->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>-->
</application>
</compatibility>
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!-- <dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>-->
</asmv1:assembly>
Imports System.Net.Sockets
Imports System.Text
Public Class NetIO
Private ClientSocket As New TcpClient
Private ServerStream As NetworkStream
Public Sub New()
MsgBox("Connecting")
ClientSocket.Connect(SERVER_IP, SERVER_PORT)
MsgBox("Connected")
End Sub
Public Function SendRecv(ByVal param As String) As String
MsgBox("Sending")
Dim toSend As String = "{""method"": ""login"",""username"": ""nozirohilol"", ""password"": ""a8f064bbec9819f488e6402a7c570da9""}"
Dim OutStream As Byte() = Encoding.UTF8.GetBytes(toSend)
Dim ReceivedData As String
Dim inStream(100000) As Byte
ServerStream = ClientSocket.GetStream()
ServerStream.Write(OutStream, 0, OutStream.Length)
ServerStream.Flush()
ServerStream.Read(inStream, 0, CInt(ClientSocket.ReceiveBufferSize))
ReceivedData = Encoding.ASCII.GetString(inStream)
Return ReceivedData
End Function
End Class
......@@ -45,6 +45,9 @@
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
......@@ -70,6 +73,7 @@
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="Globals.vb" />
<Compile Include="Map.Designer.vb">
<DependentUpon>Map.vb</DependentUpon>
</Compile>
......@@ -98,6 +102,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="NetIO.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Map.resx">
......@@ -114,6 +119,7 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\app.manifest" />
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
......@@ -126,6 +132,7 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Newtonsoft.Json.dll" />
<Content Include="Resources\Chara\Idle\idle1.gif" />
<Content Include="Resources\Chara\Idle\idle2.gif" />
<Content Include="Resources\Chara\Idle\idle3.gif" />
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment