Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Steam Community & ID Converts Visa Versa...
- Algorithms from:
- * http://www.martinpace.com/downloads/SteamIDtoCommunityID.pdf
- * http://stackoverflow.com/questions/7074978/conversion-to-64-bit-int
- ---|> Twitter: @Harrymilnes
- */
- public static string Id2SteamIdConverter(long param) // STEAM_0:0:41832667 TO 76561198043931062
- {
- string steamIdentifier;
- if (param % 2 == 0) { // Use Modulus to see if the param is even.
- steamIdentifier = "STEAM_0:0:"; // It's gonna be even so we use this string
- } else {
- steamIdentifier = "STEAM_0:1:"; // It's gonna be odd so we use this string
- }
- var identifierSubtract = param - 76561197960265728; // We subract a base number from the param
- var identifierTotal = identifierSubtract / 2; // Half the total
- return steamIdentifier + identifierTotal; // YEAHHH BOII!
- }
- public static long SteamId2IdConverter(string param) // 76561198043931062 TO STEAM_0:0:41832667
- {
- var splitInfo = param.Split(':'); //Do da splitz.
- var identifierMultiply = Int64.Parse(splitInfo[2]) * 2; // Multiply the unique number by 2 STEAM_0:0: [ 41832667 ] < DAT BIT
- var identifierTotal = identifierMultiply + 76561197960265728;
- identifierTotal += Int64.Parse(splitInfo[1]); // Add the odd / even identifier :1: / :0:
- return identifierTotal; // Hoorah.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement