Exemplo n.º 1
0
        /// <summary>
        /// Process one inbound Chunk, returning a list of equivalent ArchiveRtNav objects, or null.
        /// </summary>
        /// <param name="rtobj"></param>
        /// <returns></returns>
        public List <object> Accept(object rtobj)
        {
            List <object> rtObjects = new List <object>();

            if (rtobj is CP3.Network.Chunking.Chunk)
            {
                CP3.Network.Chunking.Chunk chunk = (CP3.Network.Chunking.Chunk)rtobj;
                Debug.WriteLine("Receiving chunk: " + chunk.FrameSequence.ToString());
                object message = m_ChunkAssembler.Assemble(chunk);
                if (message is IEnumerable <object> )
                {
                    foreach (CP3.Network.Messages.Message m in  ((IEnumerable <object>)message))
                    {
                        //Debug.WriteLine("Process Message Graph: " + m.ToString());
                        ProcessMessageGraph(m, rtObjects);
                        string s = m_Cache.GetWarnings();
                        if (s != null)
                        {
                            warningLog.Add(s);
                        }
                    }
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                string s = "CP3Manager: Input object is not a Chunk (ignoring): " + rtobj.ToString();
                warningLog.Add(s);
                return(null);
            }
            return(rtObjects);
        }
Exemplo n.º 2
0
        /// <summary>
        /// if the chunk identifies the role, return the numeric value.  Also look for the human name of the presenter.
        /// 1:instructor;2:shared display;3:student;other vaules:unknown.
        /// </summary>
        /// <param name="chunk"></param>
        /// <param name="presenterName"></param>
        /// <returns></returns>
        public static int AnalyzeChunk(UW.ClassroomPresenter.Network.Chunking.Chunk chunk, out string presenterName)
        {
            presenterName = "";

            if (chunk.NumberOfChunksInMessage == 1)
            {
                MemoryStream    ms        = new MemoryStream(chunk.Data);
                BinaryFormatter formatter = new BinaryFormatter();
                object          decoded   = null;
                try {
                    decoded = formatter.Deserialize(ms);
                }
                catch (Exception e)
                { // Most likely a new or unknown message type
                    Debug.WriteLine(e.ToString());
                }
                if (decoded is CP3.Network.Messages.Message)
                {
                    CP3.Network.Messages.Message m = (CP3.Network.Messages.Message)decoded;
                    if (m is CP3Msgs.PresentationInformationMessage)
                    {
                        CP3Msgs.PresentationInformationMessage pim = (CP3Msgs.PresentationInformationMessage)m;
                        return(1);
                    }
                    else if (m is CP3.Network.Messages.Network.ParticipantGroupAddedMessage)
                    {
                        CP3.Network.Messages.Network.ParticipantGroupAddedMessage gim = (CP3.Network.Messages.Network.ParticipantGroupAddedMessage)m;
                        if (gim.Singleton)
                        {
                            presenterName = gim.FriendlyName;
                        }
                        return(0);
                    }
                    else if (m is UW.ClassroomPresenter.Network.Messages.Network.InstructorMessage)
                    {
                        Debug.WriteLine(m.ToString());
                        return(1);
                    }
                    else if (m is UW.ClassroomPresenter.Network.Messages.Network.StudentMessage)
                    {
                        Debug.WriteLine(m.ToString());
                        return(3);
                    }
                    else if (m is UW.ClassroomPresenter.Network.Messages.Network.PublicMessage)
                    {
                        Debug.WriteLine(m.ToString());
                        return(2);
                    }
                }
            }

            return(0);
        }
Exemplo n.º 3
0
 private void addCp3Decks(UW.ClassroomPresenter.Network.Chunking.Chunk chunk)
 {
     if (chunk.NumberOfChunksInMessage == 1)
     {
         MemoryStream    ms = new MemoryStream(chunk.Data);
         BinaryFormatter bf = new BinaryFormatter();
         Object          o  = bf.Deserialize(ms);
         if (o is CP3.Network.Messages.Message)
         {
             ProcessCP3MessageGraph((CP3.Network.Messages.Message)o);
         }
     }
     else
     {
         Debug.WriteLine("Warning: DeckMatcher does not yet support multi-chunk messages");
     }
 }
Exemplo n.º 4
0
        private void AcceptCP3Chunk(UW.ClassroomPresenter.Network.Chunking.Chunk chunk)
        {
            List <object> rtObjList = cp3Mgr.Accept(chunk);

            if ((rtObjList == null) || (rtObjList.Count == 0))
            {
                if (cp3Mgr.WarningLog != null)
                {
                    foreach (string s in cp3Mgr.WarningLog)
                    {
                        Debug.WriteLine(s);
                    }
                    cp3Mgr.WarningLog.Clear();
                }
                FilterCP3RTUpdate();
                return;
            }

            foreach (object rto in rtObjList)
            {
                if (rto is ArchiveRTNav.RTUpdate)
                {
                    Debug.WriteLine("**CP3Mgr returns RtUpdate: " + ((RTUpdate)rto).ToString());
                    UpdateRTUpdate((RTUpdate)rto);
                    FilterCP3RTUpdate();
                }
                else if (rto is ArchiveRTNav.RTDrawStroke)
                {
                    FilterRTDrawStroke((RTDrawStroke)rto);
                }
                else if (rto is ArchiveRTNav.RTDeleteStroke)
                {
                    FilterRTDeleteStroke((RTDeleteStroke)rto);
                }
                else if (rto is ArchiveRTNav.RTTextAnnotation)
                {
                    FilterRTTextAnnotation((RTTextAnnotation)rto);
                }
                else if (rto is ArchiveRTNav.RTImageAnnotation)
                {
                    FilterRTImageAnnotation((RTImageAnnotation)rto);
                }
                else if ((rto is ArchiveRTNav.RTDeleteTextAnnotation))
                {
                    FilterRTDeleteTextAnnotation((RTDeleteTextAnnotation)rto);
                }
                else if ((rto is ArchiveRTNav.RTDeleteAnnotation))
                {
                    FilterRTDeleteAnnotation((RTDeleteAnnotation)rto);
                }
                else if (rto is ArchiveRTNav.RTEraseLayer)
                {
                    ArchiveRTNav.RTEraseLayer rtel = (RTEraseLayer)rto;
                    BufferChunk bc = new BufferChunk(Helpers.ObjectToByteArray(rtel));
                    enqueueMain(new WorkItem(bc, PacketType.ClearScribble, rtel.SlideIndex, rtel.DeckGuid));
                }
                else if (rto is ArchiveRTNav.RTQuickPoll)
                {
                    ArchiveRTNav.RTQuickPoll rtqp = (RTQuickPoll)rto;
                    BufferChunk bc = new BufferChunk(Helpers.ObjectToByteArray(rtqp));
                    enqueueMain(new WorkItem(bc, PacketType.RTQuickPoll, rtqp.SlideIndex, rtqp.DeckGuid));
                }
                else
                {
                    Debug.WriteLine("CP3Manager returned unhandled archive type: " + rto.GetType().ToString());
                }
            }
        }