本文整理汇总了C#中System.IO.FileSystem.ExportData方法的典型用法代码示例。如果您正苦于以下问题:C# FileSystem.ExportData方法的具体用法?C# FileSystem.ExportData怎么用?C# FileSystem.ExportData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.FileSystem
的用法示例。
在下文中一共展示了FileSystem.ExportData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDirectoryData
private byte[] GetDirectoryData(CFile dir)
{
FileSystem fs = new FileSystem(Globals.CurrentIdentity);
//Create our external sink (gonna be an archive, so safe cast)
IMemorySink extsink =
ArchiveToolFactory.GetInstance().CreateArchiveTool(".zip") as IMemorySink;
extsink.CreateSink(null);
//Export data
fs.ExportData("", dir, extsink, false);
byte[] data = extsink.GetSinkData();
extsink.CloseSink();
return data;
}
示例2: Backup
public string Backup(string username, int courseID, int asstID, IExternalSink extsink)
{
string zfile, wzfile, backdesc=username+": ";
//Create our external sink file
if (extsink == null) {
extsink = ArchiveToolFactory.GetInstance().CreateArchiveTool(".zip") as IExternalSink;
zfile = username+DateTime.Now.Hour+DateTime.Now.Minute+DateTime.Now.Second+".zip";
wzfile = Globals.BackupDirectoryName + "/" + zfile;
zfile = Path.Combine(Globals.BackupDirectory, zfile);
extsink.CreateSink(zfile);
}
else {
wzfile = zfile = ""; // In the middle of a backup
}
//Backup Results
//Back up submissions
FileSystem fs = new FileSystem(m_ident);
Components.Submission.SubmissionList subs;
if (asstID < 0) {
if (zfile != "")
backdesc += (new Courses(m_ident).GetInfo(courseID)).Name;
subs = GetCourseSubmissions(username, courseID);
}
else {
if (zfile != "")
backdesc += new Assignments(m_ident).GetInfo(asstID).Description;
subs = GetAsstSubmissions(username, asstID);
}
foreach (Components.Submission sub in subs)
fs.ExportData(username, sub.LocationID, extsink, true);
//If we are doing this not in a batch
if (zfile != "") extsink.CloseSink();
//Log backup in database
if (zfile != "") new Backups(Globals.CurrentIdentity).Create(
backdesc, wzfile, courseID);
return zfile;
}
示例3: ExportToTemp
private string ExportToTemp(AutoEvaluation eval)
{
FileSystem fs = new FileSystem(Globals.CurrentIdentity);
string tpath = Path.Combine(Globals.TempDirectory, Globals.CurrentUserName);
try { Directory.Delete(tpath); } catch (Exception) { }
Directory.CreateDirectory(tpath);
IExternalSink tsink = new OSFileSystemSink();
tsink.CreateSink("");
//Export eval files (JUnit test suite)
try {
fs.ExportData(tpath, fs.GetFile(eval.ZoneID), tsink, false);
} catch (Exception er) {
string mike = er.Message;
}
//Export jdisco program
try {
fs.ExportData(tpath, fs.GetFile(@"c:\system\junit"), tsink, false);
} catch (Exception er) {
string mike = er.Message;
}
return tpath;
}
示例4: CreateZone
protected bool CreateZone(IZoneComponent eval)
{
FileSystem fs = new FileSystem(m_ident);
DataSet desc = new DataSet();
//Create initial zone directory
string zpath = Path.Combine(TestConfig.LocalZonePath,
m_prefix + eval.GetZoneID().ToString());
Directory.CreateDirectory(zpath);
//Export the zone files into local store
IExternalSink zdir = new OSFileSystemSink();
zdir.CreateSink("");
try {
desc = fs.ExportData(zpath, fs.GetFile(eval.GetZoneID()), zdir, false);
//Write XML descriptor
desc.Tables["Export"].Rows[0]["Mod"] = eval.GetZoneModified().Ticks;
desc.WriteXml(Path.Combine(zpath, ZONE_FILE));
m_logger.Log("Zone retrieved successfully");
} catch (FileOperationException e) {
m_logger.Log("File error: " + e.Message, TestLogger.LogType.ERROR);
zdir.CloseSink();
return false;
} catch (DataAccessException er) {
m_logger.Log("Data error: " + er.Message, TestLogger.LogType.ERROR);
zdir.CloseSink();
return false;
} catch (Exception e) {
m_logger.Log("Unexpected error: " + e.Message, TestLogger.LogType.ERROR);
m_logger.Log("Trace: " + e.StackTrace, TestLogger.LogType.ERROR);
zdir.CloseSink();
return false;
}
return true;
}