Compare commits
2 Commits
27978346ae
...
2e9a712e71
| Author | SHA1 | Date | |
|---|---|---|---|
| 2e9a712e71 | |||
| 46405a8cf4 |
55
Articulate-Network.csproj
Normal file
55
Articulate-Network.csproj
Normal file
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{36A8EC7B-B239-4744-892A-4FE633511E8D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Articulate_Network</RootNamespace>
|
||||
<AssemblyName>Articulate-Network</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Client.cs" />
|
||||
<Compile Include="Interfaces\IManager.cs" />
|
||||
<Compile Include="Interfaces\IPacket.cs" />
|
||||
<Compile Include="Managers\PacketManager.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Server.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Enums\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
25
Articulate-Network.sln
Normal file
25
Articulate-Network.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31624.102
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Articulate-Network", "Articulate-Network.csproj", "{36A8EC7B-B239-4744-892A-4FE633511E8D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{36A8EC7B-B239-4744-892A-4FE633511E8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{36A8EC7B-B239-4744-892A-4FE633511E8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{36A8EC7B-B239-4744-892A-4FE633511E8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{36A8EC7B-B239-4744-892A-4FE633511E8D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {81DCC61E-0253-4356-8FBF-8DF05F4B7FA1}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
47
Client.cs
Normal file
47
Client.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using Articulate_Network.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Articulate_Network
|
||||
{
|
||||
public class Client
|
||||
{
|
||||
List<IManager> managers = new List<IManager>();
|
||||
|
||||
TcpClient tcp;
|
||||
|
||||
public Client()
|
||||
{
|
||||
tcp = new TcpClient();
|
||||
}
|
||||
|
||||
public async Task<TcpClient> Connect(string ip, int port)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
tcp.Connect(ip, port);
|
||||
|
||||
return tcp;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
return tcp;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<bool> SendPacket(IPacket packet)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Interfaces/IManager.cs
Normal file
13
Interfaces/IManager.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Articulate_Network.Interfaces
|
||||
{
|
||||
interface IManager
|
||||
{
|
||||
void Initialize();
|
||||
}
|
||||
}
|
||||
13
Interfaces/IPacket.cs
Normal file
13
Interfaces/IPacket.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Articulate_Network.Interfaces
|
||||
{
|
||||
public interface IPacket
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
20
Managers/PacketManager.cs
Normal file
20
Managers/PacketManager.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using Articulate_Network.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Articulate_Network.Managers
|
||||
{
|
||||
public class PacketManager : IManager
|
||||
{
|
||||
List<IPacket> packets = new List<IPacket>();
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
Console.WriteLine(Assembly.GetEntryAssembly());
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Properties/AssemblyInfo.cs
Normal file
36
Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Articulate-Network")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Queensland Government")]
|
||||
[assembly: AssemblyProduct("Articulate-Network")]
|
||||
[assembly: AssemblyCopyright("Copyright © Queensland Government 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("36a8ec7b-b239-4744-892a-4fe633511e8d")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
46
Server.cs
Normal file
46
Server.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using Articulate_Network.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Articulate_Network
|
||||
{
|
||||
public class Server
|
||||
{
|
||||
List<IManager> managers = new List<IManager>();
|
||||
|
||||
TcpListener tcp;
|
||||
|
||||
public async Task<bool> Start(string ip, int port)
|
||||
{
|
||||
tcp = new TcpListener(IPAddress.Parse(ip), port);
|
||||
|
||||
bool connected = await Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
tcp.Start();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public async Task<bool> SendPacket(IPacket packet)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user