public void GetSessionInfo(ref udSessionInfo info) { udError error = udContext_GetSessionInfo(pContext, ref info); if (error != Vault.udError.udE_Success) { throw new Exception("udContext.Disconnect failed."); } }
/* * Logs the time until the license expires to the console every second */ public void LogLicenseStatus() { while (true) { try { udSessionInfo info = new udSessionInfo(); GlobalVDKContext.vContext.GetSessionInfo(ref info); System.DateTime epochStart = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); ulong cur_time = (ulong)(System.DateTime.UtcNow - epochStart).TotalSeconds; string name = new string(info.displayName); name = name.Trim('\0'); UnityEngine.Debug.Log((info.isOffline == 1?" Offline":" Online") + " License Expiry: " + (info.expiresTimestamp - cur_time).ToString()); Thread.Sleep(1000); } catch { continue; } } }
private static extern udError udContext_GetSessionInfo(IntPtr pContext, ref udSessionInfo pInfo);