Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
HandyS11 committed May 30, 2024
1 parent a660f76 commit 61810f3
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 2 deletions.
2 changes: 1 addition & 1 deletion RustPlusApi/Examples/Legacy/GetInfoLegacy/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using static __Constants.ExamplesConst;

var rustPlus = new RustPlus(Ip, Port, PlayerId, PlayerToken);
var rustPlus = new RustPlusLegacy(Ip, Port, PlayerId, PlayerToken);

rustPlus.Connected += async (_, _) =>
{
Expand Down
2 changes: 1 addition & 1 deletion RustPlusApi/Examples/Legacy/GetMapLegacy/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using static __Constants.ExamplesConst;

var rustPlus = new RustPlus(Ip, Port, PlayerId, PlayerToken);
var rustPlus = new RustPlusLegacy(Ip, Port, PlayerId, PlayerToken);

rustPlus.Connected += async (_, _) =>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\RustPlusApi\RustPlusApi.csproj" />
<ProjectReference Include="..\..\__Constants\__Constants.csproj" />
</ItemGroup>

</Project>
18 changes: 18 additions & 0 deletions RustPlusApi/Examples/Legacy/GetMapMarkersLegacy/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Newtonsoft.Json;

using RustPlusApi;

using static __Constants.ExamplesConst;

var rustPlus = new RustPlusLegacy(Ip, Port, PlayerId, PlayerToken);

rustPlus.Connected += async (_, _) =>
{
var message = await rustPlus.GetMapMarkersLegacyAsync();

Console.WriteLine($"Infos:\n{JsonConvert.SerializeObject(message, JsonSettings)}");

rustPlus.Dispose();
};

await rustPlus.ConnectAsync();
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\RustPlusApi\RustPlusApi.csproj" />
<ProjectReference Include="..\..\__Constants\__Constants.csproj" />
</ItemGroup>

</Project>
18 changes: 18 additions & 0 deletions RustPlusApi/Examples/Legacy/GetTeamChatLegacy/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Newtonsoft.Json;

using RustPlusApi;

using static __Constants.ExamplesConst;

var rustPlus = new RustPlusLegacy(Ip, Port, PlayerId, PlayerToken);

rustPlus.Connected += async (_, _) =>
{
var message = await rustPlus.GetTeamChatLegacyAsync();

Console.WriteLine($"Infos:\n{JsonConvert.SerializeObject(message, JsonSettings)}");

rustPlus.Dispose();
};

await rustPlus.ConnectAsync();
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\RustPlusApi\RustPlusApi.csproj" />
<ProjectReference Include="..\..\__Constants\__Constants.csproj" />
</ItemGroup>

</Project>
18 changes: 18 additions & 0 deletions RustPlusApi/Examples/Legacy/GetTeamInfoLegacy/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Newtonsoft.Json;

using RustPlusApi;

using static __Constants.ExamplesConst;

var rustPlus = new RustPlusLegacy(Ip, Port, PlayerId, PlayerToken);

rustPlus.Connected += async (_, _) =>
{
var message = await rustPlus.GetTeamInfoLegacyAsync();

Console.WriteLine($"Infos:\n{JsonConvert.SerializeObject(message, JsonSettings)}");

rustPlus.Dispose();
};

await rustPlus.ConnectAsync();
15 changes: 15 additions & 0 deletions RustPlusApi/Examples/Legacy/GetTimeLegacy/GetTimeLegacy.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\RustPlusApi\RustPlusApi.csproj" />
<ProjectReference Include="..\..\__Constants\__Constants.csproj" />
</ItemGroup>

</Project>
18 changes: 18 additions & 0 deletions RustPlusApi/Examples/Legacy/GetTimeLegacy/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Newtonsoft.Json;

using RustPlusApi;

using static __Constants.ExamplesConst;

var rustPlus = new RustPlusLegacy(Ip, Port, PlayerId, PlayerToken);

rustPlus.Connected += async (_, _) =>
{
var message = await rustPlus.GetTimeLegacyAsync();

Console.WriteLine($"Infos:\n{JsonConvert.SerializeObject(message, JsonSettings)}");

rustPlus.Dispose();
};

await rustPlus.ConnectAsync();

0 comments on commit 61810f3

Please sign in to comment.