-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge feature/implementMoreConvinientMethods int develop (#10)
* move proto file * small improve on Dispose * remove proto file * move .proto files * fix examples folder * clear using * first working websocket thanks to @Versette * work on clean up * Set up readme and so * add some events * Still need to debug because some are not working idk why * totaly rework the app logic by removing the callback principe implement entityinfo * add ServerInfo and ServerMap * add segregation between legacy code and explicit objects * rework RustPlus socket * add examples * add more test examples
- Loading branch information
Showing
109 changed files
with
5,358 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\RustPlusApi.Fcm\RustPlusApi.Fcm.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using RustPlusApi.Fcm; | ||
using RustPlusApi.Fcm.Data; | ||
|
||
var credentials = new Credentials | ||
{ | ||
Keys = new Keys | ||
{ | ||
PrivateKey = "", | ||
PublicKey = "", | ||
AuthSecret = "", | ||
}, | ||
Fcm = new FcmCredentials | ||
{ | ||
Token = "", | ||
PushSet = "", | ||
}, | ||
Gcm = new GcmCredentials | ||
{ | ||
Token = "", | ||
AndroidId = 0, | ||
SecurityToken = 0, | ||
AppId = "", | ||
} | ||
}; | ||
|
||
var listener = new FcmListener(credentials); | ||
|
||
listener.NotificationReceived += (_, message) => | ||
{ | ||
Console.WriteLine($"[MESSAGE]: {DateTime.Now}:\n{message}"); | ||
}; | ||
|
||
listener.ErrorOccurred += (_, error) => | ||
{ | ||
Console.WriteLine($"[ERROR]: {error}"); | ||
}; | ||
|
||
await listener.ConnectAsync(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using RustPlusApi.Fcm; | ||
using Newtonsoft.Json; | ||
|
||
// NOT WORKING, NEEDS TO BE FIXED | ||
return; | ||
|
||
/* var senderId = "976529667804"; | ||
var credentials = await FcmRegister.RegisterAsync(senderId); | ||
Console.WriteLine(JsonConvert.SerializeObject(credentials, Formatting.Indented));*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
using RustPlusApi; | ||
using Newtonsoft.Json; | ||
|
||
using RustPlusApi; | ||
|
||
using static __Constants.ExamplesConst; | ||
|
||
var rustPlus = new RustPlus(Ip, Port, PlayerId, PlayerToken); | ||
|
||
rustPlus.Connected += async (_, _) => | ||
{ | ||
await rustPlus.GetMapAsync(message => | ||
{ | ||
var imageData = message.Response.Map.JpgImage.ToByteArray(); | ||
if (imageData == null) return false; | ||
File.WriteAllBytes("map.jpg", imageData); | ||
Console.WriteLine(@"Saved under .\RustPlusApi\RustPlusApi\Examples\GetMap\bin\Debug\net8.0"); | ||
rustPlus.Dispose(); | ||
return true; | ||
}); | ||
var message = await rustPlus.GetMapAsync(); | ||
|
||
if (!message.IsSuccess) return; | ||
|
||
File.WriteAllBytes("map.jpg", message.Data?.JpgImage!); | ||
|
||
message.Data!.JpgImage = null; | ||
Console.WriteLine($"Infos:\n{JsonConvert.SerializeObject(message, JsonSettings)}"); | ||
|
||
Console.WriteLine($"Image saved under: {Directory.GetCurrentDirectory()}"); | ||
|
||
rustPlus.Dispose(); | ||
}; | ||
|
||
await rustPlus.ConnectAsync(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
15
RustPlusApi/Examples/GetSmartSwitchInfo/GetSmartSwitchInfo.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.