RG API - Version 2....
 
Notifications
Clear all

RG API - Version 2.0 has been released

Page 1 / 4

Cyb3r
Posts: 1598
Topic starter
(@cyb3r)
Noble Member
Joined: 10 years ago

[INFORMATION=2.0 Update]Check last section to see the change log in the new version[/INFORMATION]

Hey guys, sorry for the delay I know I have promised to finish this long time ago, anyway here it is finally!

So let make this simple and clean, let me show you simple usage of the API.

First download the API with the Demo project from the attachments, you will find everything explained in the demo project but I will give a short tutorial here as well.

After downloading and extracting the API make sure to do this:

  • include all files from the folder "API" into your project folder, rg.ext is part of DNGuard libraries so the API wont work without them.
  • Go to project properties and change the Target framework to ".NET Framework 4.5" then go to build and set Platform Target to "AnyCPU" and check over "Prefer 32-Bit".

Now add the dll as a reference to your project, as I said make sure you move those 2 other files in the same folder as your tool.
After you done that add a new "windows form" to your project (this will be the verify form), then add this to the header of the new form:

using API = RG.API;

add a textbox and a button, text box for the key and button for the submission.

Now time to declare our variables for later use:

	KeyValuePair Response; // This will be the response from the server contains 2 returns
	Boolean valid; // First return as a bool
	dynamic user; // Second return as user dynamic array
	

double click on the button and add this to it's even handler:

	// gets the response from the server
	Response = API.validated(TextBox1.Text, "basic"); // TextBox1.Text is the key users entered
	// Boolean, Check if the user has been validated
	valid = Response.Key;
	// Dynamic array contains all user data, make sure the previous bool returned true before using this
	user = Response.Value;
	
	if (valid) // if the bool is true, means the user has been validated
	{
	       // Hide this form and show the tool
	       this.Hide();
	       Hide();
	       new MyTool().ShowDialog();
	       Close();
	}
	

[WARNING]From update 2.0 you have to provide a third parameter which will be the API Key[/WARNING]

API 2.0 change, just change this line:

	Response = API.validated(TextBox1.Text, "basic");
	

To this:

	Response = API.validated(TextBox1.Text, "basic", API_Key);
	

You still have the option to leave it blank if you don't want to call any data from the server.

You might have noticed this (API.validated(TextBox1.Text, "basic")), which means return the bool and basic user info like username, user_id, email and such, you can get the full user info by changing the param to "full", if you leave it empty it will return basic user info anyway.

And do not forget to make the Verify form as the main form on app launch, change it in the program.cs.

Optional but good things to is to set new setting string to store the key and reload each time the user open the app and validate it automatically, that will save a lot of time for the user, look to the demo source.

Finally here is a list of the objects in the user array as reference for you of you want to use them in anyway in your tool:

Basic user info:

	    "user_id": // Int
	    "username": // String
	    "email": // String
	    "gender": // String
	    "message_count": // Int
	    "is_moderator": // Int: 0 and 1, 0 = false and 1 = true
	    "is_admin": // Int: 0 and 1, 0 = false and 1 = true
	    "is_staff": // Int: 0 and 1, 0 = false and 1 = true
	

Extra user info comes with full user data (all strings):

	    "customFields": {
	        "aim":
	        "facebook":
	        "gtalk":
	        "hwid":
	        "icq":
	        "legendsUserProfile":
	        "minecraftUserProfile":
	        "originUserProfile":
	        "prime_key":
	        "psnUserProfile":
	        "skype":
	        "steamUserProfile":
	        "twitchUserProfile":
	        "twitter":
	        "xboxliveUserProfile":
	        "yahoo":
	        "youtubeUserProfile":
	    },
	

To use any of the array just add the the child name after the array "user" example:

	MessageBox.Show(user.username);
	

To use extra user info:

	MessageBox.Show(user.customFields.prime_key);
	
	// or
	
	MessageBox.Show(user.customFields.hwid);
	

In 2.0 update I have added new feature "API Vault" which can safely store any data you want to sync it remotely from the server to your tool and it will be impossible for anyone to access those data, it will be encrypted from the server to the tool, so here is how to user:

  1. Go to your API Vault: https://rivalgamer.com//api-vault/
  2. Create a new Vault and fill all required fields, you will notice that the API key has been automatically generated, copy it and click save.
  3. Make sure to provide the api Key in the third argument in the validate method.
  4. When successfully connected you can access your data like this:
  5. 	user.app_name; // Application Data
    	user.app_version; // Application Version
    	user.my_data; // Vault Data
    	

    Have fun guys. 😉

    Attached files

    RGAPI_2_0.zip (417.2 KB) 

Reply
Name of the Video Game, and any other Tags
17 Replies
KranK
Posts: 336
(@KranK)
Reputable Member
Joined: 9 years ago

This is great Mr Cyber , I was waiting for this

Reply
Cain532
Posts: 1280
(@cain532)
Noble Member
Joined: 10 years ago
Reply
Cyb3r
Posts: 1598
Topic starter
(@cyb3r)
Noble Member
Joined: 10 years ago

KranK Cain532 Please redownload the API I made some changes to the code, just replace the previous one, you don't have to re-compile your tool if you already linked the API just replace the old with the new one.

Reply
KranK
Posts: 336
(@KranK)
Reputable Member
Joined: 9 years ago

KranK Cain532 Please redownload the API I made some changes to the code, just replace the previous one, you don't have to re-compile your tool if you already linked the API just replace the old with the new one.

im doing i rn , was bussy a little

Reply
Page 1 / 4