public void Test()
        {
            InvitationRequest request = new InvitationRequest(1111);
            this.TestFactory(request);

            InvitationAck ack = new InvitationAck(2222);
            this.TestFactory(ack);

            byte[] data = { 12, 34, 56 };
            FileDataResponse dataResponse = new FileDataResponse(data, 3333);
            this.TestFactory(dataResponse);

            FileEvent e1 = new FileEvent();
            e1.Name = "1234";
            List<FileEvent> lf = new List<FileEvent>();
            lf.Add(e1);
            PatchRequest patchRequest = new PatchRequest(lf, 4444);
            this.TestFactory(patchRequest);

            PeerList peerList = PeerList.GetPeerList("abc");
            peerList.AddPeer(new Peer("127.0.0.1", 5555));
            PeerListMessage pm = new PeerListMessage(peerList, 6666);
            this.TestFactory(pm);

            SyncAck syncAck = new SyncAck(7777);
            this.TestFactory(syncAck);

            SyncRequest syncRequest = new SyncRequest(8888);
            this.TestFactory(syncRequest);

            File.WriteAllText(".Distribox/VersionList.txt", "[]");
            VersionList vl = new VersionList();
            VersionListMessage vm = new VersionListMessage(vl, 9999);
            this.TestFactory(vm);
        }
Пример #2
0
        /// <summary>
        /// Process the specified message and peer.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="peer">The peer.</param>
        internal void Process(FileDataResponse message, Peer peer)
        {
            List <FileEvent> patches;

            lock (this.versionControl.VersionList)
            {
                patches = this.versionControl.AcceptFileBundle(message.Data);
            }

            this.requestManager.FinishRequests(patches);
            this.TryToRequest();
        }
Пример #3
0
        /// <summary>
        /// Process the specified message and peer.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="peer">The peer.</param>
        internal void Process(FileDataResponse message, Peer peer)
        {
            List<FileEvent> patches;
            lock (this.versionControl.VersionList)
            {
                patches = this.versionControl.AcceptFileBundle(message.Data);
            }

            this.requestManager.FinishRequests(patches);
            this.TryToRequest();
        }