Tag Archives: csharp

Dota 2 .Net C# Tool pt2

Welcome back! Today I will go over some code on how to get match details and also how to cleanup some of the text that we have. Assuming that you have been following along with the previous post, I will be using those classes and code in this part as well.

Let us first start by getting the latest matches, this will allow us to set the foundation for a later time when we want to query for a match in particular. Start by creating a class that will hold our match details

(classes were generated using json2csharp: http://json2csharp.com/)

Now that we have our class created, lets get a few other methods in place which are used at a later time.

Since heroes are being added at certain times of the year, I wanted to have a somewhat generic method to pull up names based off of there index number. Thsi is my way of doing just that, this method expects a list of heroes (see part 1 of this tutorial) and then it maps the hero found in a match to one in the list.

And here is the method to get the latest 500 matches

And here are some helper methods

Once you have all of these things in place, usage is:

That is it for part 2 of this guide in this series, next step for me is to go back and do a bunch of code cleanup before I start publishing more content.

ps. I wanted to give you guys some background about me, I am a engineer by trade and I work primarily in infrastructure management. All of my coding experience is self taught, I wish I could have gone to school for this because I feel like it might be my calling but I understand that I have a lot to learn. So with that being said, please take the advice/tips that are given here with a grain of salt and do some of your own research. One day I do hope to be a master in programming but even a master fails many many times. My goal is to work together with the people of the internet and create something beautiful out of this project but I understand that it will take time to get there. Good luck with the coding guys and drop by soon for the next iteration in this series!