public System.IO.Stream OpenRead(string path, bool bLock) { if (System.IO.File.Exists(path) == false) { return(null); } System.IO.Stream fs = System.IO.File.Open(path, System.IO.FileMode.Open, System.IO.FileAccess.Read); fs.Seek(0, System.IO.SeekOrigin.End); int ilen = (int)fs.Position; fs.Seek(0, System.IO.SeekOrigin.Begin); SVNRemoteRead rs = new SVNRemoteRead(); byte[] buf = new byte[ilen]; fs.Read(buf, 0, ilen); rs.RealWrite(buf, 0, ilen); rs.Seek(0, System.IO.SeekOrigin.Begin); if (bLock) { rs.lockedStream = fs; } else { fs.Close(); } return(rs); }
public System.IO.Stream OpenRead(string path, bool bLock) { if (System.IO.File.Exists(path) == false) { return null; } System.IO.Stream fs = System.IO.File.Open(path, System.IO.FileMode.Open, System.IO.FileAccess.Read); fs.Seek(0, System.IO.SeekOrigin.End); int ilen = (int)fs.Position; fs.Seek(0, System.IO.SeekOrigin.Begin); SVNRemoteRead rs = new SVNRemoteRead(); byte[] buf = new byte[ilen]; fs.Read(buf, 0, ilen); rs.RealWrite(buf, 0, ilen); rs.Seek(0, System.IO.SeekOrigin.Begin); if (bLock) { rs.lockedStream = fs; } else { fs.Close(); } return rs; }