public Stream OpenWrite(bool isRes) { MLoc m = MLoc.Ut.Get(this); TransmitRes res1 = comm.Transmit(new DSICommand().WithRequestPayload(new FPOpenFork() .WithVolumeID(m.VolID) .WithDirectoryID(m.DirID) .WithFlag((byte)(!isRes ? 0x00 : 0x80)) .WithAccessMode(AfpAccessMode.Write) .WithBitmap(!isRes ? (cd.ExtRW ? AfpFileBitmap.ExtDataForkLength : AfpFileBitmap.DataForkLength) : (cd.ExtRW ? AfpFileBitmap.ExtResourceForkLength : AfpFileBitmap.ResourceForkLength)) .WithPath(m.RawPath) )); if (res1.pack.IsResponse && res1.pack.ErrorCode == 0) { } else { throw new DSIException(res1.pack.ErrorCode, res1.pack); } OpenForkPack pack = new OpenForkPack(res1.br); return new MacSt(comm, !isRes, pack, cd.ExtRW); }
public MacSt(MyDSI3 comm, bool data, OpenForkPack pack, bool extrw) { this.comm = comm; this.data = data; this.pack = pack; this.extrw = extrw; this.open = true; this.LocalLength = data ? Utfs.DataFork(pack.Parms) : Utfs.ResFork(pack.Parms); }
public Stream OpenRead() { if (ty == Forkty.Finder) { return GetFiSt(false); } else { bool data = ty == Forkty.Data; MLoc m = MLoc.Ut.Get(this); TransmitRes res1 = comm.Transmit(new DSICommand().WithRequestPayload(new FPOpenFork() .WithVolumeID(m.VolID) .WithDirectoryID(m.DirID) .WithFlag((byte)(data ? 0x00 : 0x80)) .WithAccessMode(AfpAccessMode.Read) .WithBitmap(data ? (cd.ExtRW ? AfpFileBitmap.ExtDataForkLength : AfpFileBitmap.DataForkLength) : (cd.ExtRW ? AfpFileBitmap.ExtResourceForkLength : AfpFileBitmap.ResourceForkLength)) .WithPath(m.RawPath) )); if (res1.pack.IsResponse && res1.pack.ErrorCode == 0) { } else { throw new DSIException(res1.pack.ErrorCode, res1.pack); } OpenForkPack pack = new OpenForkPack(res1.br); return new MacSt(comm, data, pack, cd.ExtRW); } }