usingsystem;
using
system.data;
using
system.configuration;
using
system.linq;
using
system.web;
using
system.io;
using
system.collections;
using
system.collections.generic;
using
system.security.accesscontrol;
using
system.security.permissions;
namespace
bll
else
}//建立乙個資料夾,存在就建立失敗
public
static
bool createnewfolder(string
path)
else
return
false
; }
//////
在指定目錄下建立指定名稱資料夾
/// ///
//////
public
static
bool createnewfolder(string parentspath, string
newfoldername)
else
return
false
; }
//////
返回目錄下的所有檔名
/// ///
///public
static arraylist getallfiles(string
path)
return
list;
}else
return
null
; }
//////
計算資料夾的大小
/// ///
///public
static
long
dirsize(directoryinfo d)
//add subdirectory sizes.
directoryinfo dis = d.getdirectories();//
獲取目錄子目錄列表
foreach (directoryinfo di in
dis)
return
size;
}//////
把資料夾得大小轉換成比較合適的表示單位
/// ///
///public
static
string viewsize(long
size)
else
}else
}else
return
viewstr;
}//////
刪除指定目錄和內容
/// ///
///public
static
bool deldir(string
dir)
catch (exception e)
}return
flag;
}//////
刪除指定檔案
/// ///
///public
static
bool delfile(string
fil)
catch (exception e)
}return
flag;
}public
static
void copy(string sourcedirectory, string
targetdirectory)
//////
複製目錄及子檔案到指定目錄
/// ///
///public
static
void
copyall(directoryinfo source, directoryinfo target)
//copy each file into it's new directory.
foreach (fileinfo fi in
source.getfiles())
\", target.fullname, fi.name);
fi.copyto(path.combine(target.tostring(), fi.name),
true
); }
//copy each subdirectory using recursion.
foreach (directoryinfo disourcesubdir in
source.getdirectories())
}//////
迴圈讀取某個目錄下的所有檔案和目錄,查詢有關每一項的一些資訊。返回乙個檔案列表
/// ///
public
static listfileview(string
strcurrentdir)
newfile.picname = "
}else
filelist.add(newfile);
}catch
(exception e)
}return
filelist;
}//////
顯示目錄和檔案
/// ///
public
static
void all(string
path)
catch
(exception e)
foreach (filesysteminfo fsi in
dir.getfilesysteminfos())
}else
/*switch(fileext)
*/newfile.picname = "
}else
}catch
(exception e){}}}
}}
檔案幫助類
public class filehelper else console.writeline request header console.writeline ctx.request.headers.tostring 設定返回內容的mime型別 content disposition attachm...
C 公共幫助類 Image幫助類
大家知道,開發專案除了資料訪問層很重要外,就是common了,這裡就提供了強大且實用的工具。c 公共幫助類 convert幫助類 image類 using system using system.collections.generic using system.text using system.i...
C 安全幫助類
安全類 public class safecommon bin b blike b s script b s img b bexec b union.select update.set insert s into.values select delete from create alter drop...