Open() 공개 메소드

This creates a new PutioFileHandle and returns it. It should later be closed explicitly.
public Open ( ) : PutioFileHandle
리턴 PutioFileHandle
예제 #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
파일: 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);
        }