コード例 #1
0
 // Read temp folder to get list of projects & twbxs that can be published
 public DataTable GetWorkbooks()
 {
     string[] Folders;
     try
     {
         DataTable _dtable = new WorkbookInfo.WorkbooksToImportDataTable();
         Folders = System.IO.Directory.GetDirectories(txtLocalFolder.Text, "*");
         foreach (string folder in Folders)
         {
             string[] Files = System.IO.Directory.GetFiles(folder);
             foreach (string file in Files)
             {
                 DataRow dr = _dtable.NewRow();
                 dr["Name"] = file.ToString();
                 Regex           regex   = new Regex(@"[^\\]+(?=\\[^\\]+$)");
                 MatchCollection matches = regex.Matches(file);
                 dr["Project"] = matches[0].Value.ToString();
                 dr["Owner"]   = "Unpublished";
                 _dtable.Rows.Add(dr);
             }
         }
         return(_dtable);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message.ToString());
         return(null);
     }
 }
コード例 #2
0
        // Read temp folder to get list of projects & twbxs that can be published
        public DataTable GetWorkbooks()
        {
            string[] Folders;
            try
            {
                DataTable _dtable = new WorkbookInfo.WorkbooksToImportDataTable();
                Folders = System.IO.Directory.GetDirectories(txtLocalFolder.Text, "*");
                foreach (string folder in Folders)
                {
                    string[] Files = System.IO.Directory.GetFiles(folder);
                    foreach (string file in Files)
                    {
                        DataRow dr = _dtable.NewRow();
                        dr["Name"] = file.ToString();
                        Regex regex = new Regex(@"[^\\]+(?=\\[^\\]+$)");
                        MatchCollection matches = regex.Matches(file);
                        dr["Project"] = matches[0].Value.ToString();
                        dr["Owner"] = "Unpublished";
                        _dtable.Rows.Add(dr);
                    }

                }
                return _dtable;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message.ToString());
                return null;
            }
        }