Exemplo n.º 1
0
        ///<summary>
        ///Check the queue of incomming message.
        ///</summary>
        ///<remarks>
        ///When an incomming message is in the queue, add it to the response map using the key
        ///this is part of the message string.
        ///</remarks>
        void processQueue()
        {
            while (ResponseQueue.Count > 0)
            {
                try
                {
                    string input;
                    lock (ResponseQueue)
                    {
                        input = ResponseQueue.Dequeue();
                    }

                    string[] tokens = input.Split('|');
                    int      key    = System.Convert.ToInt32(tokens[tokens.Length - 1]);

                    lock (CallbackValues)
                    {
                        CallbackValues[key]                  = new Unity_ScormBridge.APICallResult();
                        CallbackValues[key].Result           = tokens[0];
                        CallbackValues[key].ErrorCode        = tokens[1];
                        CallbackValues[key].ErrorDescription = tokens[2];
                        CallbackValues[key].Key              = tokens[tokens.Length - 1];
                    }
                }
                catch (Exception e)
                {
                    UnityEngine.Application.ExternalCall("DebugPrint", "error " + e.Message);
                }
            }
        }
        ///<summary>
        ///Check the queue of incomming message.
        ///</summary>
        ///<remarks>
        ///When an incomming message is in the queue, add it to the response map using the key
        ///this is part of the message string.
        ///</remarks>
        void processQueue()
        {
            while (ResponseQueue.Count > 0)
            {
                try
                {
                    string input;
                        lock (ResponseQueue)
                    {
                        input = ResponseQueue.Dequeue();
                    }

                    string[] tokens = input.Split('|');
                    int key = System.Convert.ToInt32(tokens[tokens.Length-1]);

                    lock (CallbackValues)
                    {
                        CallbackValues[key] = new Unity_ScormBridge.APICallResult();
                        CallbackValues[key].Result = tokens[0];
                        CallbackValues[key].ErrorCode = tokens[1];
                        CallbackValues[key].ErrorDescription = tokens[2];
                        CallbackValues[key].Key = tokens[tokens.Length-1];
                    }
                }
                catch (Exception e)
                {
                    UnityEngine.Application.ExternalCall("DebugPrint", "error " + e.Message);
                }
            }
        }