Exemplo n.º 1
0
        /// <summary>
        ///  Elenca files presenti in directory remota
        ///  </summary>
        ///  <param name="vpath"></param>
        public override FSDirInfo[] DirectoryListSubDirFilter(string vpath, string pattern, bool recursive)
        {
            this.mParams.Add(FS.PARAM_ACTION, FS.ACTION_LISTD);
            this.mParams.Add(FS.PARAM_VPATH, vpath);
            this.mParams.Add(FS.PARAM_PATTERN, pattern);
            if (recursive)
            {
                this.mParams.Add(FS.PARAM_ATTR, "R");
            }
            string sRet = Encoding.UTF8.GetString(this.sendRequest(this.mParams));

            // Carica dati da xml
            using (DataSet ds = new DataSet())
            {
                using (StringReader sr = new StringReader(sRet))
                {
                    ds.ReadXml(sr);
                }
                DataTable   tab   = ds.Tables["dir"];
                int         iDirs = (tab != null) ? tab.Rows.Count : 0;
                FSDirInfo[] oList = new FSDirInfo[iDirs - 1 + 1];
                using (tab)
                    for (int i = 0; i <= iDirs - 1; i++)
                    {
                        oList[i] = this.getDirInfoFromRow(tab.Rows[i]);
                    }
                // Ritorna lista
                return(oList);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///  Elenca ROOT directory a cui l'utente ha accessoe
        ///  </summary>
        ///  <returns></returns>
        ///  <remarks></remarks>
        public override FSDirInfo[] ListRootEntries()
        {
            this.mParams.Add(FS.PARAM_ACTION, FS.ACTION_LISTVFS);
            string sRet = Encoding.UTF8.GetString(this.sendRequest(this.mParams));

            // Carica dati da xml
            using (DataSet ds = new DataSet())
            {
                using (StringReader sr = new StringReader(sRet))
                {
                    ds.ReadXml(sr);
                }
                DataTable tab    = ds.Tables["path"];
                int       iCount = (tab != null) ? tab.Rows.Count : 0;

                FSDirInfo[] oList = new FSDirInfo[iCount - 1 + 1];
                using (tab)
                {
                    DataRow oRow;
                    for (int i = 0; i <= iCount - 1; i++)
                    {
                        oRow     = tab.Rows[i];
                        oList[i] = new FSDirInfo(oRow["name"].ToString(), DateTime.MinValue, new FSPermissionHFS(oRow["access"].ToString()));
                    }
                }
                // Ritorna lista
                return(oList);
            }
        }