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


C# FileSystem.CopyFiles方法代碼示例

本文整理匯總了C#中System.IO.FileSystem.CopyFiles方法的典型用法代碼示例。如果您正苦於以下問題:C# FileSystem.CopyFiles方法的具體用法?C# FileSystem.CopyFiles怎麽用?C# FileSystem.CopyFiles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.IO.FileSystem的用法示例。


在下文中一共展示了FileSystem.CopyFiles方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Discover

        public string Discover(AutoEvaluation eval, out double points, out int time, out int count)
        {
            //Get Perl
            IExternalTool perl = ExternalToolFactory.GetInstance().CreateExternalTool("Perl",
                "5.0", ExternalToolFactory.VersionCompare.ATLEAST);
            if (perl == null)
                throw new JUnitToolException(
                    "Unable to find Perl v5.0 or later. Please check the installation or contact the administrator");

            //Get all files on the disk
            string tpath = ExportToTemp(eval);

            //Run disco program
            perl.Arguments = "jdisco.pl i";
            perl.Execute(tpath);
            Directory.Delete(tpath, true);

            //Validate XML
            string xmltests = perl.Output;
            XmlWizard xmlwiz = new XmlWizard();
            if (!xmlwiz.ValidateXml(xmltests, Path.Combine(Globals.WWWDirectory, "Xml/testsuite.xsd")))
                throw new JUnitToolException("Invalid JUnit Test Suite. Check to make sure the test suite conforms to FrontDesk standards");

            //Write XML
            FileSystem fs = new FileSystem(Globals.CurrentIdentity);
            CFile zone = fs.GetFile(eval.ZoneID);
            string tspath = Path.Combine(zone.FullPath, "__testsuite.xml");
            CFile xmldesc = fs.GetFile(tspath);
            if (xmldesc == null)
                xmldesc = fs.CreateFile(tspath, false, null);
            xmldesc.Data = xmltests.ToCharArray();
            fs.Edit(xmldesc);
            fs.Save(xmldesc);

            //Copy disco program over
            CFile.FileList dfiles = new CFile.FileList();
            dfiles.Add(fs.GetFile(@"c:\system\junit\jdisco.pl"));
            dfiles.Add(fs.GetFile(@"c:\system\junit\JUnitDiscover.class"));
            dfiles.Add(fs.GetFile(@"c:\system\junit\JUnitDiscover$ClassFileFilter.class"));
            fs.CopyFiles(zone, dfiles, true);

            //Get suite metadata
            GetSuiteInfo(xmltests, out points, out time, out count);

            //Punt all previous results
            RemoveResults(eval);

            return xmltests;
        }
開發者ID:padilhalino,項目名稱:FrontDesk,代碼行數:49,代碼來源:junittool.cs

示例2: cmdPaste_ButtonClick

        protected bool cmdPaste_ButtonClick(object sender, EventArgs ea)
        {
            TreeNode destnode;
            ClipBoard cb;
            FileSystem fs;

            cb = (ClipBoard) ViewState["clipboard"];
            if (cb == null) {
                DisplayMessage("Clipboard empty. You must cut/copy files before pasting has an effect");
                return true;
            }

            fs = new FileSystem(Globals.CurrentIdentity);
            destnode = tvFiles.GetNodeFromIndex(tvFiles.SelectedNodeIndex);
            CFile dest = fs.GetFile((string)ViewState["gridpath"]);

            try {
                if (cb.Move)
                    fs.MoveFiles(dest, cb.Files, false);
                else
                    fs.CopyFiles(dest, cb.Files, false);
            }
            catch (FileOperationException e) {
                DisplayMessage(e.Message);
                return false;
            }

            UpdateTreeNode(destnode, true);
            BindFileGrid();
            ViewState["clipboard"] = null;
            BindClipBoard();

            return true;
        }
開發者ID:padilhalino,項目名稱:FrontDesk,代碼行數:34,代碼來源:filebrowser.ascx.cs


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