Represents a remote file on Put.io servers. Calling the Open() method returns a PutioFileHandle which should be closed explicitly by calling its Close() method. PutioFileHandle
Inheritance: PutioFsItem
コード例 #1
0
ファイル: ReadTest.cs プロジェクト: firat/PutioFS
        public void PutioFileVLCReadTest()
        {
            PutioFile remote_file = new PutioFile(new PutioFsTestDataProvider("660.avi", test_local_file, 660, 697080622, false, Constants.LocalStoragePath), null);
            PutioFileHandle remote_stream = remote_file.Open();
            FileStream local_stream = File.Open(test_local_file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

            foreach(int[] p in vlc_read_positions)
            {
                byte[] local_data = new byte[p[0]];
                byte[] remote_data = new byte[p[0]];

                remote_stream.Seek(p[1]);
                int remote_read = remote_stream.Read(remote_data, 0, p[0]);
                local_stream.Seek(p[1], SeekOrigin.Begin);
                int local_read = local_stream.Read(local_data, 0, p[0]);

                Assert.AreEqual(local_read, remote_read);
                CollectionAssert.AreEqual(remote_data, local_data);
            }
            Debug.WriteLine(":(");
        }
コード例 #2
0
ファイル: PutioFileHandle.cs プロジェクト: firat/PutioFS
 public PutioFileHandle(PutioFile file)
 {
     this.PutioFile = file;
     this.Guid = Guid.NewGuid();
     this.ReadStream = file.DataProvider.GetNewLocalReadStream();
 }
コード例 #3
0
ファイル: ReadTest.cs プロジェクト: firat/PutioFS
        public void PutioFileReadTest()
        {
            FileInfo finfo = new FileInfo(test_local_file);
            PutioFile remote_file = new PutioFile(new PutioFsTestDataProvider(finfo.Name, finfo.FullName, 660, finfo.Length, false, Constants.LocalStoragePath), null);
            PutioFileHandle remote_stream = remote_file.Open();
            //FileStream remote_stream = File.Open(remote_file.DataProvider.LocalStorageFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            FileStream local_stream = File.Open(test_local_file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

            byte[] local_data = new byte[11952];
            byte[] remote_data = new byte[11952];

            local_stream.Seek(367043856, SeekOrigin.Begin);
            local_stream.Read(local_data, 0, local_data.Length);
            // remote_stream.Seek(367043856, SeekOrigin.Begin);
            remote_stream.Seek(367043856);
            remote_stream.Read(remote_data, 0, remote_data.Length);

            CollectionAssert.AreEqual(local_data, remote_data);
        }
コード例 #4
0
 public LocalFileCache(PutioFile file)
 {
     this.PutioFile       = file;
     this.RangeCollection = new LongRangeCollection(0, this.PutioFile.Size);
 }
コード例 #5
0
ファイル: RangeBufferTest.cs プロジェクト: firat/PutioFS
 public void Initialize()
 {
     this.Finfo = new FileInfo(test_local_file);
     this.RemoteFile = new PutioFile(new PutioFsTestDataProvider(this.Finfo.Name, this.Finfo.FullName, 660, this.Finfo.Length, false, Constants.LocalStoragePath), null);
     this.Cache = new LocalFileCache(this.RemoteFile);
 }
コード例 #6
0
ファイル: PutioFileHandle.cs プロジェクト: ajdrausal/PutioFS
 public PutioFileHandle(PutioFile file)
 {
     this.PutioFile  = file;
     this.Guid       = Guid.NewGuid();
     this.ReadStream = file.DataProvider.GetNewLocalReadStream();
 }
コード例 #7
0
ファイル: LocalFileCache.cs プロジェクト: firat/PutioFS
 public LocalFileCache(PutioFile file)
 {
     this.PutioFile = file;
     this.RangeCollection = new LongRangeCollection(0, this.PutioFile.Size);
 }