Iris is a GlobalMgrSvr Communication Library. In layman's terms, she lets you communicate with your server's GlobalMgrSvr and do things such as:
- Obtain information about the server, including how many people are logged on. You can even see how many people are in each map.
- Send a GM message by mail. Because this is done by directly communicating with the GMS, the GM mail appears on your users' screens immediately after sending it.
- Broadcast a message. This message will appear at the top-center and bottom-right of all connected users' screens.
- Disconnect all players from a channel. This is especially handy if you want to restart your server, or take it down for maintenance.
Iris is (soon-to-be) fully COM-visible, so she can be used with not only .Net languages like C# and VB.Net, but also native C++ and Autoit code (and anything else that supports COM).
To use Iris, simply reference her in your application, create an instance of the Iris.Communication class, then give it an IP and port to connect to. Here's an example in C#:
Code:
var iris = new Iris.Communication();
iris.Connect("192.168.1.2", 38170);
Simple, no? By default, Iris sends a "heartbeat" packet every 30000 milliseconds (30 seconds). You can, however, specify a custom interval. You can do so by passing the desired interval in milliseconds when you create an instance of Iris.Communication.
Code:
var iris = new Iris.Communication(5000); // 5 seconds
...
Iris can also notify your application when certain events happen, like receiving the channel list, for example.
Code:
var iris = new Iris.Communication(5000);
iris.Events.OnReceiveServerList += new iris.EventHandler.ServerListHandler(myApp_OnReceiveServerList);
iris.Connect("192.168.1.2", 38170);
...
Iris can easily send both GM messages and broadcasts using the same method.
Code:
iris.SendMessage(6, 3, "my message"); // Broadcasts "my message" to channel 3 on server 6.
iris.SendMessage(6, 0, "msg"); // BC's "msg" to all channels on server 6.
iris.SendMessage(4, new byte[] { 2, 4, 6 }, "msg"); // BC's "msg" to channels 2, 4, and 6 on server 4.
iris.SendMessage(5, 2, "title", "message"); // Sends a GM message with the title "title", and containing the message "message" to channel 2 on server 5.
// You can use the same sort of principles with Broadcasting as GM messages to send messages to multiple/all channels.
Iris can also disconnect all players from a specified channel. This helps prevent accidental rollbacks or data loss when taking your server down for maintenance. Just disconnect everyone before you shut your server down, and you're good to go
Code:
iris.DisconnectPlayers(6, 2); // Disconnects all players in channel 2 on server 6.
// You can do the same here as with Broadcasting to disconnect from multiple channels.
Time for the downloads
28/05/2012
Binary: View attachment Iris_28-05-12_rel.rar* Added SetChannelType(), which allows you to change the type of any given channel without restarting it. (Thanks to Phiber)
* Added new channel types and fixed existing ones. Channel type is now a flag enum, so several types can be combined.
* Improved the speed of the code, especially when the server list is received. Structures are no longer marshalled into arrays (THIS WAS SLOW!) and I borrowed PacketBuilder and PacketReader from another (abandoned) project of mine. I will likely do some further refining later.
* Restructured a lot of the code, partially to adjust for the speed improvements.
Source: View attachment Iris_28-05-12_src.rar
26/08/2010
Binary: http://files.thedivinityproject.com/Iris_Bins_26-08-10.rar* Fixed all disconnections inside Iris (Iris.Disconnect(), disconnections caused by the server, etc.).
* Changed "ServerListArgs" -> "ServerEventListArgs" (was a typo. Make sure to update this in your programs).
* Changed ServerListEventArgs.IP to show the local IP instead of the server's IP. It's much more useful this way, especially seeing as we already have the server's IP.
* Added 3 new events: OnConnect, OnDisconnect, and OnLogin. Check intellisense for more information.
* Fixed Channel.Type being set incorrectly and added Channel.IsOnline. It turns out I was using old code, and not the newest code from my personal broadcast tool :S. Anyways, the code has now been merged with Iris.
* Added <summary> tags to the enuerations.
* Maybe a few small changes. Can't remember. Nothing code-breaking.
Source: http://files.thedivinityproject.com/Iris_Source_26-08-10.rar
20/08/2010
Binary: http://files.thedivinityproject.com/Iris_Bins_20-08-10.rar
Source: http://files.thedivinityproject.com/Iris_Source_20-08-10.rar
NOTES:
- You will need at least Visual C# 2010 Express to compile Iris.
- All public members in Iris are accompanied by <summary> tags, so plenty of information is available via Intellisense while you code. Pay attention to the notes!
- Iris is licensed under the GPLv3 open-source license. Please be aware that this means you may NOT use Iris in commercial products. The license also requires that any publicly-released modifications and/or derivative works (including any program making use of Iris' functionality) be licensed under GPLv3. If you are unsure about some of the implications of the GPLv3 license, please don't hesitate to ask about it here.
- ALWAYS disconnect Iris before your application exits by calling "iris.Disconnect();". If you don't, a user slot will be taken up indefinitely in your GMS. Once all those slots are taken up, Iris will no longer be able to connect. You can remedy this by restarting your GMS.
- I plan to add more features to Iris later on, possibly including the ability to change a channel's type on-the-fly, and start/stop/restart channels.
- Most importantly, I WILL NOT OFFER ANY SUPPORT FOR IRIS. I have given you all plenty enough information, and more can be garnered from Intellisense and reading Iris' code. If you don't know how to program, that's not my fault. I suggest you start by picking a language, then Google some tutorials and read the language's documentation.
- If I have forgotten to add something or made some typo's, I will fix them when I wake up. I'm knackered, and I need to sleep. Good night, RaGEZONE.
- If you use Iris and would like to receive notifications of updates, please subscribe to this thread by using the following link: http://forum.ragezone.com/subscription.php?do=addsubscription&t=686941
- TDP 4 presuhdentz =B
!!IMPORTANT!!
If you wish to protect your server from unauthorized access to your GMS, either change your GMS's port to something other than 38170, or restrict access to only certain safe IP's via Windows IPSec, Linux IPTables, or Linux hosts.allow/hosts.deny. If you don't do this, anyone will be able to broadcast and disconnect your players. Information on how to prevent this can be found by Google'ing.
Last edited: