Beispiel #1
0
        public void GetFileFailTest()
        {
            doTransaction();
            server.commit();

            FBVersion vers = new FBVersion();
            FBFile    file = (FBFile)(new FBFileBuilder(@"asd\due.txt")).generate();

            file.hash = "asdsdaasd";
            vers.addElement(file);
            SerializedVersion serV = new SerializedVersion(vers.serialize());
            var uploadData         = server.getFile(serV);

            Assert.IsNull(uploadData);
        }
Beispiel #2
0
        public void GetFileTest()
        {
            doTransaction();
            server.commit();

            FBVersion vers = new FBVersion();
            FBFile    file = (FBFile)(new FBFileBuilder(@"asd\due.txt")).generate();

            vers.addElement(file);
            SerializedVersion serV = new SerializedVersion(vers.serialize());
            var uploadData         = server.getFile(serV);

            UsefullMethods.ReceiveFile(uploadData.ip, uploadData.port, uploadData.token, @"asd\test.txt");
            String content = File.ReadAllText(@"asd\test.txt");

            Assert.IsTrue(content.Contains("Third lines"));
        }
Beispiel #3
0
        public string getFile(FBFile f)
        {
            SerializedVersion serV   = new SerializedVersion();
            FBVersion         tmpVer = new FBVersion();

            tmpVer.addElement(f);
            serV.encodedVersion = tmpVer.serialize();
            var    uploadData = server.getFile(serV);
            string tmpPath    = Path.GetTempPath() + f.Name;

            if (File.Exists(tmpPath))
            {
                File.Delete(tmpPath);
            }
            UsefullMethods.ReceiveFile(uploadData.ip, uploadData.port, uploadData.token, tmpPath);
            return(tmpPath);
        }