示例#1
0
        public bool Open(Stream stream)
        {
            DataResponse response = DataResponse.Create(stream);

            while (response != null)
            {
                if (!ApplyResponse(response))
                {
                    return(false);
                }

                response = DataResponse.Create(stream);
            }

            frames.Flush();
            return(true);
        }
示例#2
0
        private bool Open(String name, Stream stream)
        {
            DataResponse response = DataResponse.Create(stream);

            while (response != null)
            {
                if (!ApplyResponse(response))
                {
                    return(false);
                }

                response = DataResponse.Create(stream);
            }

            frames.UpdateName(name);
            frames.Flush();
            ScrollToEnd();

            return(true);
        }
示例#3
0
        public static void RecieveMessage()
        {
            while (true)
            {
                DataResponse response = ProfilerClient.Get().RecieveMessage();

                if (response != null)
                {
                    // Handle the response
                    if (response.Version == NetworkProtocol.NETWORK_PROTOCOL_VERSION)
                    {
                        switch (response.ResponseType)
                        {
                        case DataResponse.Type.ReportProgress:
                            Int32 length = response.Reader.ReadInt32();
                            System.Console.WriteLine("Progress: " + new String(response.Reader.ReadChars(length)));
                            break;

                        case DataResponse.Type.NullFrame:
                            lock (frames)
                            {
                                frames.Flush();
                            }
                            break;

                        case DataResponse.Type.Handshake:
                            break;

                        default:
                            lock (frames)
                            {
                                frames.Add(response.ResponseType, response.Reader);
                            }
                            break;
                        }
                    }
                }
                else
                {
                    Thread.Sleep(1000);
                }
            }
        }