Example #1
0
        private void onRequestRevision(IClient client, RevisionRequestPacket packet)
        {
            var rev = sys.FindRevision(packet.Guid);

            if (rev == null)
            {
                throw new InvalidOperationException("Unexisting revision requested");
            }

            revisionTransporter.GetTransporterForClient(client).Send(new RevisionPacket(rev));

            var di = new DirectoryInfo(sys.getRevisionRoot(rev));
            var e  = di.EnumerateFiles("*", SearchOption.AllDirectories).GetEnumerator();

            FileInfo fi = e.Current;

            while (e.MoveNext())
            {
                var p = new RevisionFilePacket {
                    Path = sys.getPathFromFileInfo(rev, fi), Complete = e.Current == null
                };


                fileTransporter.SendFileTo(client, p, fi.FullName);
                fi = e.Current;
            }
        }
Example #2
0
        public ClientFileTransporter <T> GetClientTransporter(IClient client)
        {
            ClientFileTransporter <T> ret;

            if (!clientFIleTransporterMap.TryGetValue(client, out ret))
            {
                ret = new ClientFileTransporter <T>(this);
                clientFIleTransporterMap[client] = ret;
                ret.startTransporter             = fileStartTransporter.GetTransporterForClient(client);
                ret.partTransporter = filePartTransporter.GetTransporterForClient(client);
                ret.endTransporter  = fileCompleteTransporter.GetTransporterForClient(client);

                //ret.StartReceiving(); //TODO: only suppport sending ATM
            }
            return(ret);
        }