Tag Archives: C#


#100 Monitoring A Line UPS Remotely

Modernizing the old UPSilon 2000 application was a daunting task my first thought was to read the serial output but unfortunately the UPS is listed as a HID device and not a simple COM port. So I went down the rabbit hole of trying to communicate with hid devices which have strict security to combat keyloggers. I tried to use kernel32 and the create file read and write file methods but I got access denied. Looking closer I could read some of the inputs of the ups hid device but it was going to take too long to figure out direct communication to the ups without an SDK or a good example app using USB HID to communicate with a UPS.

Computer Management Hid UPS

Some details of my ups hid were:
VID = 0001 PID = 0000 Path = \?\hid#vid_0001&pid_0000#6&7efa158&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} SerialNumber = Manufacturer = MEC Product: MEC0003

Communication over USB

So after wasting 2 days I went back to the drawing board this time instead of using Wireshark to catch the USB packets I decided to take a closer look at the upsilon 2000 application. unfortunately the .dll's don’t show any useful functions in dependency viewer so I can’t call C++ functions from them in C#. So next I switched Wireshark to local monitoring and I found some very useful traffic.

tcp.port == 2570 connect as a client and get data
tcp.port == 8652 read the data from the sms server
udp.port == 11541 udp data

Port 8652 allows me to read alerts sent to the SMS server but instead I re-direct them to my C# application.

GET /smssend_hide.cgi?$sms_recptmobile=0123456789&$sms_content=DESKTOP-294DAYV: This is a test message!&$sms_code=1 HTTP/1.1
User-Agent: RUPS2K SMS
Connection: Keep-Alive

Port 2570 allows me to TCP connect as a client with no auth and now I get all the stat report strings every 1 second.

