public void DeleteFile(string dfsfile) { ensureconnected(); netstm.WriteByte((byte)'d'); XContent.SendXContent(netstm, dfsfile); ensurenextplus(); }
public void SetFileContent(string dfsfile, string dfsfiletype, byte[] content, int contentlength) { ensureconnected(); netstm.WriteByte((byte)'p'); XContent.SendXContent(netstm, dfsfile); XContent.SendXContent(netstm, dfsfiletype); XContent.SendXContent(netstm, content, contentlength); ensurenextplus(); }
public string GetFileSizeString(string dfsfile) { ensureconnected(); netstm.WriteByte((byte)'s'); XContent.SendXContent(netstm, dfsfile); ensurenextplus(); string ssize = XContent.ReceiveXString(netstm, buf); return(ssize); }
public byte[] GetFileContent(string dfsfile) { ensureconnected(); netstm.WriteByte((byte)'g'); XContent.SendXContent(netstm, dfsfile); ensurenextplus(); int len; buf = XContent.ReceiveXBytes(netstm, out len, buf); byte[] content = new byte[len]; Buffer.BlockCopy(buf, 0, content, 0, len); return(content); }
void ensurenextplus() { #if DEBUG ensureconnected(); #endif int ib = netstm.ReadByte(); if ('+' != ib) { if ('-' == ib) { string errmsg = XContent.ReceiveXString(netstm, null); throw new Exception("Error from DFS protocol: " + errmsg); } else { throw new Exception("DFS protocol did not return a success"); } } }