Esempio n. 1
0
        public void DeleteFile(string dfsfile)
        {
            ensureconnected();

            netstm.WriteByte((byte)'d');
            XContent.SendXContent(netstm, dfsfile);
            ensurenextplus();
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        public string GetFileSizeString(string dfsfile)
        {
            ensureconnected();

            netstm.WriteByte((byte)'s');
            XContent.SendXContent(netstm, dfsfile);
            ensurenextplus();
            string ssize = XContent.ReceiveXString(netstm, buf);

            return(ssize);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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");
                }
            }
        }