SRCDS Steam group


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[C#] GameServer Banner Libary
#1
So as some might have noticed I am working on a all in one Server Application (Link)

For that I am rewriting large amounts of my own code base, and decided to publish this part.

It is a small Library that can create server banners.

Basic Example
Code:
// Create the image we will paint on
            Image img = new Bitmap(500, 200);
            
            // Query the Game Server
            aQueryLib.aQueryLib.GameServer gs = new aQueryLib.aQueryLib.GameServer("92.48.86.89", 27015, aQueryLib.aQueryLib.GameType.Source);

            // Text Array
            List<Text> TextList = new List<Text>();
            TextList.Add(new Text("Server Name: %hostname%", new System.Drawing.Font("Ariel", 10, FontStyle.Bold), new Point(0, 0), Color.Red, 100));
            TextList.Add(new Text("Map: %mapname%", new System.Drawing.Font("Ariel", 10, FontStyle.Bold), new Point(0, 20), Color.Blue, 100));

            // Create the image
            GameServerBanneCreator.GetImage(gs, ref img, ImageEnumArray.ToArray(), TextList.ToArray());

Image Enum Example
This will basically paint a image depending on how many players there is on the server
Code:
List<ImageEnum> ImageEnumArray = new List<ImageEnum>();

            // Make a Image Enum with Numbers.
            // Could be a simple progress bar or such too
            ImageEnum imgEnum = new ImageEnum(new PointF(0,40),"%numplayers%");
            imgEnum.AddImage("1", Image.FromFile("1player.jpg"));
            imgEnum.AddImage("2", Image.FromFile("2player.jpg"));
            imgEnum.AddImage("3", Image.FromFile("3player.jpg"));
            imgEnum.AddImage("4", Image.FromFile("4player.jpg"));
            imgEnum.AddImage("5", Image.FromFile("5player.jpg"));
            imgEnum.AddImage("6", Image.FromFile("6player.jpg"));
            imgEnum.AddImage("7", Image.FromFile("7player.jpg"));
            imgEnum.AddImage("8", Image.FromFile("8player.jpg"));
            imgEnum.AddImage("9", Image.FromFile("9player.jpg"));
            ImageEnumArray.Add(imgEnum);

There is a Test Project included in the zip, that demonstrate how to use the library.

Download
GameServerBannerLibary.zip

.zip   GameServerBannerLibary.zip (Size: 342.83 KB / Downloads: 21)

License
[Image: 88x31.png]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)