257 lines
7.4 KiB
C#
257 lines
7.4 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Sony.NP
|
|
{
|
|
// Token: 0x02000009 RID: 9
|
|
public class ResponseBase
|
|
{
|
|
// Token: 0x06000020 RID: 32
|
|
[DllImport("UnityNpToolkit2")]
|
|
private static extern void PrxReadResponseBase(uint nptRequestId, FunctionTypes apiCalled, out int returnCode, out bool locked, out APIResult result);
|
|
|
|
// Token: 0x06000021 RID: 33
|
|
[DllImport("UnityNpToolkit2")]
|
|
private static extern void PrxReadResponseBaseLockedState(uint nptRequestId, FunctionTypes apiCalled, out bool locked, out APIResult result);
|
|
|
|
// Token: 0x06000022 RID: 34
|
|
[DllImport("UnityNpToolkit2")]
|
|
private static extern void PrxReadResponseCompleted(uint nptRequestId, FunctionTypes apiCalled, out APIResult result);
|
|
|
|
// Token: 0x06000023 RID: 35
|
|
[DllImport("UnityNpToolkit2")]
|
|
[return: MarshalAs(UnmanagedType.I1)]
|
|
private static extern bool PrxReadHasServerError(uint nptRequestId, FunctionTypes apiCalled, out APIResult result);
|
|
|
|
// Token: 0x06000024 RID: 36
|
|
[DllImport("UnityNpToolkit2")]
|
|
private static extern void PrxMarshalResponse(uint npRequestId, FunctionTypes apiCalled, out NpMemoryBuffer data, out APIResult result);
|
|
|
|
// Token: 0x1700000D RID: 13
|
|
// (get) Token: 0x06000025 RID: 37 RVA: 0x00002434 File Offset: 0x00001434
|
|
public int ReturnCodeValue
|
|
{
|
|
get
|
|
{
|
|
return this.returnCode;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700000E RID: 14
|
|
// (get) Token: 0x06000026 RID: 38 RVA: 0x0000244C File Offset: 0x0000144C
|
|
public Core.ReturnCodes ReturnCode
|
|
{
|
|
get
|
|
{
|
|
return (Core.ReturnCodes)this.returnCode;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700000F RID: 15
|
|
// (get) Token: 0x06000027 RID: 39 RVA: 0x00002464 File Offset: 0x00001464
|
|
public bool Locked
|
|
{
|
|
get
|
|
{
|
|
return this.locked;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000010 RID: 16
|
|
// (get) Token: 0x06000028 RID: 40 RVA: 0x0000247C File Offset: 0x0000147C
|
|
public ServerErrorManaged ServerError
|
|
{
|
|
get
|
|
{
|
|
return this.serverError;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000029 RID: 41 RVA: 0x00002494 File Offset: 0x00001494
|
|
internal ResponseBase()
|
|
{
|
|
}
|
|
|
|
// Token: 0x17000011 RID: 17
|
|
// (get) Token: 0x0600002A RID: 42 RVA: 0x000024A0 File Offset: 0x000014A0
|
|
public bool IsErrorCode
|
|
{
|
|
get
|
|
{
|
|
return this.returnCode >= -2113929216 && this.returnCode <= -2097152001;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000012 RID: 18
|
|
// (get) Token: 0x0600002B RID: 43 RVA: 0x000024DC File Offset: 0x000014DC
|
|
public bool HasServerError
|
|
{
|
|
get
|
|
{
|
|
return this.serverError != null;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600002C RID: 44 RVA: 0x000024FC File Offset: 0x000014FC
|
|
internal void PopulateFromNative(uint nptRequestId, FunctionTypes apiCalled, RequestBase request)
|
|
{
|
|
this.ReadResult(nptRequestId, apiCalled, request);
|
|
APIResult apiresult;
|
|
ResponseBase.PrxReadResponseCompleted(nptRequestId, apiCalled, out apiresult);
|
|
if (apiresult.RaiseException)
|
|
{
|
|
throw new NpToolkitException(apiresult);
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600002D RID: 45 RVA: 0x00002534 File Offset: 0x00001534
|
|
protected internal virtual void ReadResult(uint id, FunctionTypes apiCalled, RequestBase request)
|
|
{
|
|
bool flag;
|
|
APIResult apiresult;
|
|
ResponseBase.PrxReadResponseBase(id, apiCalled, out this.returnCode, out flag, out apiresult);
|
|
if (apiresult.RaiseException)
|
|
{
|
|
throw new NpToolkitException(apiresult);
|
|
}
|
|
if (ResponseBase.PrxReadHasServerError(id, apiCalled, out apiresult))
|
|
{
|
|
this.serverError = new ServerErrorManaged();
|
|
this.serverError.ReadResult(id, apiCalled);
|
|
}
|
|
if (apiresult.RaiseException)
|
|
{
|
|
throw new NpToolkitException(apiresult);
|
|
}
|
|
this.locked = flag;
|
|
}
|
|
|
|
// Token: 0x0600002E RID: 46 RVA: 0x000025B0 File Offset: 0x000015B0
|
|
internal void UpdateAsyncState(uint nptRequestId, FunctionTypes apiCalled)
|
|
{
|
|
APIResult apiresult;
|
|
ResponseBase.PrxReadResponseBaseLockedState(nptRequestId, apiCalled, out this.locked, out apiresult);
|
|
if (apiresult.RaiseException)
|
|
{
|
|
throw new NpToolkitException(apiresult);
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600002F RID: 47 RVA: 0x000025E4 File Offset: 0x000015E4
|
|
internal MemoryBuffer BeginReadResponseBuffer(uint id, FunctionTypes apiCalled, out APIResult result)
|
|
{
|
|
NpMemoryBuffer npMemoryBuffer = default(NpMemoryBuffer);
|
|
ResponseBase.PrxMarshalResponse(id, apiCalled, out npMemoryBuffer, out result);
|
|
if (result.RaiseException)
|
|
{
|
|
throw new NpToolkitException(result);
|
|
}
|
|
MemoryBuffer memoryBuffer = new MemoryBuffer(npMemoryBuffer);
|
|
memoryBuffer.CheckStartMarker();
|
|
return memoryBuffer;
|
|
}
|
|
|
|
// Token: 0x06000030 RID: 48 RVA: 0x00002631 File Offset: 0x00001631
|
|
internal void EndReadResponseBuffer(MemoryBuffer readBuffer)
|
|
{
|
|
readBuffer.CheckEndMarker();
|
|
}
|
|
|
|
// Token: 0x06000031 RID: 49 RVA: 0x0000263C File Offset: 0x0000163C
|
|
public string ConvertReturnCodeToString(FunctionTypes apiCalled)
|
|
{
|
|
string text = "(0x" + this.returnCode.ToString("X8") + ")";
|
|
Core.ReturnCodes returnCodes = (Core.ReturnCodes)this.returnCode;
|
|
if (apiCalled != FunctionTypes.Invalid)
|
|
{
|
|
if (apiCalled <= FunctionTypes.NpUtilsDisplaySigninDialog)
|
|
{
|
|
switch (apiCalled)
|
|
{
|
|
case FunctionTypes.CommerceDisplayCategoryBrowseDialog:
|
|
case FunctionTypes.CommerceDisplayProductBrowseDialog:
|
|
case FunctionTypes.CommerceDisplayVoucherCodeInputDialog:
|
|
case FunctionTypes.CommerceDisplayCheckoutDialog:
|
|
case FunctionTypes.CommerceDisplayJoinPlusDialog:
|
|
case FunctionTypes.CommerceDisplayDownloadListDialog:
|
|
case FunctionTypes.FriendsDisplayFriendRequestDialog:
|
|
case FunctionTypes.FriendsDisplayBlockUserDialog:
|
|
break;
|
|
case FunctionTypes.CommerceSetPsStoreIconDisplayState:
|
|
case FunctionTypes.EventsClientGetEvent:
|
|
case FunctionTypes.FriendsGetFriends:
|
|
case FunctionTypes.FriendsGetFriendsOfFriends:
|
|
case FunctionTypes.FriendsGetBlockedUsers:
|
|
goto IL_11C;
|
|
default:
|
|
if (apiCalled != FunctionTypes.MessagingDisplayReceivedGameDataMessagesDialog && apiCalled != FunctionTypes.NpUtilsDisplaySigninDialog)
|
|
{
|
|
goto IL_11C;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
else if (apiCalled <= FunctionTypes.TrophyUnlock)
|
|
{
|
|
if (apiCalled != FunctionTypes.SessionDisplayReceivedInvitationsDialog)
|
|
{
|
|
if (apiCalled != FunctionTypes.TrophyUnlock)
|
|
{
|
|
goto IL_11C;
|
|
}
|
|
if (returnCodes == Core.ReturnCodes.DIALOG_RESULT_USER_CANCELED)
|
|
{
|
|
return text + " (TROPHY_PLATINUM_UNLOCKED) ";
|
|
}
|
|
goto IL_13F;
|
|
}
|
|
}
|
|
else if (apiCalled != FunctionTypes.TrophyDisplayTrophyListDialog)
|
|
{
|
|
switch (apiCalled)
|
|
{
|
|
case FunctionTypes.UserProfileDisplayUserProfileDialog:
|
|
case FunctionTypes.UserProfileDisplayGriefReportingDialog:
|
|
break;
|
|
default:
|
|
goto IL_11C;
|
|
}
|
|
}
|
|
if (returnCodes == Core.ReturnCodes.SUCCESS)
|
|
{
|
|
return text + " (DIALOG_RESULT_OK) ";
|
|
}
|
|
if (returnCodes == Core.ReturnCodes.DIALOG_RESULT_USER_CANCELED)
|
|
{
|
|
return text + " (DIALOG_RESULT_USER_CANCELED) ";
|
|
}
|
|
goto IL_13F;
|
|
IL_11C:
|
|
if (this.returnCode == 0)
|
|
{
|
|
return text + " (SUCCESS) ";
|
|
}
|
|
IL_13F:;
|
|
}
|
|
if (Enum.IsDefined(typeof(Core.ReturnCodes), returnCodes))
|
|
{
|
|
text = text + " (" + returnCodes.ToString() + ") ";
|
|
}
|
|
else
|
|
{
|
|
text += " (UNKNOWN) ";
|
|
}
|
|
return text;
|
|
}
|
|
|
|
// Token: 0x04000017 RID: 23
|
|
internal int returnCode;
|
|
|
|
// Token: 0x04000018 RID: 24
|
|
internal bool locked;
|
|
|
|
// Token: 0x04000019 RID: 25
|
|
internal ServerErrorManaged serverError;
|
|
}
|
|
}
|