Skip to content

Instantly share code, notes, and snippets.

@jakevsrobots
Created June 29, 2012 01:03
Show Gist options
  • Save jakevsrobots/3015041 to your computer and use it in GitHub Desktop.
Save jakevsrobots/3015041 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System;
using System.Runtime.InteropServices;
public class AppUp {
public static bool isTesting = true;
[DllImport ("baKno")]
public static extern int ConnectToIntelADP(uint l1, uint l2, uint l3, uint l4, string bkid);
[DllImport ("baKno")]
public static extern int GetIntelADPStatus();
[DllImport ("baKno")]
public static extern int BeginIntelEvent();
[DllImport ("baKno")]
public static extern int EndIntelEvent();
[DllImport ("baKno")]
public static extern void DisconnectFromIntel();
[DllImport ("baKno")]
public static extern int Upgrade(uint l1, uint l2, uint l3, uint l4);
public static void Connect() {
int connectionResult;
if(isTesting) {
connectionResult = ConnectToIntelADP(0x11111111, 0x11111111, 0x11111111, 0x11111111, "11111111-1111-1111-1111-111111111111");
} else {
// TODO: Real data here:
connectionResult = ConnectToIntelADP(0x11111111, 0x11111111, 0x11111111, 0x11111111, "11111111-1111-1111-1111-111111111111");
}
string logMessage = "";
if (connectionResult == -1) logMessage = "Failure communicating with the Application Store.";
if (connectionResult == 1) logMessage = "General failure initializing the application.";
if (connectionResult == 2) logMessage = "Error: The Client Agent is not available.";
if (connectionResult == 3) logMessage = "Error: Incompatible version.";
if (connectionResult == 4) logMessage = "Error: Communication data too big.";
if (connectionResult == 6) logMessage = "Error: Application is not authorized to run.";
if (connectionResult == 7) logMessage = "Error: Authorization token could not be refreshed.";
if (connectionResult == 8) logMessage = "Error: No application begin event.";
if (connectionResult == -10) logMessage = "Error: The baKno ID is invalid.";
Debug.Log(connectionResult);
Debug.Log(logMessage);
BeginIntelEvent();
}
public static void Disconnect() {
EndIntelEvent();
DisconnectFromIntel();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment