コード例 #1
0
        private void FetchError()
        {
            // We assume the request is empty when the Id is 0 and skip error fetching.
            // This happens during the serialization process as empty instances are created
            // in place of null references.
            if (Id == 0 || m_ErrorFetched || NativeStatus.ConvertToManaged() != StatusCode.Failure)
            {
                return;
            }

            m_ErrorFetched = true;
            m_Error        = NativeClient.GetOperationError(Id);

            if (m_Error == null)
            {
                if (NativeStatus == NativeStatusCode.NotFound)
                {
                    m_Error = new Error(NativeErrorCode.NotFound, "Operation not found");
                }
                else
                {
                    m_Error = new Error(NativeErrorCode.Unknown, "Unknown error");
                }
            }
        }
コード例 #2
0
        bool CheckPackmanOperation(long operationId, PackmanOperationType operationType)
        {
            NativeStatusCode statusCode = NativeClient.GetOperationStatus(operationId);

            if (statusCode == NativeStatusCode.NotFound)
            {
                Debug.LogError("OperationID " + operationId + " Not Found");
                return(true);
            }
            else if (statusCode == NativeStatusCode.Error)
            {
                Error error = NativeClient.GetOperationError(operationId);
                Debug.LogError("OperationID " + operationId + " failed with Error: " + error);
                return(true);
            }
            else if (statusCode == NativeStatusCode.InProgress || statusCode == NativeStatusCode.InQueue)
            {
                return(false);
            }
            else if (statusCode == NativeStatusCode.Done)
            {
                System.Console.WriteLine("OperationID " + operationId + " Done");
                switch (operationType)
                {
                case PackmanOperationType.List:
                    ExtractCurrentXiaomiPackageInfo(operationId);
                    break;

                case PackmanOperationType.Add:
                    currentXiaomiPackageVersion = latestXiaomiPackageVersion;
                    xiaomiPackageInstalled      = true;
                    break;

                case PackmanOperationType.Remove:
                    currentXiaomiPackageVersion = "";
                    xiaomiPackageInstalled      = false;
                    break;

                case PackmanOperationType.Search:
                    ExtractLatestXiaomiPackageInfo(operationId);
                    break;

                default:
                    System.Console.WriteLine("Type " + operationType + " Not Supported");
                    break;
                }
                return(true);
            }

            return(true);
        }
コード例 #3
0
        private void FetchError()
        {
            if (m_ErrorFetched || NativeStatus.ConvertToManaged() != StatusCode.Failure)
            {
                return;
            }

            m_ErrorFetched = true;
            m_Error        = NativeClient.GetOperationError(Id);

            if (m_Error == null)
            {
                if (NativeStatus == NativeStatusCode.NotFound)
                {
                    m_Error = new Error(ErrorCode.NotFound, "Operation not found");
                }
                else
                {
                    m_Error = new Error(ErrorCode.Unknown, "Unknown error");
                }
            }
        }