本文整理汇总了C#中FileSystem.GetFile方法的典型用法代码示例。如果您正苦于以下问题:C# FileSystem.GetFile方法的具体用法?C# FileSystem.GetFile怎么用?C# FileSystem.GetFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSystem
的用法示例。
在下文中一共展示了FileSystem.GetFile方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopySupportFiles
//Copy CS helper code into autoevaluation zone
public void CopySupportFiles(AutoEvaluation eval)
{
FileSystem fs = new FileSystem(Globals.CurrentIdentity);
//Get zone
CFile zone = fs.GetFile(eval.ZoneID);
//Copy CS program over
CFile.FileList dfiles = new CFile.FileList();
dfiles.Add(fs.GetFile(@"c:\system\checkstyle\CheckStyle.class"));
dfiles.Add(fs.GetFile(@"c:\system\checkstyle\checksubj.xslt"));
fs.CopyFiles(zone, dfiles, true);
}
示例2: SetupBrowser
private void SetupBrowser()
{
string idstr = HttpContext.Current.Request.Params["Roots"];
string [] ids = idstr.Split("|".ToCharArray());
FileSystem fs = new FileSystem(Globals.CurrentIdentity);
foreach (string sid in ids) {
if (sid.Length == 0) continue;
int id = Convert.ToInt32(sid);
CFile root = fs.GetFile(id);
ucFiles.AddDirectoryRoot(root.FullPath);
}
}
示例3: Delete
/// <summary>
/// Remove an auto evaluation (takes results with it)
/// </summary>
public bool Delete(int evalID)
{
Evaluation eval = GetInfo(evalID);
//take evaluation
m_dp.DeleteEval(evalID);
//Delete zone files
if (eval.Type == Evaluation.AUTO_TYPE) {
FileSystem fs = new FileSystem(m_ident);
AutoEvaluation aeval = eval as AutoEvaluation;
CFile zdir = fs.GetFile(aeval.ZoneID);
if (null != zdir)
fs.DeleteFile(zdir);
}
return true;
}
示例4: BindBoxes
private void BindBoxes()
{
FileSystem fs = new FileSystem(Globals.CurrentIdentity);
//Get perms
CFilePermission.FilePermissionList perms = fs.GetPermissions(
fs.GetFile(FileID), Convert.ToInt32(ddlPrins.SelectedItem.Value));
chkRead.Checked = chkWrite.Checked = chkDelete.Checked = false;
foreach (CFilePermission perm in perms)
if (perm.Grant) {
if (perm.Action == FileAction.READ)
chkRead.Checked = true;
if (perm.Action == FileAction.WRITE)
chkWrite.Checked = true;
if (perm.Action == FileAction.DELETE)
chkDelete.Checked = true;
}
}
示例5: cmdUpdate_Click
private void cmdUpdate_Click(object sender, System.EventArgs e)
{
CFilePermission.FilePermissionList perms = new CFilePermission.FilePermissionList();
int principalID = Convert.ToInt32(ddlPrins.SelectedItem.Value);
perms.Add(new CFilePermission(principalID, FileAction.READ, chkRead.Checked));
perms.Add(new CFilePermission(principalID, FileAction.WRITE, chkWrite.Checked));
perms.Add(new CFilePermission(principalID, FileAction.DELETE, chkDelete.Checked));
FileSystem fs = new FileSystem(Globals.CurrentIdentity);
try {
fs.SetPermissions(fs.GetFile(FileID), perms);
} catch (CustomException er) {
PageError(er.Message);
}
BindBoxes();
}
示例6: Update
/// <summary>
/// Update a rubric entry
/// </summary>
public bool Update(Rubric rub)
{
//check permission
Assignment asst = new Assignments(m_ident).GetInfo(rub.AsstID);
Authorize(asst.CourseID, "updaterubric", asst.ID, null);
//Rename zone on entry rename
if (rub.EvalID >= 0) {
FileSystem fs = new FileSystem(m_ident);
int zoneID =
(new Evaluations(m_ident).GetInfo(rub.EvalID) as AutoEvaluation).ZoneID;
CFile zdir = fs.GetFile(zoneID);
zdir.Alias = rub.Name;
fs.UpdateFileInfo(zdir, false);
}
//Update entry
m_dp.UpdateRubricEntry(rub);
//Retally points and update root entry
Rubric root = new Assignments(m_ident).GetRubric(rub.AsstID);
root.Points = RetallyPoints(root);
m_dp.UpdateRubricEntry(root);
//Log
Log("Updated rubric entry: " + rub.Name, rub.AsstID);
return true;
}
示例7: CopyFile
public void CopyFile(int destID, int srcID)
{
AuthorizedIdent ident = AuthenticateTicket(Ticket);
FileSystem fs = new FileSystem(ident, true);
CFile src = fs.GetFile(srcID);
CFile dest = fs.GetFile(destID);
FileSystemProviderFactory.GetInstance(this);
m_fs.CopyFile(dest, src);
}
示例8: CommitTestSource
private int CommitTestSource(AutoEvaluation eval, IExternalSource zone)
{
FileSystem fs = new FileSystem(m_ident);
//Make sure toplevel zone directory exists
CFile zonedir = fs.GetFile(@"c:\zones");
if (null == zonedir)
zonedir = fs.CreateDirectory(@"c:\zones", true, null);
//Build file perms
CFilePermission.FilePermissionList perms = new CFilePermission.FilePermissionList();
CourseRole.CourseRoleList staff = new Courses(m_ident).GetTypedRoles(eval.CourseID, true, null);
foreach (CourseRole role in staff)
perms.AddRange(CFilePermission.CreateFullAccess(role.PrincipalID));
//Create zone directory
string zpath = @"c:\zones\" + eval.ID;
CFile ezonedir;
if (null == (ezonedir = fs.GetFile(zpath))) {
ezonedir = fs.CreateDirectory(zpath, false, perms);
ezonedir.Alias = eval.Name; ezonedir.SpecType = CFile.SpecialType.TEST;
fs.UpdateFileInfo(ezonedir, false);
}
fs.ImportData(zpath, zone, false, true); //Import the data
return ezonedir.ID;
}