當前位置: 首頁>>代碼示例>>C#>>正文


C# FileSystem.ExportData方法代碼示例

本文整理匯總了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;
        }
開發者ID:padilhalino,項目名稱:FrontDesk,代碼行數:16,代碼來源:dlfile.aspx.cs

示例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;
        }
開發者ID:padilhalino,項目名稱:FrontDesk,代碼行數:42,代碼來源:users.cs

示例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;
        }
開發者ID:padilhalino,項目名稱:FrontDesk,代碼行數:27,代碼來源:junittool.cs

示例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;
        }
開發者ID:padilhalino,項目名稱:FrontDesk,代碼行數:39,代碼來源:zoneservice.cs


注:本文中的System.IO.FileSystem.ExportData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。