Renegade Public Forums
C&C: Renegade -- Dead since 2012!™
Home » Renegade Discussions » Mod Release Forum » Renegade WOLAPI written with C#
Renegade WOLAPI written with C# [message #493081] Sun, 19 May 2019 02:54
MasterCan  is currently offline MasterCan  
Messages: 13
Registered: August 2017
Recruit
From: 94.121.136*
The first WOL API written with C# by me.

Thanks for Olaf @ xwis.net, ExEric3 and unknown for the contribution of this API!
The download has 2 files. RenWOL_API.dll, which is API file. And WOLAPITestClient.exe

WOLTestClient.exe depends on API file to work. You can test the API features with Test Client.
Please report the bugs to me from Discord (The Unstoppable (TR)#1065) or find me from MPF Discord http://multiplayerforums.com/discord
You can ask your question to me from my Discord anytime.


Documentation:

API has 2 basic calls to receive server list.
First, you have to login with the call specified below. This call logs into XWIS if the supplied parameters are valid.
You must add the class name "WOLManager" for calling the calls listed below. They are members of "WOLManager" class.


Example call for newbie n00bs:
var LoginResult = WOLManager.Login("0669000000000000", "Example", "1234abcd");


Logging in:

public static string Login(string serial, string username, string password)

This call returns the codes below:
- "success": Successfully logged into XWIS.
- "apgar_error": Password encryption error. (Password length is wrong.)
- "wrong_credentails": Credentails are wrong.
- "read_error": Connection socket error. Probably server closed connection or network issue.
- "no_need": API already logged in.
- "api_error": Unhandled exception. (Please report the bug if you face with this code.)



Retrieving server list:

public static WOLConnection GetWOLData()


This call return the WOL data with the servers.
WOLConnection class returns WOL/XWIS host IP, Port, service name, and servers as a Collection that includes WOLServer class.
If the code fails at a point, call returns the data it got so far.
WOLServer class includes all of the server information received from WOL/XWIS.



Sending page:

public static string SendPage(string username, string message)

The call above sends a page to user if user is online.
This call returns the codes below:
- "success": The page is successfully sent to receiver.
- "error": Connection socket failed to send page command.
- "user_offline": Receiving user is offline.
- "need_login": API hadn't logged in and it needs to be logged in.
- "api_error": Unhandled exception. (Please report the bug if you face with this code.)



Logging out:
public static string Logout()

This call logs out the user if there is a logged in account.
This call returns the codes below:
- "success": The user is successfully logged out.
- "error": Connection socket failed to send logout command.
- "no_need": There are no users logged in.



Joining into a channel:

public static KeyValuePair<string, WOLServerData> JoinChannel(string channel)

WARNING! This code is not yet fully completed and might behave uncorrectly if used inproperly.
This call joins to a channel and returns the server data of the joined channel.
The call returns a result text, and the Server Data if result is success. If the result is not success, Server Data will be null.

This call's result text return the codes below:
- "invalid_game": Channel not exist.
- "join_error": API failed to join the specified channel.
- "nat_error": API failed to get NAT results of the game.
- "rginfo_error": API failed to get server data.
- "success": The server data is successfully received.
If the result text returns "nat_error" or "rginfo_error", It is preferred to call PartChannel() to prevent the bug(s) in your application.



Leaving (parting) a channel:
public static string PartChannel(string channel)

This call leaves the channel specified. Specifying invalid channel name causes freeze.
This call returns the codes below:
- "success": Successfully left a channel.
- "api_error": Unhandled exception. (Please report the bug if you face with this code.)



Listing buddies:

public static List<WOLUser> GetBuddies()

This call gets all buddies you added from WOL/XWIS.
WOLUser class contains buddies' nickname, status, and channel if s/he is in a channel.
If the code fails at a point, call returns the data it got so far.



Adding a buddy:

public static string AddBuddy(string nick)

This call adds a buddy to your WOL/XWIS account You have to get buddies for see the new buddy added.
This call returns the codes below:
- "success": Successfully added buddy.
- "api_error": Unhandled exception. (Please report the bug if you face with this code.)




Removing a buddy:

public static string RemoveBuddy(string nick)

This call removes a buddy from your WOL/XWIS account.
This call returns the codes below:
- "success": Successfully removed buddy.
- "api_error": Unhandled exception. (Please report the bug if you face with this code.)



Getting raw network stream between API <=> WOL/XWIS:
public static NetworkStream GetStream()

WARNING! This call is strictly unrecommended and it may cause bugs, crashes, freezes if used inproperly.

Gets the client connection stream between the server and API.

[Updated on: Sun, 19 May 2019 02:56]

Previous Topic:Dragonade 1.97 for Scripts 4.6 Update 7
Next Topic: Dragonade 1.98 for Scripts 4.6 Update 7
Goto Forum:
  


Current Time: Sat Jun 15 13:40:18 MST 2019
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7RC2.
Copyright ©2001-2007 FUD Forum Bulletin Board Software