TCGaming.NET 1.0.0.2

Additional Details

This package is no longer supported and will no longer work due to changes to the TC Gaming API

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package TCGaming.NET --version 1.0.0.2
NuGet\Install-Package TCGaming.NET -Version 1.0.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TCGaming.NET" Version="1.0.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TCGaming.NET --version 1.0.0.2
#r "nuget: TCGaming.NET, 1.0.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TCGaming.NET as a Cake Addin
#addin nuget:?package=TCGaming.NET&version=1.0.0.2

// Install TCGaming.NET as a Cake Tool
#tool nuget:?package=TCGaming.NET&version=1.0.0.2

TCGaming.NET - [TC] Gaming

.NET Wrapper library for the [TC] Gaming API - Available for download via NuGet Package Manager! https://www.nuget.org/packages/TCGaming.NET/

PM> Install-Package TCGaming.NET -Version 1.0.0.2

[TC] Gaming API

This wrapper library was written to assist developers wishing to make use of the [TC] Gaming API (further information available at [TC] Gaming)

Functionality

Currently, all CityDriving Statistic API's are supported within this library. Various handling of data has been included to aid the user with conversions, such as:

  • UNIX Date & Time to System.DateTime object
  • String cleaner to remove colour and language formatting from Live For Speed
  • Gaming time conversions
  • Driven distance unit conversions

API Keys

API Keys are available from [TC] World > My Account (You must be a registered user within a [TC] CityDriving Server to access [TC] World)

Example Usage - Find all vehicles owned by a user

1. Pass your API Key

Configuration.AddAPIKey("YOUR_KEY");

2. Create a new instance of the UserProfile.Profile object

UserProfile.Profile myUser = new UserProfile.Profile("username");

3. Set what level of data you wish to return

There are various methods available within the Profile object, these are 'GetCars(), GetLicenses(), GetProperties(), GetUpgrades(), GetStats() and GetData()'. For this particular example, we must ensure the GetCars() method is used.

GetData() must be the last method to be called.

myUser.GetCars();
myUser.GetLicenses();
myUser.GetProperties();
myUser.GetUpgrades();
myUser.GetStats();
myUser.GetData();

You can also also chain these methods together

myUser.GetCars().GetLicenses().GetStats().GetData();

4. Iterate through the collection of Vehicles owned by the user.

foreach(UserProfile.Vehicle car in myUser.Cars)
{
    Console.WriteLine($"VIN: {car.VIN}");
    Console.WriteLine($"Condition: {car.Condition}");
    Console.WriteLine($"Model Type: {car.Type}");
}

Example Usage - Find all online users

1. Pass your API Key

Configuration.AddAPIKey("YOUR_KEY");

2. Create a new instance of Statistics.OnlineUsers

Statistics.OnlineUsers onlineUsers = new Statistics.OnlineUsers();

3. Construct your GetData() call similar to that of the previous example

You can specify the number of rows to return in the collection, and how many to skip using the GetRows() and SkipRows() methods.

onlineUsers.GetRows(10).SkipRows(5).GetData();

4. Access the data

Indexers make it easy to find a specific user within the collection. You can search by LFS (Live For Speed) Username or simply the index of the collection:

string username = onlineUsers[0].Username;
string car = onlineUsers[0].Car;
int money = onlineUsers[0].Money;
string username = onlineUsers["user"].Username;
string car = onlineUsers["user"].Car;
int money = onlineUsers["user"].Money;

Lets work together!

If you find any bugs or have suggestions as to how this library could be improved - drop me a message! Or even better, fork the code and send a pull request!

Mentions

Uses Newtonsoft.Json library for handling of JSON.

Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated

Initial Release - Version 1.0.0.2