(238.7 238.7 238.7 007 50.1 27.4 --.- 00001000

The UDP port 11541 always receives upsXXXcnt001 for constant monitoring and I haven’t observed any other use besides this.

ups000cnt001 – connected ups
upsdiscnt001 – not connected

The exe files communicating between themselves are
Monw32.exe 11541 udp listner
RupsMon.exe 2570 tcp listner
UPSilon.exe connects as client

So after finding this info I was able to build a C# app that works in conjunction with UPSilon 2000 but the C# app offers more flexibility such as remote messaging via Telegram or forwarding the stats to a webserver for remote viewing.

The application checks the cd key every time it starts it connects to an IP in Taiwan http://upsilon.icv99.net on port 80 however is you go to port 8080 you get a webpage cd key checking form.

Reporting serial key and NTFS to home via:

The only thing I couldn’t do was send commands directly to the ups because that communication link is done within the upsilon app itself however I am happy with the overall outcome.

Source code of my application can be found on GitHub


#89 An example app showing a practical use case with the API

Using the Eskom load-shedding API is very straight forward however I have noticed that a lot of people get stuck on the last call where an html document is returned instead of Json data. This can throw a spanner in the works because a developer can’t just get the results as a key value pair… the HTML must be parsed and then put into Json before it can be used effectively.

This parsing process is actually quite easy and jut requires a loop with a bit of regex magic to return the values line by line.

Once the values are returned we can then place them into our own Json object and then do something useful with them like creating a loop which reads the times and compares them to the time on my PC then when the json objects time is 10 minutes away the loop then initiates a shutdown of my fan so that it doesn’t drain my ups battery unnecessarily.

Below I have written a small proof of concept application in C# to help inspire others with their projects.

I make use of the LoadShedding.NET.dll library made by IsaTippens using my endpoint documentation and documentation from PolarizedIons.

However in the end I only focused on 2 API endpoints to simplify the example app.

This makes my example much simpler.

You can take a look at my example code on GitHub


#85 Designing a trainer/keygen in C#

When I think about trainers 3 things come to mind.. original chiptunes, nostalgic games on windows and imaginative unique art styles. funny enough there was a decent amount of programming hacks and tricks used but people rarely think of that nowadays.

I have created an example template application with just the chiptunes and a little bit of art included. I will not include any logic for cracking games or programs etc. this article is just focusing on the visual and music design for nostalgic and educational purposes.

Please se the GitHub link to the source code here.


#83 The differences between .Net Framework and .Net Core

.Net Framework was created around the year 2000. It’s not just C#, languages are built on top of the .Net Framework. they language like C# are converted into the common intermediate language (CIL).

.Net Framework is now over 20 years old. there’s a lot of checks and processes that have been added which bloat the system. However this is necessary because the .Net Framework still needs to work with older applications E.G an app made in the early 2000s.

So basically the .Net Framework is slowing down apps in the new world of software so many new advancements can’t be leveraged by the .Net Framework.

In 2016 Microsoft started the process of .Net Core. which is a new improved version of the .Net Framework with changes like how processes are executed and what is supported/not supported. Also a lot of backward compatibility has been removed for things no longer needed.

.Net Core has a massive speed increase compared to .Net Framework. Also the code in .Net Framework will run 97% of the time in .Net core however some structures and 3rd party dependencies will have to be changed this is true as of [.Net Core 5].

.Net Framework will still be supported for many years, however new development should be using .Net Core.


#70 FreeTAKServer Windows Manager Concept

FreeTAKServer manager control panel concept.

Just a quick C# working example of a FreeTAKServer Manager application for the Windows OS.

WinForms & WPF versions are supported.

The FreeTAKServer Manager C# application was created to make using the current v1.7 of FreeTAKServer more user friendly.

FreeTAKServer Manager has the ability to Start, Stop, Restart, Install and Uninstall the FreeTAKServer & FreeTAKServer-UI.

It can also start on startup, send alert emails, let the user test the API (localhost & custom), allow quick MainConfig.py & config.py edits, Open a portforward testing page.

The App requires Admin privilege in order to run cmd commands effectively.

Remove all previous Python environment variables (if you have them) because they mess up the paths.

N.B the application has been created with the microsoft Visual Studio 2019 Community IDE. (https://visualstudio.microsoft.com/vs/)

API testing form



#67 7zipExample Automation Application In C#

Example Video

While creating a download page for a website I came across the problem where the browser would open a .PDF file instead of downloading it to the desktop of my PC when using the JavaScript window.location.href = "url/path/file.pdf"; function. A quick easy solution is to archive the .PDF document as a .ZIP file or .7z etc. Now when the function is called the file will be downloaded.

Using a quick C# WinForms application I was able to automate the process. Here I have included a small demo project which may be useful on windows machines.

The Main function is as below:

Example code of the main function.

A new process is started and Arguments are sent to the 7za.exe console application.

7za.exe can also be used in the CMD console as well as with scripting languages such as PowerShell or Batch.



Form C# Email Example

A simple C# WinForms desktop application to send a text email/send an attachment email.

This application uses no special class. The default mail classes are used namely:

using System.Net.Mail;

using System.Net.Mime;

The email text is sent in HTML format:

var mailMessage = new MailMessage{                     From = new MailAddress(Vars._mailFrom),//email            Subject = "C# WinForms Test Mail",                     Body = "<h1>Hello</h1>" + "<h2>C# WinForms Test Mail</h2>",                     IsBodyHtml = true,};



Trey icon controls.

For years consumers have been asking for steam to add a feature to all them to shutdown their computers after downloading games or after a certain period of time.

This is very useful especially for students who have limited capped internet access due to financial reasons… etc… especially in this day and age where the average game can be roughly up to 120GB!! in size… downloading is a long and tedious task especially in 3rd world country’s…

Enter the C# tray app SteamShutdown. This lightweight app allows users to shutdown, hibernate or put the PC to sleep once all downloads have completed.

The app was designed with the logic being:

  1. Setup downloads at 12am.
  2. Choose an option shutdown, hibernate or sleep.
  3. Go to bed without worrying about bandwidth costs and electricity costs 🙂



simple Traccar control panel concept

When managing multiple servers it’s always a good idea to have a centralised control panel monitoring/logging all the services running. In this example concept I have a WPF(Windows Presentation Foundation) C# page. This works well with 4K screens as well as lower resolutions.

The panel allows control and logging/messaging features.


  • Controlling start, stop, restart.
  • Logging events, errors results and user activity.
  • Sending email notifications when an event occurs.
  • Auto start and ease of use at start up.