Skip to content

Commit 7cde3ca

Browse files
committed
Started working on TCP Client
1 parent 70a4fb4 commit 7cde3ca

File tree

7 files changed

+160
-1
lines changed

7 files changed

+160
-1
lines changed

MCQuery-Lib/Connection.cs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System.Net.Sockets;
2+
3+
namespace MCQuery_Lib
4+
{
5+
public class Connection
6+
{
7+
public Connection(string address, string port)
8+
{
9+
TcpClient client = new TcpClient(address, int.Parse(port));
10+
11+
try
12+
{
13+
// client.Connect();
14+
}
15+
catch (SocketException socketException)
16+
{
17+
//TODO:Do something with exception...
18+
}
19+
}
20+
}
21+
}

MCQuery-Lib/MCQuery-Lib.csproj

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{B439EF43-29DE-4490-9542-83111E9CF88B}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>MCQuery_Lib</RootNamespace>
11+
<AssemblyName>MCQuery-Lib</AssemblyName>
12+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<DebugSymbols>true</DebugSymbols>
17+
<DebugType>full</DebugType>
18+
<Optimize>false</Optimize>
19+
<OutputPath>bin\Debug\</OutputPath>
20+
<DefineConstants>DEBUG;TRACE</DefineConstants>
21+
<ErrorReport>prompt</ErrorReport>
22+
<WarningLevel>4</WarningLevel>
23+
</PropertyGroup>
24+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25+
<DebugType>pdbonly</DebugType>
26+
<Optimize>true</Optimize>
27+
<OutputPath>bin\Release\</OutputPath>
28+
<DefineConstants>TRACE</DefineConstants>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
</PropertyGroup>
32+
<ItemGroup>
33+
<Reference Include="System" />
34+
<Reference Include="System.Core" />
35+
<Reference Include="System.Xml.Linq" />
36+
<Reference Include="System.Data.DataSetExtensions" />
37+
<Reference Include="Microsoft.CSharp" />
38+
<Reference Include="System.Data" />
39+
<Reference Include="System.Net.Http" />
40+
<Reference Include="System.Xml" />
41+
</ItemGroup>
42+
<ItemGroup>
43+
<Compile Include="Connection.cs" />
44+
<Compile Include="Properties\AssemblyInfo.cs" />
45+
<Compile Include="Request.cs" />
46+
<Compile Include="Server.cs" />
47+
</ItemGroup>
48+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
49+
</Project>
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("MCQuery-Lib")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany(".")]
12+
[assembly: AssemblyProduct("MCQuery-Lib")]
13+
[assembly: AssemblyCopyright("Copyright © . 2018")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("b439ef43-29de-4490-9542-83111e9cf88b")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

MCQuery-Lib/Request.cs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace MCQuery_Lib
8+
{
9+
public class Request
10+
{
11+
12+
}
13+
}

MCQuery-Lib/Server.cs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace MCQuery_Lib
8+
{
9+
public class Server
10+
{
11+
public string Name { get; set; }
12+
public List<String> PlayerList { get; set; }
13+
public string Motd { get; set; }
14+
public string GameMode { get; set; }
15+
public bool Status { get; set; }
16+
17+
public Server(string name, bool status)
18+
{
19+
if (status)
20+
{
21+
22+
}
23+
}
24+
25+
public Server(string name, string gamemode, bool status, List<String> playerlist)
26+
{
27+
28+
}
29+
}
30+
}

MCQuery.sln

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
44
VisualStudioVersion = 15.0.27130.2024
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MCQuery", "MCQuery\MCQuery.csproj", "{D2B7C12E-E5CC-4517-B07A-AE9AE9A0DDAD}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MCQuery-Console", "MCQuery\MCQuery-Console.csproj", "{D2B7C12E-E5CC-4517-B07A-AE9AE9A0DDAD}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MCQuery-Lib", "MCQuery-Lib\MCQuery-Lib.csproj", "{B439EF43-29DE-4490-9542-83111E9CF88B}"
79
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +17,10 @@ Global
1517
{D2B7C12E-E5CC-4517-B07A-AE9AE9A0DDAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{D2B7C12E-E5CC-4517-B07A-AE9AE9A0DDAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{D2B7C12E-E5CC-4517-B07A-AE9AE9A0DDAD}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{B439EF43-29DE-4490-9542-83111E9CF88B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{B439EF43-29DE-4490-9542-83111E9CF88B}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{B439EF43-29DE-4490-9542-83111E9CF88B}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{B439EF43-29DE-4490-9542-83111E9CF88B}.Release|Any CPU.Build.0 = Release|Any CPU
1824
EndGlobalSection
1925
GlobalSection(SolutionProperties) = preSolution
2026
HideSolutionNode = FALSE

MCQuery/MCQuery.csproj MCQuery/MCQuery-Console.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55
<TargetFramework>netcoreapp2.0</TargetFramework>
66
</PropertyGroup>
77

8+
<ItemGroup>
9+
<ProjectReference Include="..\MCQuery-Lib\MCQuery-Lib.csproj" />
10+
</ItemGroup>
11+
812
</Project>

0 commit comments

Comments
 (0)