Skip to content

Commit

Permalink
add segregation between legacy code and explicit objects
Browse files Browse the repository at this point in the history
  • Loading branch information
HandyS11 committed May 30, 2024
1 parent 1838a67 commit 102321c
Show file tree
Hide file tree
Showing 30 changed files with 800 additions and 409 deletions.
80 changes: 66 additions & 14 deletions RustPlusApi.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RustPlusApi", "RustPlusApi\
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{BC948ADE-1674-4955-B27C-F0E96100978E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GetEntityInfo", "RustPlusApi\Examples\GetEntityInfo\GetEntityInfo.csproj", "{A53B0FAC-F59B-4021-9A67-997D1F5727D7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "__Constants", "RustPlusApi\Examples\__Constants\__Constants.csproj", "{DF3F9213-6F6D-4832-8738-CA106BE49860}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GetInfo", "RustPlusApi\Examples\GetInfo\GetInfo.csproj", "{AB17A661-1D1D-496C-A39C-B31F3BAEADA1}"
Expand All @@ -21,8 +19,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GetTime", "RustPlusApi\Exam
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SendTeamChat", "RustPlusApi\Examples\SendTeamChat\SendTeamChat.csproj", "{D70DD514-081F-4055-8779-6626DA96D18D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GetEntityChanges", "RustPlusApi\Examples\GetEntityChanges\GetEntityChanges.csproj", "{C1BA15FE-9F2E-4A9A-BBB3-9161FCFEE344}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SetEntityValue", "RustPlusApi\Examples\SetEntityValue\SetEntityValue.csproj", "{4E5DCE64-A8E5-42C0-8786-EA1FF36CACE4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrobeEntity", "RustPlusApi\Examples\StrobeEntity\StrobeEntity.csproj", "{3C4E8016-7B7F-4C5E-A5CA-A92A3797AA2B}"
Expand All @@ -43,6 +39,26 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PromoteToLeader", "RustPlus
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetTeamChatChanges", "RustPlusApi\Examples\GetTeamChatChanges\GetTeamChatChanges.csproj", "{D39626D0-079C-40C6-A260-09852E11C70A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetSmartSwitchInfo", "RustPlusApi\Examples\GetSmartSwitchInfo\GetSmartSwitchInfo.csproj", "{CCC95529-EA3A-4FF3-945A-97151848F6BB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetAlarmInfo", "RustPlusApi\Examples\GetAlarmInfo\GetAlarmInfo.csproj", "{B9E7E802-867B-40E4-BEEE-807735F091E3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetStorageMonitorInfo", "RustPlusApi\Examples\GetStorageMonitorInfo\GetStorageMonitorInfo.csproj", "{51CD85C0-0240-4C7C-BBDC-0DCF5234299E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Legacy", "Legacy", "{EBB661D0-93FF-4742-AF91-9036027CD136}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetEntityInfoLegacy", "RustPlusApi\Examples\Legacy\GetEntityInfoLegacy\GetEntityInfoLegacy.csproj", "{39EC2C27-0351-4099-A07B-237DD8C73FA6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetEntityChangesLegacy", "RustPlusApi\Examples\Legacy\GetEntityChangesLegacy\GetEntityChangesLegacy.csproj", "{443F0C99-2BC7-44CB-9DE8-A292B10B9CE3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetInfoLegacy", "RustPlusApi\Examples\Legacy\GetInfoLegacy\GetInfoLegacy.csproj", "{17F33FF0-AFE2-4DE4-81E9-6804A2B210A7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetMapLegacy", "RustPlusApi\Examples\Legacy\GetMapLegacy\GetMapLegacy.csproj", "{4C4D800C-1DF9-4139-BD7C-2FE0D78FF30C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetSmartSwitchChanges", "RustPlusApi\Examples\GetSmartSwitchChanges\GetSmartSwitchChanges.csproj", "{A7852D6E-9371-4026-B3BE-1BE264718D1D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetStorageMonitorChanges", "RustPlusApi\Examples\GetStorageMonitorChanges\GetStorageMonitorChanges.csproj", "{2E65E71F-1C4E-4813-86C9-C5F5D3E60187}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -53,10 +69,6 @@ Global
{2E744AA2-4D20-4B44-A79E-AC1CC56E848E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E744AA2-4D20-4B44-A79E-AC1CC56E848E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E744AA2-4D20-4B44-A79E-AC1CC56E848E}.Release|Any CPU.Build.0 = Release|Any CPU
{A53B0FAC-F59B-4021-9A67-997D1F5727D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A53B0FAC-F59B-4021-9A67-997D1F5727D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A53B0FAC-F59B-4021-9A67-997D1F5727D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A53B0FAC-F59B-4021-9A67-997D1F5727D7}.Release|Any CPU.Build.0 = Release|Any CPU
{DF3F9213-6F6D-4832-8738-CA106BE49860}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF3F9213-6F6D-4832-8738-CA106BE49860}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF3F9213-6F6D-4832-8738-CA106BE49860}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -81,10 +93,6 @@ Global
{D70DD514-081F-4055-8779-6626DA96D18D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D70DD514-081F-4055-8779-6626DA96D18D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D70DD514-081F-4055-8779-6626DA96D18D}.Release|Any CPU.Build.0 = Release|Any CPU
{C1BA15FE-9F2E-4A9A-BBB3-9161FCFEE344}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C1BA15FE-9F2E-4A9A-BBB3-9161FCFEE344}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C1BA15FE-9F2E-4A9A-BBB3-9161FCFEE344}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C1BA15FE-9F2E-4A9A-BBB3-9161FCFEE344}.Release|Any CPU.Build.0 = Release|Any CPU
{4E5DCE64-A8E5-42C0-8786-EA1FF36CACE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E5DCE64-A8E5-42C0-8786-EA1FF36CACE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E5DCE64-A8E5-42C0-8786-EA1FF36CACE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -121,19 +129,53 @@ Global
{D39626D0-079C-40C6-A260-09852E11C70A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D39626D0-079C-40C6-A260-09852E11C70A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D39626D0-079C-40C6-A260-09852E11C70A}.Release|Any CPU.Build.0 = Release|Any CPU
{CCC95529-EA3A-4FF3-945A-97151848F6BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CCC95529-EA3A-4FF3-945A-97151848F6BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCC95529-EA3A-4FF3-945A-97151848F6BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCC95529-EA3A-4FF3-945A-97151848F6BB}.Release|Any CPU.Build.0 = Release|Any CPU
{B9E7E802-867B-40E4-BEEE-807735F091E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B9E7E802-867B-40E4-BEEE-807735F091E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9E7E802-867B-40E4-BEEE-807735F091E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9E7E802-867B-40E4-BEEE-807735F091E3}.Release|Any CPU.Build.0 = Release|Any CPU
{51CD85C0-0240-4C7C-BBDC-0DCF5234299E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51CD85C0-0240-4C7C-BBDC-0DCF5234299E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51CD85C0-0240-4C7C-BBDC-0DCF5234299E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51CD85C0-0240-4C7C-BBDC-0DCF5234299E}.Release|Any CPU.Build.0 = Release|Any CPU
{39EC2C27-0351-4099-A07B-237DD8C73FA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39EC2C27-0351-4099-A07B-237DD8C73FA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39EC2C27-0351-4099-A07B-237DD8C73FA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{39EC2C27-0351-4099-A07B-237DD8C73FA6}.Release|Any CPU.Build.0 = Release|Any CPU
{443F0C99-2BC7-44CB-9DE8-A292B10B9CE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{443F0C99-2BC7-44CB-9DE8-A292B10B9CE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{443F0C99-2BC7-44CB-9DE8-A292B10B9CE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{443F0C99-2BC7-44CB-9DE8-A292B10B9CE3}.Release|Any CPU.Build.0 = Release|Any CPU
{17F33FF0-AFE2-4DE4-81E9-6804A2B210A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17F33FF0-AFE2-4DE4-81E9-6804A2B210A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17F33FF0-AFE2-4DE4-81E9-6804A2B210A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{17F33FF0-AFE2-4DE4-81E9-6804A2B210A7}.Release|Any CPU.Build.0 = Release|Any CPU
{4C4D800C-1DF9-4139-BD7C-2FE0D78FF30C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4C4D800C-1DF9-4139-BD7C-2FE0D78FF30C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C4D800C-1DF9-4139-BD7C-2FE0D78FF30C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C4D800C-1DF9-4139-BD7C-2FE0D78FF30C}.Release|Any CPU.Build.0 = Release|Any CPU
{A7852D6E-9371-4026-B3BE-1BE264718D1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A7852D6E-9371-4026-B3BE-1BE264718D1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A7852D6E-9371-4026-B3BE-1BE264718D1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A7852D6E-9371-4026-B3BE-1BE264718D1D}.Release|Any CPU.Build.0 = Release|Any CPU
{2E65E71F-1C4E-4813-86C9-C5F5D3E60187}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E65E71F-1C4E-4813-86C9-C5F5D3E60187}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E65E71F-1C4E-4813-86C9-C5F5D3E60187}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E65E71F-1C4E-4813-86C9-C5F5D3E60187}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A53B0FAC-F59B-4021-9A67-997D1F5727D7} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{DF3F9213-6F6D-4832-8738-CA106BE49860} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{AB17A661-1D1D-496C-A39C-B31F3BAEADA1} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{4E87360D-AC39-4475-957F-D49018DB2DC8} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{70453D6E-9C19-41BC-8C96-0E20F919DB11} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{E9F90342-34DE-4166-9769-483A3FA1F144} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{D70DD514-081F-4055-8779-6626DA96D18D} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{C1BA15FE-9F2E-4A9A-BBB3-9161FCFEE344} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{4E5DCE64-A8E5-42C0-8786-EA1FF36CACE4} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{3C4E8016-7B7F-4C5E-A5CA-A92A3797AA2B} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{DD34FAE8-30AA-4787-A6D1-77C330A0928F} = {BC948ADE-1674-4955-B27C-F0E96100978E}
Expand All @@ -143,6 +185,16 @@ Global
{1A186504-8461-4F19-BDC5-C3DB90A554D6} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{3DE93E0D-DAF5-48E7-A353-BD99ABB942DE} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{D39626D0-079C-40C6-A260-09852E11C70A} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{CCC95529-EA3A-4FF3-945A-97151848F6BB} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{B9E7E802-867B-40E4-BEEE-807735F091E3} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{51CD85C0-0240-4C7C-BBDC-0DCF5234299E} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{EBB661D0-93FF-4742-AF91-9036027CD136} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{39EC2C27-0351-4099-A07B-237DD8C73FA6} = {EBB661D0-93FF-4742-AF91-9036027CD136}
{443F0C99-2BC7-44CB-9DE8-A292B10B9CE3} = {EBB661D0-93FF-4742-AF91-9036027CD136}
{17F33FF0-AFE2-4DE4-81E9-6804A2B210A7} = {EBB661D0-93FF-4742-AF91-9036027CD136}
{4C4D800C-1DF9-4139-BD7C-2FE0D78FF30C} = {EBB661D0-93FF-4742-AF91-9036027CD136}
{A7852D6E-9371-4026-B3BE-1BE264718D1D} = {BC948ADE-1674-4955-B27C-F0E96100978E}
{2E65E71F-1C4E-4813-86C9-C5F5D3E60187} = {BC948ADE-1674-4955-B27C-F0E96100978E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A4B4251F-ADA4-418D-95B5-27BA99A307A3}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<Nullable>enable</Nullable>
</PropertyGroup>

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

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
using static __Constants.ExamplesConst;

var rustPlus = new RustPlus(Ip, Port, PlayerId, PlayerToken);
uint entityId = 0;
const uint entityId = 0;

rustPlus.Connected += async (_, _) =>
{
// The message would be SmartSwitchInfo, AlarmInfo, or StorageMonitorInfo
// If you want to do your own parsing you can set the useRawObject parameter to true
var message = await rustPlus.GetEntityInfoAsync(entityId);
var message = await rustPlus.GetAlarmInfoAsync(entityId);

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

Expand Down
38 changes: 0 additions & 38 deletions RustPlusApi/Examples/GetEntityChanges/Program.cs

This file was deleted.

2 changes: 0 additions & 2 deletions RustPlusApi/Examples/GetInfo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

rustPlus.Connected += async (_, _) =>
{
// The message would be a ServerInfo
// If you want to do your own parsing you can set the useRawObject parameter to true
var message = await rustPlus.GetInfoAsync();

Console.WriteLine($"Infos:\n{JsonConvert.SerializeObject(message, JsonSettings)}");
Expand Down
13 changes: 4 additions & 9 deletions RustPlusApi/Examples/GetMap/Program.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
using Newtonsoft.Json;

using RustPlusApi;
using RustPlusApi.Data;

using static __Constants.ExamplesConst;

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

rustPlus.Connected += async (_, _) =>
{
// The message would be a ServerMap
// If you want to do your own parsing you can set the useRawObject parameter to true
// (this code will obviously break if you do)
var message = await rustPlus.GetMapAsync();

if (message is not ServerMap) return;
var serverMap = (ServerMap)message;
if (!message.IsSuccess) return;

File.WriteAllBytes("map.jpg", serverMap.JpgImage!);
File.WriteAllBytes("map.jpg", message.Data?.JpgImage!);

serverMap.JpgImage = null;
Console.WriteLine($"Infos:\n{JsonConvert.SerializeObject(serverMap, JsonSettings)}");
message.Data!.JpgImage = null;
Console.WriteLine($"Infos:\n{JsonConvert.SerializeObject(message, JsonSettings)}");

Console.WriteLine($"Image saved under: {Directory.GetCurrentDirectory()}");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<Nullable>enable</Nullable>
</PropertyGroup>

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

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

using RustPlusApi;

using static __Constants.ExamplesConst;

var rustPlus = new RustPlus(Ip, Port, PlayerId, PlayerToken);
const uint entityId = 0;

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

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

rustPlus.OnSmartSwitchTriggered += (_, message) =>
{
Console.WriteLine($"SmartSwitch:\n{JsonConvert.SerializeObject(message, JsonSettings)}");
};

await rustPlus.ConnectAsync();
15 changes: 15 additions & 0 deletions RustPlusApi/Examples/GetSmartSwitchInfo/GetSmartSwitchInfo.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>
19 changes: 19 additions & 0 deletions RustPlusApi/Examples/GetSmartSwitchInfo/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Newtonsoft.Json;

using RustPlusApi;

using static __Constants.ExamplesConst;

var rustPlus = new RustPlus(Ip, Port, PlayerId, PlayerToken);
const uint entityId = 0;

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

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>
22 changes: 22 additions & 0 deletions RustPlusApi/Examples/GetStorageMonitorChanges/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Newtonsoft.Json;

using RustPlusApi;

using static __Constants.ExamplesConst;

var rustPlus = new RustPlus(Ip, Port, PlayerId, PlayerToken);
const uint entityId = 0;

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

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

rustPlus.OnStorageMonitorTriggered += (_, message) =>
{
Console.WriteLine($"StorageMonitor:\n{JsonConvert.SerializeObject(message, JsonSettings)}");
};

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>
Loading

0 comments on commit 102321c

Please sign in to comment.