} // End Sub TestJsonGeneration1 static void TestFSE() { string path = @"D:\Users\username\Downloads\Lucene_VS2012_Demo_App\Lucene\SimpleLuceneSearch"; // System.IO.Directory.GetFileSystemEntries(path); System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(path); System.IO.FileSystemInfo[] fsis = di.GetFileSystemInfos(); foreach (System.IO.FileSystemInfo fsi in fsis) { System.Console.WriteLine(fsi.Name); System.Console.WriteLine(fsi.FullName); fsi.IsHidden(); if (fsi.IsDirectory()) { System.IO.DirectoryInfo dii = (System.IO.DirectoryInfo)fsi; } else { System.IO.FileInfo fi = (System.IO.FileInfo)fsi; fsi.CanRead(); } } // Next fsi } // End Sub TestFSE
public void ProcessRequest(HttpContext context) { var request = context.Request; string path = request.Params["path"]; if (string.IsNullOrEmpty(path)) { path = @"D:\Stefan.Steiger\Source\Repos"; } // System.IO.Directory.GetFileSystemEntries(path); System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(path); System.IO.FileSystemInfo[] fis = di.GetFileSystemInfos(); List <fsInfo> ls = new List <fsInfo>(); foreach (System.IO.FileSystemInfo fi in fis) { ls.Add(new fsInfo(fi)); Console.WriteLine(fi); } // string resp = Newtonsoft.Json.JsonConvert.SerializeObject(ls); string resp = resp = MyGit.JsonHelper.SerializePretty(ls); context.Response.ContentType = "application/JSON"; context.Response.Write(resp); }
public DirectoryOnDisk(string path) { var di = new System.IO.DirectoryInfo(path); Path = di.FullName; Children = di.GetFileSystemInfos().OrderBy(x => x.Name).ToArray(); }
public void ProcessRequest(HttpContext context) { var request = context.Request; string path = request.Params["path"]; if (string.IsNullOrEmpty(path)) path = @"D:\Stefan.Steiger\Source\Repos"; // System.IO.Directory.GetFileSystemEntries(path); System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(path); System.IO.FileSystemInfo[] fis = di.GetFileSystemInfos(); List<fsInfo> ls = new List<fsInfo>(); foreach (System.IO.FileSystemInfo fi in fis) { ls.Add(new fsInfo(fi)); Console.WriteLine(fi); } // string resp = Newtonsoft.Json.JsonConvert.SerializeObject(ls); string resp = resp = MyGit.JsonHelper.SerializePretty(ls); context.Response.ContentType = "application/JSON"; context.Response.Write(resp); }
//Recursive File and Folder Listing VB.NET public static bool RecursiveSearch2(string path, System.Collections.Generic.List <string> ls) { System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(path); //System.IO.FileSystemInfo fileObject = default(System.IO.FileSystemInfo); if (!dirInfo.IsDirectory()) { ls.Add(dirInfo.FullName); } foreach (System.IO.FileSystemInfo fsiThisEntityInfo in dirInfo.GetFileSystemInfos()) { if (fsiThisEntityInfo.Attributes == System.IO.FileAttributes.Directory) { //Console.WriteLine("Searching directory " + fsiThisEntityInfo.FullName); RecursiveSearch2(fsiThisEntityInfo.FullName, ls); } else { ls.Add(fsiThisEntityInfo.FullName); //Console.WriteLine(fsiThisEntityInfo.FullName); } } // Next fiThisFileInfo return(true); } // End Function RecursiveSearch
//第二步:定义线程的主体方法 /// <summary> /// 线程的主体方法 /// </summary> private void WinUnRarZipDeal() { if (string.IsNullOrEmpty(txtUnRarPath.Text.Trim())) { JCodes.Framework.CommonControl.Other.MessageDxUtil.ShowWarning("请选择解压路径后再操作"); return; } if (!System.IO.Directory.Exists(txtUnRarPath.Text.Trim())) { JCodes.Framework.CommonControl.Other.MessageDxUtil.ShowWarning("解压路径不存在,请确认后再操作"); return; } // 获取rar路径 string winrarPath = System.Configuration.ConfigurationManager.AppSettings["WinRarPath"]; if (!System.IO.File.Exists(winrarPath)) { JCodes.Framework.CommonControl.Other.MessageDxUtil.ShowWarning("App.Config 中配置的WinRarPath路径有问题,请确认后再操作"); return; } string curPath = System.IO.Directory.GetCurrentDirectory(); // 获取当前工作路径; System.IO.Directory.SetCurrentDirectory(txtUnRarPath.Text.Trim()); // 设置当前工作路径 System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(txtUnRarPath.Text.Trim()); System.IO.FileSystemInfo[] files = dir.GetFileSystemInfos(); Int32 successCount = 0; foreach (var file in files) { if (!cbbeUnRarZip.GetCheckedComboBoxValue().Contains(file.Extension.ToLower())) { continue; } if (!System.IO.File.Exists(file.Name)) { continue; } string unrarFilePath = file.Name.Replace(file.Extension, "\\"); string comand = string.Format("\"{0}\" e -y \"{1}\" \"{2}\"", winrarPath, file.Name, unrarFilePath); JCodes.Framework.Common.Others.SystemHelper.RunCmd(comand); successCount++; this.SetText(String.Format("{0} {1}\r\n", DateTimeHelper.GetServerDateTime(), comand)); } System.IO.Directory.SetCurrentDirectory(curPath); JCodes.Framework.CommonControl.Other.MessageDxUtil.ShowTips(string.Format("成功压缩文件{0}个", successCount)); }
/* ----------------------------------------------------------------- */ /// /// ExtractImageFiles /// /// <summary> /// 指定されたパスから対象となる画像ファイルのパスを抽出する. /// src がフォルダの場合は,再帰的に展開する. /// </summary> /// /* ----------------------------------------------------------------- */ private void ExtractImageFiles(string src, Container.List<string> dest) { if (System.IO.Directory.Exists(src)) { var dir = new System.IO.DirectoryInfo(src); foreach (var item in dir.GetFileSystemInfos()) { this.ExtractImageFiles(item.FullName, dest); } } else { var ext = System.IO.Path.GetExtension(src).ToLower(); if (ext == ".bmp" || ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".gif") dest.Add(src); } }
private List <string> GetChildNamesPrivate(string path) { path = path == "" ? "." : path; // Workaround until our globber handles relative paths path = NormalizePath(path); System.IO.DirectoryInfo directory = new System.IO.DirectoryInfo(path); if (!directory.Exists) { return(new List <string> { new System.IO.FileInfo(path).Name }); } return((from fs in directory.GetFileSystemInfos() select fs.Name).ToList()); }
static StackObject *GetFileSystemInfos_10(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.IO.DirectoryInfo instance_of_this_method = (System.IO.DirectoryInfo) typeof(System.IO.DirectoryInfo).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.GetFileSystemInfos(); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
} // End Function IterativeSearch2 public static bool IterativeSearch1(string path) { System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(path); System.IO.FileSystemInfo[] arrfsiEntities = null; arrfsiEntities = dirInfo.GetFileSystemInfos(); // Creates and initializes a new Stack. System.Collections.Stack myStack = new System.Collections.Stack(); //Console.WriteLine("Stack is empty when \t stack.count={0}", myStack.Count); int iIndex = 0; int iMaxEntities = arrfsiEntities.Length - 1; do { for (iIndex = 0; iIndex <= iMaxEntities; iIndex += 1) { if (arrfsiEntities[iIndex].Attributes == System.IO.FileAttributes.Directory) { //Console.WriteLine("Searching directory " + arrfsiEntities[iIndex].FullName); myStack.Push(arrfsiEntities[iIndex].FullName); } else { //Console.WriteLine("{0}", arrfsiEntities[iIndex].FullName); } } // Next iIndex dirInfo = null; System.Array.Clear(arrfsiEntities, 0, arrfsiEntities.Length); // Dont try to do move the next line in the loop while/until statement, null reference when pop on an empty stack... if (myStack.Count == 0) { break; } dirInfo = new System.IO.DirectoryInfo(myStack.Pop().ToString()); arrfsiEntities = dirInfo.GetFileSystemInfos(); iIndex = 0; iMaxEntities = arrfsiEntities.Length - 1; }while (true); return(true); } // End Function IterativeSearch1
/// <summary> /// /// </summary> /// <param name="path"></param> /// <param name="dep"></param> /// <param name="ignoreFiles">[文件名|深度] 多个字段有逗号隔开</param> public FileScanInfo(string path, int dep, string ignoreFiles) : this(dep) { var DRoot = new System.IO.DirectoryInfo(path); Name = DRoot.Name; FullName = DRoot.FullName; CreateTime = DRoot.CreationTime; UpdateTime = DRoot.LastWriteTime; if (DRoot.Attributes != System.IO.FileAttributes.Directory) { IsLeaf = true; Extension = DRoot.Extension; var file = new System.IO.FileInfo(DRoot.FullName); if (file != null && file.Exists) { Size = file.Length; } return; } IsLeaf = false; if (dep > 0) { var chiDir = DRoot.GetFileSystemInfos(); foreach (var item in chiDir.OrderBy(t => t.FullName)) { var filterName = item.Name + "|" + (Level + 1); if (!string.IsNullOrEmpty(ignoreFiles) && ignoreFiles.Contains(filterName)) { continue; } FileScanInfo child = new FileScanInfo(item.FullName, dep - 1, ignoreFiles); child.Level = Level + 1; if (!string.IsNullOrWhiteSpace(child.Name)) { Children.Add(child); Size += child.Size; } } } }
//Recursive File and Folder Listing VB.NET public static bool RecursiveSearch(string path) { System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(path); //System.IO.FileSystemInfo fileObject = default(System.IO.FileSystemInfo); foreach (System.IO.FileSystemInfo fsiThisEntityInfo in dirInfo.GetFileSystemInfos()) { if (fsiThisEntityInfo.Attributes == System.IO.FileAttributes.Directory) { //Console.WriteLine("Searching directory " + fsiThisEntityInfo.FullName); RecursiveSearch(fsiThisEntityInfo.FullName); } else { //Console.WriteLine(fsiThisEntityInfo.FullName); } } // Next fiThisFileInfo return(true); } // End Function RecursiveSearch
public void AllDocsUpload(string coursename) { try { Pages.Courses.Courses c = new Pages.Courses.Courses(driver); System.Threading.Thread.Sleep(2000); c.CourseName().SendKeys(coursename); c.CourseSelect().Click(); CourseContent cc = new CourseContent(driver); System.Threading.Thread.Sleep(2000); _test = _extent.StartTest("Test Case#01: All type of Docs Upload functionality check"); Pages.Courses.UploadContent uc = new Pages.Courses.UploadContent(driver); System.IO.DirectoryInfo root = new System.IO.DirectoryInfo(@"D:\Prakash\Ez2enlight\LMSAutomation\LMSAutomation\Data\AllDocs"); var files = root.GetFileSystemInfos("*.*").ToArray(); foreach (var file in files) { cc.UploadContent().Click(); uc.FileName().SendKeys(file.Name); uc.Duration().SendKeys(prop.getProperty("durationforUploaded")); uc.SelectAFile().Click(); Utility.FileUpload.UploadFile(@"D:\Prakash\Ez2enlight\LMSAutomation\LMSAutomation\Data\AllDocs\" + file.Name); uc.SubmitButton().Click(); cc.SuccessAlert().Click(); } cc.CheckBoxForPublish().Click(); cc.PublishButton().Click(); PublishCourse objPublishCourse = new PublishCourse(driver); objPublishCourse.FirstMod().Click(); Assert.AreEqual(files.Length, objPublishCourse.TotalImagesFiles().Count); _test.Log(LogStatus.Pass, "Upload files are successfully visible in preview"); _extent.EndTest(_test); } catch (Exception e) { screenShotObj.GetScreenshot(driver, "UploadCOntent" + e.Message); _test.Log(LogStatus.Fail, "Some files are missing in preview course"); _extent.EndTest(_test); } _extent.Flush(); _extent.Close(); }
public DirectoryQueueMessage GetMessage(TimeSpan?retrieveVisibilityTimeout = null) { if (!System.IO.Directory.Exists(this.queuePath)) { return(null); } try { this.AcquireLock(); System.Diagnostics.Debug.WriteLine("Get Message"); string msgpath = null; System.IO.DirectoryInfo dInfo = new System.IO.DirectoryInfo(this.queuePath); foreach (var t in dInfo.GetFileSystemInfos($"*{msgExtension}").OrderBy(p => p.CreationTime)) { if ((t.Attributes & System.IO.FileAttributes.Hidden) != System.IO.FileAttributes.Hidden) { msgpath = t.FullName; } } if (null == msgpath) { return(null); } DirectoryQueueMessage nextMessage = DirectoryQueueMessage.FromQueueFile(msgpath); System.Diagnostics.Debug.WriteLine(msgpath); // NOTE: we release the lock after we have the message because we update the visibility for the file nextMessage.DequeueCount++; nextMessage.Hide(retrieveVisibilityTimeout); nextMessage.Store(); // make sure dequeue count has been stored correctly. return(nextMessage); } finally { this.ReleaseLock(); } }
/// <summary> /// Borrar un directorio y su contenido /// </summary> public static void DeleteFolder(string fullPath) { if (System.IO.Directory.Exists(fullPath)) { System.IO.DirectoryInfo directory = new System.IO.DirectoryInfo(fullPath) { Attributes = System.IO.FileAttributes.Normal }; foreach (var info in directory.GetFileSystemInfos("*", System.IO.SearchOption.AllDirectories)) { System.IO.FileInfo fInfo = info as System.IO.FileInfo; if (fInfo != null) { info.Attributes = System.IO.FileAttributes.Normal; } } System.Threading.Thread.Sleep(100); directory.Delete(true); } }
public static void CopyDirectory(string sourcePath, string destinationPath) { System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(sourcePath); System.IO.Directory.CreateDirectory(destinationPath); foreach (System.IO.FileSystemInfo fsi in info.GetFileSystemInfos()) { string destName = System.IO.Path.Combine(destinationPath, fsi.Name); if (fsi is System.IO.FileInfo) { System.IO.File.Copy(fsi.FullName, destName, true); System.IO.File.Delete(fsi.FullName); } else { System.IO.Directory.CreateDirectory(destName); CopyDirectory(fsi.FullName, destName); } } System.IO.Directory.Delete(sourcePath); }
public static List <string> GetAllFiles(string dir) { var list = new List <string>(); var dirInfo = new System.IO.DirectoryInfo(dir); var entries = dirInfo.GetFileSystemInfos(); foreach (var item in entries) { if (item.Attributes == System.IO.FileAttributes.Directory) { list.AddRange(GetAllFiles(item.FullName)); } else { var extension = System.IO.Path.GetExtension(item.FullName).ToLower(); if (PlayerHelper.IsVideoFormat(extension) == true) { list.Add(item.FullName); } } } return(list); }
private void ReadRecentFlightData_Click(object sender, EventArgs e) { string filePath = Application.ExecutablePath + @"DAT\"; filePath = filePath.Replace(Application.ProductName, "").Replace(".exe", ""); // Get a directory info object to look up files System.IO.DirectoryInfo diObj = new System.IO.DirectoryInfo(filePath); System.IO.FileSystemInfo[] fileSysObj = diObj.GetFileSystemInfos(); if (fileSysObj.Length > 0) { // lambda expression to sort by created date var flightFiles = fileSysObj.OrderBy(f => f.CreationTime); string mostRecentFile = flightFiles.Last().ToString(); filePath += mostRecentFile; FlightDataReader reader = new FlightDataReader(filePath); MessageBox.Show(filePath); reader.LoadFlightData(); reader.Show(); } else { MessageBox.Show("No flight data available.", "No flight data.", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public ActionResult Save(IFormCollection fc) { var Type = fc["ClassType"].ToStr(); var Url = (fc["Url"].ToStr() == null ? _WebRootPath + "\\Content\\CreateFile\\" : fc["Url"].ToStr()); var Str = fc["Str"]; var Table = fc["Table"]; var isall = fc["isall"].ToBool(); var template = _WebRootPath + "\\Content\\Template\\"; if (Type == "Model") { Url = (Url + "\\Model"); template = template + "Model\\Model.txt"; Str = string.IsNullOrEmpty(Str.ToStr()) ? "M" : Str.ToStr(); } else if (Type == "BLL") { Url = Url + "\\BLL"; template = template + "Bll\\BLL.txt"; Str = string.IsNullOrEmpty(Str.ToStr()) ? "BL" : Str.ToStr(); } else if (Type == "DAL") { Url = Url + "\\DAL"; template = template + "DAL\\DAL.txt"; Str = string.IsNullOrEmpty(Str.ToStr()) ? "DA" : Str.ToStr(); } if (System.IO.Directory.Exists(Url + "\\")) { var dir = new System.IO.DirectoryInfo(Url + "\\"); var fileinfo = dir.GetFileSystemInfos(); //返回目录中所有文件和子目录 foreach (var i in fileinfo) { if (i is System.IO.DirectoryInfo) //判断是否文件夹 { var subdir = new System.IO.DirectoryInfo(i.FullName); subdir.Delete(true); //删除子目录和文件 } else { System.IO.File.Delete(i.FullName); //删除指定文件 } } //System.IO.Directory.Delete(Url + "\\"); } System.IO.Directory.CreateDirectory(Url); if (!System.IO.File.Exists(template)) { throw new MessageBox("模板文件不存在"); } var Content = System.IO.File.ReadAllText(template); if (isall) { var list = _Sys_CreateCodeBL.GetAllTable(); foreach (var item in list) { Table = item["TABLE_NAME"] == null ? "" : item["TABLE_NAME"].ToString(); this._Sys_CreateCodeBL.CreateFileLogic(Content, Table, Str, Type, Url); } } else { if (string.IsNullOrEmpty(Table)) { throw new MessageBox("请选择表"); } this._Sys_CreateCodeBL.CreateFileLogic(Content, Table, Str, Type, Url); } return(Json(new { status = 1 })); }
public ActionResult Save(IFormCollection fc) { var classType = fc["ClassType"].ToStr(); var pathUrl = (fc["Url"].ToStr() == null ? _WebRootPath + "\\Content\\CreateFile\\" : fc["Url"].ToStr()); var isall = fc["isall"].ToBool(); var tableName = fc["Table"].ToStr() ?? ""; if (classType == "Model") { if (System.IO.Directory.Exists(pathUrl + "\\Models\\")) { var dir = new System.IO.DirectoryInfo(pathUrl + "\\Models\\"); var fileinfo = dir.GetFileSystemInfos(); //返回目录中所有文件和子目录 foreach (var i in fileinfo) { if (i is System.IO.DirectoryInfo) //判断是否文件夹 { var subdir = new System.IO.DirectoryInfo(i.FullName); subdir.Delete(true); //删除子目录和文件 } else { System.IO.File.Delete(i.FullName); //删除指定文件 } } } if (!isall) { _createCodeService.CreatedModel(tableName, pathUrl + "Models\\", "ADT.Models"); } else { var list = _createCodeService.GetAllTable(); foreach (var item in list) { _createCodeService.CreatedModel(item.TABLE_NAME, pathUrl + "Models\\", "ADT.Models"); } } } else { var template = _WebRootPath + "\\Content\\Template\\"; var ipathUrl = pathUrl; var templates = string.Empty; //模板生成路径 var templatei = string.Empty; //模板接口生成路径 var classFileName = string.Empty; if (classType == "Service") { pathUrl += "\\Service\\"; ipathUrl = $"{pathUrl}\\IService"; templates = $"{template}\\Service\\Service.txt"; templatei = $"{template}\\Service\\IService.txt"; classFileName = "Service"; } else if (classType == "Repository") { pathUrl += "\\Repository\\"; ipathUrl = $"{pathUrl}\\IRepository"; templates = $"{template}\\Repository\\Repository.txt"; templatei = $"{template}\\Repository\\IRepository.txt"; classFileName = "Repository"; } else if (classType == "Model") { pathUrl += "\\Models\\"; templates = $"{template}\\Model\\Model.txt"; } if (!System.IO.File.Exists(templates) || (classType != "Model" && !System.IO.File.Exists(templatei))) { return(Json(new { status = 200, msg = "模板文件不存在" })); } if (System.IO.Directory.Exists(pathUrl + "\\")) { var dir = new System.IO.DirectoryInfo(pathUrl + "\\"); var fileinfo = dir.GetFileSystemInfos(); //返回目录中所有文件和子目录 foreach (var i in fileinfo) { if (i is System.IO.DirectoryInfo) //判断是否文件夹 { var subdir = new System.IO.DirectoryInfo(i.FullName); subdir.Delete(true); //删除子目录和文件 } else { System.IO.File.Delete(i.FullName); //删除指定文件 } } //System.IO.Directory.Delete(Url + "\\"); } if (!System.IO.Directory.Exists(pathUrl)) { System.IO.Directory.CreateDirectory(pathUrl); } if (!System.IO.Directory.Exists(ipathUrl)) { System.IO.Directory.CreateDirectory(ipathUrl); } var Content = System.IO.File.ReadAllText(templates); var Content1 = string.Empty; if (classType != "Model") { Content1 = System.IO.File.ReadAllText(templatei); } if (!isall) { _createCodeService.CreateFileLogic(Content, tableName, classType, pathUrl, tableName + classFileName); if (classType != "Model") { _createCodeService.CreateFileLogic(Content1, tableName, classType, ipathUrl, $"I{tableName}{classFileName}"); } } else { var list = _createCodeService.GetAllTable(); foreach (var item in list) { _createCodeService.CreateFileLogic(Content, item.TABLE_NAME, classType, pathUrl, item.TABLE_NAME + classFileName); if (classType != "Model") { _createCodeService.CreateFileLogic(Content1, item.TABLE_NAME, classType, ipathUrl, $"I{item.TABLE_NAME}{classFileName}"); } } } } return(Json(new { status = 1, data = fc["ClassType"].ToStr(), path = fc["Url"].ToStr() })); }
public ActionResult Save(FormCollection fc) { var Type = fc["ClassType"]; var Url = (fc["Url"] == null ? Server.MapPath("/Content/CreateFile") : fc["Url"]); var Str = fc["Str"]; var Table = fc["Table"]; var isall = Tools.getBool(fc["isall"]); var template = Server.MapPath("/Content/Template/"); if (Type == "Model") { Url = (Url + "\\Model"); template = template + "Model\\Model.txt"; Str = string.IsNullOrEmpty(Tools.getString(Str)) ? "M" : Tools.getString(Str); } else if (Type == "BLL") { Url = Url + "\\BLL"; template = template + "Bll\\BLL.txt"; Str = string.IsNullOrEmpty(Tools.getString(Str)) ? "BL" : Tools.getString(Str); } else if (Type == "DAL") { Url = Url + "\\DAL"; template = template + "DAL\\DAL.txt"; Str = string.IsNullOrEmpty(Tools.getString(Str)) ? "DA" : Tools.getString(Str); } if (System.IO.Directory.Exists(Url + "\\")) { var dir = new System.IO.DirectoryInfo(Url + "\\"); var fileinfo = dir.GetFileSystemInfos(); //返回目录中所有文件和子目录 foreach (var i in fileinfo) { if (i is System.IO.DirectoryInfo) //判断是否文件夹 { var subdir = new System.IO.DirectoryInfo(i.FullName); subdir.Delete(true); //删除子目录和文件 } else { System.IO.File.Delete(i.FullName); //删除指定文件 } } //System.IO.Directory.Delete(Url + "\\"); } System.IO.Directory.CreateDirectory(Url); if (!System.IO.File.Exists(template)) { throw new MessageBox("模板文件不存在"); } var Content = System.IO.File.ReadAllText(template); if (isall) { var list = createcodebl.GetAllTable(); foreach (var item in list) { Table = item["TABLE_NAME"] == null ? "" : item["TABLE_NAME"].ToString(); this.CreateFileLogic(Content, Table, Str, Type, Url); } } else { if (string.IsNullOrEmpty(Table)) { throw new MessageBox("请选择表"); } this.CreateFileLogic(Content, Table, Str, Type, Url); } return(Json(new { status = 1 }, JsonRequestBehavior.DenyGet)); }
static void Main(string[] args) { string tempPath = System.Environment.GetEnvironmentVariable("TEMP"); if (tempPath == null) { tempPath = System.Environment.GetEnvironmentVariable("TMP"); } if (tempPath == null) { tempPath = "..\\.."; } Exception exc = null; System.DateTime now = System.DateTime.Now; System.Security.Cryptography.X509Certificates.X509Certificate xc = null; System.IO.StreamWriter sw = null; System.IO.StreamReader sr = null; System.IO.DirectoryInfo di = null; bool b = false; System.DateTime dt = InicDateTime(); string[] sL = null; System.IO.FileInfo[] fiL = null; System.IO.DirectoryInfo[] diL = null; System.IO.FileSystemInfo[] fsiL = null; System.IO.FileStream fs = null; System.IO.FileInfo fi = null; System.IAsyncResult asr = null; int i = 0; long l = 0; string s = null; System.IO.IsolatedStorage.IsolatedStorageFile isf = null; System.IO.IsolatedStorage.IsolatedStorageFileStream isfs = null; byte[] bL = null; System.Diagnostics.Process p = null; System.IO.FileInfo fileInfo = new System.IO.FileInfo(tempPath + "\\resources18file.txt"); fileInfo.Create().Close(); System.IO.StreamWriter outFile = fileInfo.AppendText(); System.Console.WriteLine(tempPath + "\\resources18file.txt"); try { try { exc = null; di = null; now = System.DateTime.Now; di = System.IO.Directory.CreateDirectory(tempPath + "\\TestDir1\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine("Func: " + "System.IO.Directory.CreateDirectory(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + toString(di)); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; di = null; now = System.DateTime.Now; di = System.IO.Directory.GetParent(tempPath + "\\TestDir1\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath); outFile.WriteLine("Func: " + "System.IO.Directory.GetParent(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + toString(di)); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; now = System.DateTime.Now; b = System.IO.Directory.Exists(tempPath + "\\TestDir1\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine("Func: " + "System.IO.Directory.Exists(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + toString(b)); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.SetCreationTime(tempPath + "\\TestDir1\\", new System.DateTime(2003, 01, 01)); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine("Func: " + "System.IO.Directory.SetCreationTime(String, DateTime)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; dt = InicDateTime(); now = System.DateTime.Now; dt = System.IO.Directory.GetCreationTime(tempPath + "\\TestDir1\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine("Func: " + "System.IO.Directory.GetCreationTime(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + toString(dt)); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.SetLastWriteTime(tempPath + "\\TestDir1\\", new System.DateTime(2003, 01, 01)); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine("Func: " + "System.IO.Directory.SetLastWriteTime(String, DateTime)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; dt = InicDateTime(); now = System.DateTime.Now; dt = System.IO.Directory.GetLastWriteTime(tempPath + "\\TestDir1\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine("Func: " + "System.IO.Directory.GetLastWriteTime(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + toString(dt)); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.SetLastAccessTime(tempPath + "\\TestDir1\\", new System.DateTime(2003, 01, 01)); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine("Func: " + "System.IO.Directory.SetLastAccessTime(String, DateTime)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; dt = InicDateTime(); now = System.DateTime.Now; dt = System.IO.Directory.GetLastAccessTime(tempPath + "\\TestDir1\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine("Func: " + "System.IO.Directory.GetLastAccessTime(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + toString(dt)); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; sL = null; now = System.DateTime.Now; sL = System.IO.Directory.GetFiles(tempPath + "\\TestDir1\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine("Func: " + "System.IO.Directory.GetFiles(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + toString(sL)); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; sL = null; now = System.DateTime.Now; sL = System.IO.Directory.GetDirectories(tempPath + "\\TestDir1\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine("Func: " + "System.IO.Directory.GetDirectories(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + toString(sL)); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.GetFileSystemEntries(tempPath + "\\TestDir1\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine("Func: " + "System.IO.Directory.GetFileSystemEntries(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + toString(sL)); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.SetCurrentDirectory(tempPath + "\\TestDir1\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath); outFile.WriteLine("Func: " + "System.IO.Directory.SetCurrentDirectory(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.Move(tempPath + "\\TestDir1\\", tempPath + "\\TestDir2\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine("Func: " + "System.IO.Directory.Move(String, String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); //--- outFile.WriteLine("Name: " + tempPath + "\\TestDir2"); outFile.WriteLine("Func: " + "System.IO.Directory.Move(String, String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.Delete(tempPath + "\\TestDir1\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine("Func: " + "System.IO.Directory.Delete(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.Delete(tempPath + "\\TestDir2\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir2"); outFile.WriteLine("Func: " + "System.IO.Directory.Delete(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } } catch (Exception) { } try { di = null; di = new System.IO.DirectoryInfo(tempPath); System.IO.DirectoryInfo di2 = null; try { try { exc = null; di2 = null; now = System.DateTime.Now; di2 = di.CreateSubdirectory(tempPath + "\\TestDir3\\"); di = di2; } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir3"); outFile.WriteLine("Func: " + "System.IO.DirectoryInfo.CreateSubdirectory(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + toString(di2)); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; fiL = null; now = System.DateTime.Now; fiL = di.GetFiles(); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir3"); outFile.WriteLine("Func: " + "System.IO.DirectoryInfo.GetFiles()"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + toString(fiL)); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; diL = null; now = System.DateTime.Now; diL = di.GetDirectories(); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir3"); outFile.WriteLine("Func: " + "System.IO.DirectoryInfo.GetDirectories()"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + toString(diL)); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; fsiL = null; now = System.DateTime.Now; fsiL = di.GetFileSystemInfos(); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir3"); outFile.WriteLine("Func: " + "System.IO.DirectoryInfo.GetFileSystemInfos()"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + toString(fsiL)); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; now = System.DateTime.Now; di.MoveTo(tempPath + "\\TestDir4\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir3"); outFile.WriteLine("Func: " + "System.IO.DirectoryInfo.MoveTo(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); //--- outFile.WriteLine("Name: " + tempPath + "\\TestDir4"); outFile.WriteLine("Func: " + "System.IO.DirectoryInfo.MoveTo(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } } finally { try { exc = null; char[] backSlash = new char[1]; backSlash[0] = '\\'; outFile.WriteLine("Name: " + di.FullName.TrimEnd(backSlash)); now = System.DateTime.Now; di.Delete(); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Func: " + "System.IO.DirectoryInfo.Delete()"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } } try { di = null; di = new System.IO.DirectoryInfo(tempPath + "\\TestDir5\\"); try { exc = null; now = System.DateTime.Now; di.Create(); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir5"); outFile.WriteLine("Func: " + "System.IO.DirectoryInfo.Create()"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } try { exc = null; now = System.DateTime.Now; di.MoveTo(tempPath + "\\TestDir6\\"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Name: " + tempPath + "\\TestDir5"); outFile.WriteLine("Func: " + "System.IO.DirectoryInfo.MoveTo(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); //--- outFile.WriteLine("Name: " + tempPath + "\\TestDir6"); outFile.WriteLine("Func: " + "System.IO.DirectoryInfo.MoveTo(String)"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } } catch (Exception) { } finally { try { exc = null; char[] backSlash = new char[1]; backSlash[0] = '\\'; outFile.WriteLine("Name: " + di.FullName.TrimEnd(backSlash)); now = System.DateTime.Now; di.Delete(); } catch (Exception e) { exc = e; } finally { outFile.WriteLine("Func: " + "System.IO.DirectoryInfo.Delete()"); outFile.WriteLine("Proc: " + System.Diagnostics.Process.GetCurrentProcess().Id); outFile.WriteLine("Time: " + GetTime(now)); outFile.WriteLine("Retv: " + ""); outFile.WriteLine("Errc: " + ""); outFile.WriteLine("Exce: " + GetException(exc)); } } } catch (Exception) { } outFile.Flush(); outFile.Close(); try { sL = System.IO.Directory.GetDirectories(tempPath, "TempDir*"); foreach (string str in sL) { try { System.IO.Directory.Delete(str); } catch (Exception) { } } } catch (Exception) { } } // Main
//Iterative File and Folder Listing in VB.NET public static bool IterativeSearch2(string strPath) { System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(strPath); System.IO.FileSystemInfo[] arrfsiEntities = null; arrfsiEntities = dirInfo.GetFileSystemInfos(); // Creates and initializes a new Stack. System.Collections.Stack strLastPathStack = new System.Collections.Stack(); System.Collections.Stack iIndexStack = new System.Collections.Stack(); int iIndex = 0; int iMaxEntities = arrfsiEntities.Length; do { while (iIndex < iMaxEntities) { if (arrfsiEntities[iIndex].Attributes == System.IO.FileAttributes.Directory) { //Console.WriteLine("Searching directory " + arrfsiEntities[iIndex].FullName); strLastPathStack.Push(System.IO.Directory.GetParent(arrfsiEntities[iIndex].FullName).FullName); strLastPathStack.Push(arrfsiEntities[iIndex].FullName); iIndexStack.Push(iIndex); dirInfo = null; System.Array.Clear(arrfsiEntities, 0, arrfsiEntities.Length); dirInfo = new System.IO.DirectoryInfo(strLastPathStack.Pop().ToString()); arrfsiEntities = dirInfo.GetFileSystemInfos(); iIndex = 0; iMaxEntities = arrfsiEntities.Length; continue; } else { //Console.WriteLine(arrfsiEntities[iIndex].FullName); } iIndex += 1; } // Whend dirInfo = null; System.Array.Clear(arrfsiEntities, 0, arrfsiEntities.Length); // Dont try to do move the next line in the loop while/until statement, null reference when pop on an empty stack... if (strLastPathStack.Count == 0) { break; } dirInfo = new System.IO.DirectoryInfo(strLastPathStack.Pop().ToString()); arrfsiEntities = dirInfo.GetFileSystemInfos(); iIndex = (int)iIndexStack.Pop() + 1; iMaxEntities = arrfsiEntities.Length; } // End do while (true); return(true); } // End Function IterativeSearch2
public static System.Collections.Generic.IEnumerable <System.IO.FileInfo> IterativelyEnumerate( System.IO.DirectoryInfo initialPath, System.Func <System.IO.FileInfo, bool> selector ) { // https://stackoverflow.com/questions/3932382/traversing-directories-without-using-recursion // http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/00cd9dc3c2b5/src/share/classes/java/util/ArrayDeque.java System.Collections.Generic.Stack <System.IO.DirectoryInfo> stack = new System.Collections.Generic.Stack <System.IO.DirectoryInfo>(); stack.Push(initialPath); int n = 0; string NtAccountName = System.Environment.UserDomainName + @"\" + System.Environment.UserName; while (stack.Count != 0) { n++; System.IO.DirectoryInfo di = stack.Pop(); if (IsCyclicSymlink(di)) { continue; } System.IO.FileSystemInfo[] entries = null; try { bool hasPerm = DirectoryHasPermission(di, System.Security.AccessControl.FileSystemRights.Read); if (!hasPerm) { System.Console.WriteLine(di.FullName); continue; } entries = di.GetFileSystemInfos(); } catch (System.Exception ex) { // "Access to the path 'C:\\Windows\\Temp' is denied." // still one bug: 'C:\ProgramData\Microsoft\NetFramework\BreadcrumbStore' System.Console.WriteLine(ex.Message); System.Console.WriteLine(ex.StackTrace); System.Console.WriteLine(di.FullName); continue; } foreach (System.IO.FileSystemInfo f in entries) { if (f.IsDirectory()) { System.IO.DirectoryInfo dir = f as System.IO.DirectoryInfo; if (dir != null) { stack.Push(dir); } else { System.Console.WriteLine(f.FullName); } continue; } // if (IsSymLink(f)) continue; if (IsCyclicSymlink(f)) { continue; } // if (f.IsHidden()) continue; n++; System.IO.FileInfo fi = (System.IO.FileInfo)f; if (selector != null && !selector(fi)) { continue; } System.Console.WriteLine(fi.FullName); yield return(fi); } // Next f } // Whend System.Console.WriteLine(n); } // End Function IterativelyEnumerate
private List<string> GetChildNamesPrivate(string path) { path = path == "" ? "." : path; // Workaround until our globber handles relative paths path = NormalizePath(path); System.IO.DirectoryInfo directory = new System.IO.DirectoryInfo(path); if (!directory.Exists) { return new List<string> { new System.IO.FileInfo(path).Name }; } return (from fs in directory.GetFileSystemInfos() select fs.Name).ToList(); }
//第二步:定义线程的主体方法 /// <summary> /// 线程的主体方法 /// </summary> private void WinRarDeal() { if (string.IsNullOrEmpty(txtRarPath.Text.Trim())) { JCodes.Framework.CommonControl.Other.MessageDxUtil.ShowWarning("请选择压缩路径后再操作"); return; } if (!System.IO.Directory.Exists(txtRarPath.Text.Trim())) { JCodes.Framework.CommonControl.Other.MessageDxUtil.ShowWarning("压缩路径不存在,请确认后再操作"); return; } // 获取rar路径 string winrarPath = System.Configuration.ConfigurationManager.AppSettings["WinRarPath"]; if (!System.IO.File.Exists(winrarPath)) { JCodes.Framework.CommonControl.Other.MessageDxUtil.ShowWarning("App.Config 中配置的WinRarPath路径有问题,请确认后再操作"); return; } string curPath = System.IO.Directory.GetCurrentDirectory(); // 获取当前工作路径; System.IO.Directory.SetCurrentDirectory(txtRarPath.Text.Trim()); // 设置当前工作路径 System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(txtRarPath.Text.Trim()); System.IO.FileSystemInfo[] files = dir.GetFileSystemInfos(); Int32 successCount = 0; foreach (var file in files) { // "C:\Program Files\WinRAR\WinRAR.exe" a wjm 1 (把1这个文件夹压缩到压缩包wjm中) string rarfileName = string.Empty; if (string.Equals(file.Extension.ToLower(), ".rar") || string.Equals(file.Extension.ToLower(), ".zip")) { continue; } // 该文件是用于备份或删除的候选版本 if (file.Attributes == System.IO.FileAttributes.Archive) { rarfileName = file.FullName.Replace(file.Extension, ""); } if (file.Attributes == System.IO.FileAttributes.Directory) { rarfileName = file.FullName; } if (string.IsNullOrEmpty(rarfileName)) { continue; } if (System.IO.File.Exists(rarfileName + ".rar")) { continue; } string comand = string.Format("\"{0}\" a \"{1}\" \"{2}\"", winrarPath, rarfileName, file.Name); JCodes.Framework.Common.Others.SystemHelper.RunCmd(comand); successCount++; this.SetText(String.Format("{0} {1}\r\n", DateTimeHelper.GetServerDateTime(), comand)); } System.IO.Directory.SetCurrentDirectory(curPath); JCodes.Framework.CommonControl.Other.MessageDxUtil.ShowTips(string.Format("成功压缩文件{0}个", successCount)); }
static void DoRestore(string backupDir, string targetDrive) { System.IO.DirectoryInfo dirInfo; List<System.IO.FileInfo> fileInfos = new List<System.IO.FileInfo>(); string backupDirFull = System.IO.Path.GetFullPath(backupDir); // Recursively get a list of FileInfos for the backed up files try { dirInfo = new System.IO.DirectoryInfo(backupDirFull); if (!dirInfo.Exists) { throw new System.IO.DirectoryNotFoundException(); } GetFileSystemInfosRecurse(dirInfo.GetFileSystemInfos(), fileInfos); } catch (System.IO.IOException) { Console.WriteLine("ERROR: Failed to list files in backup directory."); return; } if(fileInfos.Count == 0) { Console.WriteLine("ERROR: No files in backup directory to restore."); return; } string filesForEdit = ""; string filesForAdd = ""; System.IO.FileInfo deletedFileInfo = null; System.IO.FileInfo descFileInfo = null; // Find any existing files that need to be opened for edit, the rest are for add. foreach (System.IO.FileInfo fileInfo in fileInfos) { if(fileInfo.Name == k_DeletesFilename) { deletedFileInfo = fileInfo; } else if (fileInfo.Name == k_DescFilename) { descFileInfo = fileInfo; } else { string localFilename = targetDrive + fileInfo.FullName.Substring(backupDirFull.Length); if (System.IO.File.Exists(localFilename)) { filesForEdit += localFilename + " "; } else { filesForAdd += localFilename + " "; } } } string desc = "P4Backup restored files"; // Remove __description.txt from the list of fileinfos, since it's not a real p4 file to be restored if (descFileInfo != null) { fileInfos.Remove(descFileInfo); try { System.IO.StreamReader SR = descFileInfo.OpenText(); desc = SR.ReadToEnd(); } catch (System.IO.IOException e) { Console.WriteLine("ERROR: Failed to open \"__description.txt\". Aborting. Error: " + e.Message); return; } } // Make the new changelist to hold the restored files in P4. int changeListID = -1; if (!P4Shell.CreateChangelist(desc, ref changeListID)) { Console.WriteLine("ERROR: Failed to create new changelist."); Console.WriteLine(P4Shell.Error); return; } // Remove __deletes.txt from the the list of fileinfos, since it's not a real p4 file to be restored if(deletedFileInfo != null) { fileInfos.Remove(deletedFileInfo); StringBuilder deletedFilenamesMerged = new StringBuilder(); Console.WriteLine("Processing deletes from __deletes.txt..."); try { System.IO.StreamReader SR = deletedFileInfo.OpenText(); deletedFilenamesMerged.EnsureCapacity((int)(deletedFileInfo.Length * 1.2f)); string deletedFilename = SR.ReadLine(); while(deletedFilename != null) { deletedFilenamesMerged.Append(targetDrive); deletedFilenamesMerged.Append('\\'); deletedFilenamesMerged.Append(deletedFilename); deletedFilenamesMerged.Append(' '); deletedFilename = SR.ReadLine(); } SR.Close(); } catch (System.IO.IOException e) { Console.WriteLine("ERROR: Failed to open \"__deletes.txt\". Aborting. Error: " + e.Message); return; } if(!P4Shell.Delete(deletedFilenamesMerged.ToString(), changeListID)) { Console.WriteLine("ERROR: Failed to open files for delete. Aborting."); Console.WriteLine(P4Shell.Output); Console.WriteLine(P4Shell.Error); return; } Console.WriteLine(P4Shell.Output); } // Open existing files on the hard drive for edit if ((filesForEdit != "") && !P4Shell.Edit(filesForEdit, changeListID)) { Console.WriteLine("ERROR: Failed to open existing files for edit. Aborting."); Console.WriteLine(P4Shell.Output); Console.WriteLine(P4Shell.Error); return; } Console.WriteLine(P4Shell.Output); try { foreach (System.IO.FileInfo fileInfo in fileInfos) { string localFilename = targetDrive + fileInfo.FullName.Substring(backupDirFull.Length); string localDir = localFilename.Substring(0, localFilename.LastIndexOf('\\')); System.IO.Directory.CreateDirectory(localDir); System.IO.File.Copy(fileInfo.FullName, localFilename, true); } } catch (System.IO.IOException e) { Console.WriteLine("ERROR: Exception during file copy. Aborting. Error: " + e.Message); return; } if((filesForAdd != "") && !P4Shell.Add(filesForAdd, changeListID)) { Console.WriteLine("ERROR: After files copied locally, error adding some to perforce: \n" + P4Shell.Error); Console.WriteLine(P4Shell.Output); Console.WriteLine(P4Shell.Error); return; } Console.WriteLine(P4Shell.Output); Console.WriteLine("\nRestore successful."); }
static void Main(string[] args) { string tempPath = System.Environment.GetEnvironmentVariable ("TEMP"); if (tempPath == null) { tempPath = System.Environment.GetEnvironmentVariable ("TMP"); } if (tempPath == null) { tempPath = "..\\.."; } Exception exc = null; System.DateTime now = System.DateTime.Now; System.Security.Cryptography.X509Certificates.X509Certificate xc = null; System.IO.StreamWriter sw = null; System.IO.StreamReader sr = null; System.IO.DirectoryInfo di = null; bool b = false; System.DateTime dt = InicDateTime (); string[] sL = null; System.IO.FileInfo[] fiL = null; System.IO.DirectoryInfo[] diL = null; System.IO.FileSystemInfo[] fsiL = null; System.IO.FileStream fs = null; System.IO.FileInfo fi = null; System.IAsyncResult asr = null; int i = 0; long l = 0; string s = null; System.IO.IsolatedStorage.IsolatedStorageFile isf = null; System.IO.IsolatedStorage.IsolatedStorageFileStream isfs = null; byte[] bL = null; System.Diagnostics.Process p = null; System.IO.FileInfo fileInfo = new System.IO.FileInfo (tempPath + "\\resources4file.txt"); fileInfo.Create ().Close (); System.IO.StreamWriter outFile = fileInfo.AppendText (); System.Console.WriteLine (tempPath + "\\resources4file.txt"); try { exc = null; xc = null; now = System.DateTime.Now; xc = System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromCertFile (tempPath + "\\dummyFile1.txt"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile1.txt"); outFile.WriteLine ("Func: " + "System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromCertFile(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (xc)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; xc = null; now = System.DateTime.Now; xc = System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromSignedFile (tempPath + "\\dummyFile2.txt"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile2.txt"); outFile.WriteLine ("Func: " + "System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromSignedFile(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (xc)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } /* try { System.IO.BinaryWriter.Write (); System.IO.BinaryWriter.Seek (); System.IO.BinaryWriter.Flush (); System.IO.BinaryWriter.Close (); System.IO.BinaryWriter bw = new System.IO.BinaryWriter (); } catch (Exception e) { } try { System.IO.BufferedStream.WriteByte (); System.IO.BufferedStream.Write (); System.IO.BufferedStream.ReadByte (); System.IO.BufferedStream.Read (); System.IO.BufferedStream.SetLength (); System.IO.BufferedStream.Seek (); System.IO.BufferedStream.EndWrite (); System.IO.BufferedStream.BeginWrite (); System.IO.BufferedStream.EndRead (); System.IO.BufferedStream.BeginRead (); System.IO.BufferedStream.Flush (); System.IO.BufferedStream.Close (); System.IO.BufferedStream bs = new System.IO.BufferedStream (); } catch (Exception e) { } */ try { exc = null; try { exc = null; sw = null; now = System.DateTime.Now; sw = new System.IO.StreamWriter (tempPath + "\\dummyFile3.txt"); outFile.WriteLine ("Name: " + tempPath + "\\dummyFile3.txt"); outFile.WriteLine ("Func: " + "System.IO.StreamWriter.ctor(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sw)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); try { exc = null; System.Console.SetOut (sw); try { exc = null; now = System.DateTime.Now; System.Console.WriteLine (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile3.txt"); outFile.WriteLine ("Func: " + "System.Console.WriteLine()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; System.Console.Out.Write ("hello"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile3.txt"); outFile.WriteLine ("Func: " + "System.IO.TextWriter.Write(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } finally { try { sw.Close (); } catch (Exception) { } } } catch (Exception) { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile3.txt"); outFile.WriteLine ("Func: " + "System.IO.StreamWriter.ctor(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sw)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; sr = null; now = System.DateTime.Now; sr = new System.IO.StreamReader (tempPath + "\\dummyFile4.txt"); outFile.WriteLine ("Name: " + tempPath + "\\dummyFile4.txt"); outFile.WriteLine ("Func: " + "System.IO.StreamReader.ctor(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sr)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); try { System.Console.SetIn (sr); try { exc = null; now = System.DateTime.Now; System.Console.ReadLine (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile4.txt"); outFile.WriteLine ("Func: " + "System.Console.ReadLine()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; System.Console.In.ReadLine (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile4.txt"); outFile.WriteLine ("Func: " + "System.IO.TextReader.ReadLine()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception) { } finally { try { sr.Close (); } catch (Exception) { } } } catch (Exception e) { exc = e; outFile.WriteLine ("Name: " + tempPath + "\\dummyFile4.txt"); outFile.WriteLine ("Func: " + "System.IO.StreamReader.ctor(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sr)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; sw = null; now = System.DateTime.Now; sw = new System.IO.StreamWriter (tempPath + "\\dummyFile5.txt"); outFile.WriteLine ("Name: " + tempPath + "\\dummyFile.txt"); outFile.WriteLine ("Func: " + "System.IO.StreamWriter.ctor(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sw)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); try { System.Console.SetError (sw); try { exc = null; now = System.DateTime.Now; System.Console.Error.WriteLine (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile5.txt"); outFile.WriteLine ("Func: " + "System.IO.TextWriter.WriteLine(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } finally { try { sw.Close (); } catch (Exception) { } } } catch (Exception e) { exc = e; outFile.WriteLine ("Name: " + tempPath + "\\dummyFile5.txt"); outFile.WriteLine ("Func: " + "System.IO.StreamWriter.ctor(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sw)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception) { } try { try { exc = null; di = null; now = System.DateTime.Now; di = System.IO.Directory.CreateDirectory (tempPath + "\\TestDir1"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine ("Func: " + "System.IO.Directory.CreateDirectory(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (di)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; di = null; now = System.DateTime.Now; di = System.IO.Directory.GetParent (tempPath + "\\TestDir1"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath); outFile.WriteLine ("Func: " + "System.IO.Directory.GetParent(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (di)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; b = System.IO.Directory.Exists (tempPath + "\\TestDir1"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine ("Func: " + "System.IO.Directory.Exists(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (b)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.SetCreationTime (tempPath + "\\TestDir1", new System.DateTime (2003, 01, 01)); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine ("Func: " + "System.IO.Directory.SetCreationTime(String, DateTime)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; dt = InicDateTime (); now = System.DateTime.Now; dt = System.IO.Directory.GetCreationTime (tempPath + "\\TestDir1"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine ("Func: " + "System.IO.Directory.GetCreationTime(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (dt)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.SetLastWriteTime (tempPath + "\\TestDir1", new System.DateTime (2003, 01, 01)); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine ("Func: " + "System.IO.Directory.SetLastWriteTime(String, DateTime)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; dt = InicDateTime (); now = System.DateTime.Now; dt = System.IO.Directory.GetLastWriteTime (tempPath + "\\TestDir1"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine ("Func: " + "System.IO.Directory.GetLastWriteTime(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (dt)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.SetLastAccessTime (tempPath + "\\TestDir1", new System.DateTime (2003, 01, 01)); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine ("Func: " + "System.IO.Directory.SetLastAccessTime(String, DateTime)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; dt = InicDateTime (); now = System.DateTime.Now; dt = System.IO.Directory.GetLastAccessTime (tempPath + "\\TestDir1"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine ("Func: " + "System.IO.Directory.GetLastAccessTime(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (dt)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; sL = null; now = System.DateTime.Now; sL = System.IO.Directory.GetFiles (tempPath + "\\TestDir1"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine ("Func: " + "System.IO.Directory.GetFiles(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sL)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; sL = null; now = System.DateTime.Now; sL = System.IO.Directory.GetDirectories (tempPath + "\\TestDir1"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine ("Func: " + "System.IO.Directory.GetDirectories(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sL)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.GetFileSystemEntries (tempPath + "\\TestDir1"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine ("Func: " + "System.IO.Directory.GetFileSystemEntries(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sL)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.SetCurrentDirectory (tempPath + "\\TestDir1\\.."); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath); outFile.WriteLine ("Func: " + "System.IO.Directory.SetCurrentDirectory(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.Move (tempPath + "\\TestDir1", tempPath + "\\TestDir2"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine ("Func: " + "System.IO.Directory.Move(String, String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); //--- outFile.WriteLine ("Name: " + tempPath + "\\TestDir2"); outFile.WriteLine ("Func: " + "System.IO.Directory.Move(String, String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.Delete (tempPath + "\\TestDir1"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir1"); outFile.WriteLine ("Func: " + "System.IO.Directory.Delete(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; System.IO.Directory.Delete (tempPath + "\\TestDir2"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir2"); outFile.WriteLine ("Func: " + "System.IO.Directory.Delete(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception) { } try { di = null; di = new System.IO.DirectoryInfo (tempPath); System.IO.DirectoryInfo di2 = null; try { try { exc = null; di2 = null; now = System.DateTime.Now; di2 = di.CreateSubdirectory (tempPath + "\\TestDir3"); di = di2; } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir3"); outFile.WriteLine ("Func: " + "System.IO.DirectoryInfo.CreateSubdirectory(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (di2)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; fiL = null; now = System.DateTime.Now; fiL = di.GetFiles (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir3"); outFile.WriteLine ("Func: " + "System.IO.DirectoryInfo.GetFiles()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (fiL)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; diL = null; now = System.DateTime.Now; diL = di.GetDirectories (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir3"); outFile.WriteLine ("Func: " + "System.IO.DirectoryInfo.GetDirectories()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (diL)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; fsiL = null; now = System.DateTime.Now; fsiL = di.GetFileSystemInfos (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir3"); outFile.WriteLine ("Func: " + "System.IO.DirectoryInfo.GetFileSystemInfos()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (fsiL)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; di.MoveTo (tempPath + "\\TestDir4"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir3"); outFile.WriteLine ("Func: " + "System.IO.DirectoryInfo.MoveTo(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); //--- outFile.WriteLine ("Name: " + tempPath + "\\TestDir4"); outFile.WriteLine ("Func: " + "System.IO.DirectoryInfo.MoveTo(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } finally { try { exc = null; char[] backSlash = new char[1]; backSlash[0] = '\\'; outFile.WriteLine ("Name: " + di.FullName.TrimEnd (backSlash)); now = System.DateTime.Now; di.Delete (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Func: " + "System.IO.DirectoryInfo.Delete()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } try { di = null; di = new System.IO.DirectoryInfo (tempPath + "\\TestDir5"); try { exc = null; now = System.DateTime.Now; di.Create (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir5"); outFile.WriteLine ("Func: " + "System.IO.DirectoryInfo.Create()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; di.MoveTo (tempPath + "\\TestDir6"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\TestDir5"); outFile.WriteLine ("Func: " + "System.IO.DirectoryInfo.MoveTo(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); //--- outFile.WriteLine ("Name: " + tempPath + "\\TestDir6"); outFile.WriteLine ("Func: " + "System.IO.DirectoryInfo.MoveTo(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception) { } finally { try { exc = null; char[] backSlash = new char[1]; backSlash[0] = '\\'; outFile.WriteLine ("Name: " + di.FullName.TrimEnd (backSlash)); now = System.DateTime.Now; di.Delete (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Func: " + "System.IO.DirectoryInfo.Delete()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } } catch (Exception) { } try { try { exc = null; sr = null; now = System.DateTime.Now; sr = System.IO.File.OpenText (tempPath + "\\dummyFile6.txt"); sr.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile6.txt"); outFile.WriteLine ("Func: " + "System.IO.File.OpenText(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sr)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; sw = null; now = System.DateTime.Now; sw = System.IO.File.CreateText (tempPath + "\\dummyFile7.txt"); sw.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile7.txt"); outFile.WriteLine ("Func: " + "System.IO.File.CreateText(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sw)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; sw = null; now = System.DateTime.Now; sw = System.IO.File.AppendText (tempPath + "\\dummyFile8.txt"); sw.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile8.txt"); outFile.WriteLine ("Func: " + "System.IO.File.AppendText(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sw)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; fs = null; now = System.DateTime.Now; fs = System.IO.File.Open (tempPath + "\\dummyFile9.txt", System.IO.FileMode.OpenOrCreate); fs.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile9.txt"); outFile.WriteLine ("Func: " + "System.IO.File.Open(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (fs)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; System.IO.File.SetCreationTime (tempPath + "\\dummyFile9.txt", new System.DateTime (2003, 01, 01)); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile9.txt"); outFile.WriteLine ("Func: " + "System.IO.File.SetCreationTime(String, DateTime)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; dt = InicDateTime (); now = System.DateTime.Now; dt = System.IO.File.GetCreationTime (tempPath + "\\dummyFile9.txt"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile9.txt"); outFile.WriteLine ("Func: " + "System.IO.File.GetCreationTime(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (dt)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; System.IO.File.SetLastAccessTime (tempPath + "\\dummyFile9.txt", new System.DateTime (2003, 01, 01)); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile9.txt"); outFile.WriteLine ("Func: " + "System.IO.File.SetLastAccessTime(String, DateTime)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; dt = System.IO.File.GetLastAccessTime (tempPath + "\\dummyFile9.txt"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile9.txt"); outFile.WriteLine ("Func: " + "System.IO.File.GetLastAccessTime(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (dt)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; System.IO.File.SetLastWriteTime (tempPath + "\\dummyFile9.txt", new System.DateTime (2003, 01, 01)); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile9.txt"); outFile.WriteLine ("Func: " + "System.IO.File.SetLastWriteTime(String, DateTime)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; dt = InicDateTime (); now = System.DateTime.Now; dt = System.IO.File.GetLastWriteTime (tempPath + "\\dummyFile9.txt"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile9.txt"); outFile.WriteLine ("Func: " + "System.IO.File.GetLastWriteTime(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (dt)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; fs = null; now = System.DateTime.Now; fs = System.IO.File.OpenRead (tempPath + "\\dummyFile10.txt"); fs.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile10.txt"); outFile.WriteLine ("Func: " + "System.IO.File.OpenRead(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (fs)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; fs = null; now = System.DateTime.Now; fs = System.IO.File.OpenWrite (tempPath + "\\dummyFile11.txt"); fs.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile11.txt"); outFile.WriteLine ("Func: " + "System.IO.File.OpenWrite(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (fs)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; fs = null; now = System.DateTime.Now; fs = System.IO.File.Create (tempPath + "\\testFile1.txt"); fs.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\testFile1.txt"); outFile.WriteLine ("Func: " + "System.IO.File.Create(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (fs)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; fs = null; now = System.DateTime.Now; System.IO.File.Move (tempPath + "\\testFile1.txt", tempPath + "\\testFile2.txt"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\testFile1.txt"); outFile.WriteLine ("Func: " + "System.IO.File.OpenWrite(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); //--- outFile.WriteLine ("Name: " + tempPath + "\\testFile2.txt"); outFile.WriteLine ("Func: " + "System.IO.File.OpenWrite(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; System.IO.File.Delete (tempPath + "\\testFile2.txt"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\testFile2.txt"); outFile.WriteLine ("Func: " + "System.IO.File.Delete(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; b = System.IO.File.Exists (tempPath + "\\testFile3.txt"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\testFile3.txt"); outFile.WriteLine ("Func: " + "System.IO.File.Exists(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (b)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception) { } try { fi = new System.IO.FileInfo (tempPath + "\\testFile4.txt"); try { exc = null; fs = null; now = System.DateTime.Now; fs = fi.Create (); fs.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\testFile4.txt"); outFile.WriteLine ("Func: " + "System.IO.FileInfo.Create()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (fs)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; sr = null; now = System.DateTime.Now; sr = fi.OpenText (); sr.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\testFile4.txt"); outFile.WriteLine ("Func: " + "System.IO.FileInfo.OpenText()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sr)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; sw = null; now = System.DateTime.Now; sw = fi.CreateText (); sw.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\testFile4.txt"); outFile.WriteLine ("Func: " + "System.IO.FileInfo.CreateText()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sw)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; sw = null; now = System.DateTime.Now; sw = fi.AppendText (); sw.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\testFile4.txt"); outFile.WriteLine ("Func: " + "System.IO.FileInfo.AppendText()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (sw)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; fs = null; fi = new System.IO.FileInfo (tempPath + "\\testFile5.txt"); now = System.DateTime.Now; fs = fi.Open (System.IO.FileMode.Open); fs.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\testFile5.txt"); outFile.WriteLine ("Func: " + "System.IO.FileInfo.Create(FileMode)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (fs)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; fs = null; now = System.DateTime.Now; fs = fi.OpenWrite (); fs.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\testFile5.txt"); outFile.WriteLine ("Func: " + "System.IO.FileInfo.OpenWrite()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (fs)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; fi.MoveTo (tempPath + "\\testFile6.txt"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\testFile5.txt"); outFile.WriteLine ("Func: " + "System.IO.FileInfo.MoveTo(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); //--- outFile.WriteLine ("Name: " + tempPath + "\\testFile6.txt"); outFile.WriteLine ("Func: " + "System.IO.FileInfo.MoveTo(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; char[] backSlash = new char[1]; backSlash[0] = '\\'; outFile.WriteLine ("Name: " + fi.FullName.TrimEnd (backSlash)); now = System.DateTime.Now; fi.Delete (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Func: " + "System.IO.FileInfo.Delete()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception) { } try { exc = null; byte[] array = new byte[1]; array[0] = 0; fs = null; now = System.DateTime.Now; fs = System.IO.File.Open (tempPath + "\\dummyFile12.txt", System.IO.FileMode.OpenOrCreate); outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.File.Open(String, FileMode)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (fs)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); try { exc = null; now = System.DateTime.Now; fs.Lock (0, 1); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.Lock(Int64, Int64)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; fs.Unlock (0, 1); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.Unlock(Int64, Int64)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; fs.WriteByte (0); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.WriteByte(Byte)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; fs.Write (array, 0, 1); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.Write(Byte[], Int32, Int32)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; asr = null; now = System.DateTime.Now; asr = fs.BeginWrite (array, 0, 1, null, null); outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (asr)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); try { exc = null; now = System.DateTime.Now; fs.EndWrite (asr); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.EndWrite(IAsyncResult)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception e) { exc = e; outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (asr)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; fs.SetLength (2); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.SetLength(Int64)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; fs.Flush (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.Flush()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; i = 0; now = System.DateTime.Now; i = fs.ReadByte (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.ReadByte()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (i)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; i = 0; now = System.DateTime.Now; i = fs.Read (array, 0, 1); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.Read(Byte[], Int32, Int32)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (i)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; l = 0; now = System.DateTime.Now; l = fs.Seek (0, System.IO.SeekOrigin.Begin); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.Seek(Int64, SeekOrigin)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (l)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; asr = null; now = System.DateTime.Now; asr = fs.BeginRead (array, 0, 1, null, null); outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.BeginRead(Byte[], Int32, Int32, AsyncCallback, Object)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (asr)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); try { exc = null; i = 0; now = System.DateTime.Now; i = fs.EndRead (asr); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.EndRead(IAsyncResult)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (i)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception e) { exc = e; outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.BeginRead(Byte[], Int32, Int32, AsyncCallback, Object)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (asr)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; fs.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.FileStream.Close(IAsyncResult)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception e) { exc = e; outFile.WriteLine ("Name: " + tempPath + "\\dummyFile12.txt"); outFile.WriteLine ("Func: " + "System.IO.File.Open(String, FileMode)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (fs)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { System.IO.TextWriter tw = new System.IO.StreamWriter (tempPath + "\\dummyFile13.txt"); try { exc = null; now = System.DateTime.Now; tw.WriteLine ("hello"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile13.txt"); outFile.WriteLine ("Func: " + "System.IO.TextWriter.WriteLine(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; tw.Write ("12345678790"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile13.txt"); outFile.WriteLine ("Func: " + "System.IO.TextWriter.Write(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; tw.Flush (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile13.txt"); outFile.WriteLine ("Func: " + "System.IO.TextWriter.Flush()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; tw.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile13.txt"); outFile.WriteLine ("Func: " + "System.IO.TextWriter.Close()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception) { } try { char[] array = new char[1]; array[0] = 'a'; System.IO.TextReader tr = new System.IO.StreamReader (tempPath + "\\dummyFile13.txt"); try { exc = null; s = null; now = System.DateTime.Now; s = tr.ReadLine (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile13.txt"); outFile.WriteLine ("Func: " + "System.IO.TextReader.ReadLine()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (s)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; i = 0; now = System.DateTime.Now; i = tr.ReadBlock (array, 0, 1); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile13.txt"); outFile.WriteLine ("Func: " + "System.IO.TextReader.ReadBlock(Char[], Int32, Int32)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (i)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; i = 0; now = System.DateTime.Now; i = tr.Read (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile13.txt"); outFile.WriteLine ("Func: " + "System.IO.TextReader.Read()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (i)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; i = 0; now = System.DateTime.Now; i = tr.Read (array, 0, 1); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile13.txt"); outFile.WriteLine ("Func: " + "System.IO.TextReader.Read(Char[], Int32, Int32)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (i)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; s = null; now = System.DateTime.Now; s = tr.ReadToEnd (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile13.txt"); outFile.WriteLine ("Func: " + "System.IO.TextReader.ReadToEnd()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (s)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; tr.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile13.txt"); outFile.WriteLine ("Func: " + "System.IO.TextReader.Close()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception) { } try { sw = new System.IO.StreamWriter (tempPath + "\\dummyFile14.txt"); try { exc = null; now = System.DateTime.Now; sw.Write (0); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile14.txt"); outFile.WriteLine ("Func: " + "System.IO.StreamWriter.Write(Int32)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; sw.Flush (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile14.txt"); outFile.WriteLine ("Func: " + "System.IO.StreamWriter.Flush()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; sw.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile14.txt"); outFile.WriteLine ("Func: " + "System.IO.StreamWriter.Close()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception) { } /* try { exc = null; System.IO.IsolatedStorage.IsolatedStorageScope iss = System.IO.IsolatedStorage.IsolatedStorageScope.User | System.IO.IsolatedStorage.IsolatedStorageScope.Assembly | System.IO.IsolatedStorage.IsolatedStorageScope.Domain; isf = null; now = System.DateTime.Now; isf = System.IO.IsolatedStorage.IsolatedStorageFile.GetStore (iss, null, null); try { exc = null; now = System.DateTime.Now; isf.Dispose (); } catch (Exception e) { exc = e; } // System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForDomain (); // System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForAssembly (); // System.IO.IsolatedStorage.IsolatedStorageFile.GetStore (System.IO.IsolatedStorage.IsolatedStorageScope.User | System.IO.IsolatedStorage.IsolatedStorageScope.Assembly | System.IO.IsolatedStorage.IsolatedStorageScope.Domain, null, null); try { exc = null; now = System.DateTime.Now; isf.CreateDirectory ("dummyDir"); } catch (Exception e) { exc = e; } try { exc = null; now = System.DateTime.Now; isf.GetDirectoryNames ("*"); } catch (Exception e) { exc = e; } try { exc = null; now = System.DateTime.Now; isf.DeleteFile ("dummyFile"); } catch (Exception e) { exc = e; } try { exc = null; now = System.DateTime.Now; isf.DeleteDirectory ("dummyDir"); } catch (Exception e) { exc = e; } try { exc = null; now = System.DateTime.Now; isf.GetFileNames ("*"); } catch (Exception e) { exc = e; } try { exc = null; now = System.DateTime.Now; isf.Close (); } catch (Exception e) { exc = e; } try { exc = null; now = System.DateTime.Now; System.IO.IsolatedStorage.IsolatedStorageFile.Remove (iss); } catch (Exception e) { exc = e; } } catch (Exception e) { exc = e; } */ try { exc = null; byte[] array = new byte[1]; array[0] = 0; isfs = null; now = System.DateTime.Now; isfs = new System.IO.IsolatedStorage.IsolatedStorageFileStream (tempPath + "\\dummyFile15.txt", System.IO.FileMode.OpenOrCreate); outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.ctor(String, FileMode)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (isfs)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); try { exc = null; now = System.DateTime.Now; isfs.Lock (0, 1); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.Lock(Int64, Int64)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; isfs.Unlock (0, 1); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.Unlock(Int64, Int64)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; isfs.WriteByte (0); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.WriteByte(Byte)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; isfs.Write (array, 0, 1); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.Write(Byte[], Int32, Int32)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; asr = null; now = System.DateTime.Now; asr = isfs.BeginWrite (array, 0, 1, null, null); outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.BeginWrite(IAsyncResult, Int32, Int32, AsyncCallback, Object)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (asr)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); try { exc = null; now = System.DateTime.Now; isfs.EndWrite (asr); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.EndWrite(IAsyncResult)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception e) { exc = e; outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.BeginWrite(IAsyncResult, Int32, Int32, AsyncCallback, Object)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (asr)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; isfs.SetLength (2); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.SetLength(Int64)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; isfs.Flush (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.Flush()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; l = 0; now = System.DateTime.Now; l = isfs.Seek (0, System.IO.SeekOrigin.Begin); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.Seek(Int64, SeekOrigin)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (l)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; i = 0; now = System.DateTime.Now; i = isfs.ReadByte (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.ReadByte()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (i)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; i = 0; now = System.DateTime.Now; i = isfs.Read (array, 0, 1); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.Read(Byte[], Int32, Int32)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (i)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; asr = null; now = System.DateTime.Now; asr = isfs.BeginRead (array, 0, 1, null, null); outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.BeginRead(Byte[], Int32, Int32, AsyncCallback, Object)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (asr)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); try { exc = null; i = 0; now = System.DateTime.Now; i = isfs.EndRead (asr); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.EndRead(IAsyncResult)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (i)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception e) { exc = e; outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.BeginRead(Byte[], Int32, Int32, AsyncCallback, Object)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (asr)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; now = System.DateTime.Now; isfs.Close (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.Close()"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception e) { exc = e; outFile.WriteLine ("Name: " + tempPath + "\\dummyFile15.txt"); outFile.WriteLine ("Func: " + "System.IO.IsolatedStorage.IsolatedStorageFileStream.ctor(String, FileMode)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (isfs)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { System.Net.WebClient wc = new System.Net.WebClient (); try { exc = null; now = System.DateTime.Now; wc.DownloadFile ("http://www.google.com", tempPath + "\\dummyFile16.txt"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile16.txt"); outFile.WriteLine ("Func: " + "System.Net.WebClient.DownloadFile(String, String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + ""); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; bL = null; now = System.DateTime.Now; bL = wc.UploadFile ("http://www.google.com", tempPath + "\\dummyFile16.txt"); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile16.txt"); outFile.WriteLine ("Func: " + "System.Net.WebClient.UploadFile(String, String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + toString (bL)); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception) { } try { string processString = null; try { exc = null; p = null; now = System.DateTime.Now; p = System.Diagnostics.Process.Start (tempPath + "\\dummyFile16.txt"); processString = toString (p); p.Kill (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile16.txt"); outFile.WriteLine ("Func: " + "System.Diagnostics.Process.Start(String)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + processString); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } try { exc = null; System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo (tempPath + "\\dummyFile16.txt"); p = null; now = System.DateTime.Now; p = System.Diagnostics.Process.Start (psi); processString = toString (p); p.Kill (); } catch (Exception e) { exc = e; } finally { outFile.WriteLine ("Name: " + tempPath + "\\dummyFile16.txt"); outFile.WriteLine ("Func: " + "System.Diagnostics.Process.Start(ProcessStartInfo)"); outFile.WriteLine ("Proc: " + System.Diagnostics.Process.GetCurrentProcess ().Id); outFile.WriteLine ("Time: " + GetTime (now)); outFile.WriteLine ("Retv: " + processString); outFile.WriteLine ("Errc: " + ""); outFile.WriteLine ("Exce: " + GetException (exc)); } } catch (Exception) { } /* try { now = System.DateTime.Now; System.Configuration.AppSettingsReader asr = new System.Configuration.AppSettingsReader (); asr.GetValue ("key", System.Type.GetType ("System.Object", false)); } catch (Exception e) { } */ /* try { System.Xml.XmlDocument.Save (); System.Xml.XmlDocument.LoadXml (); System.Xml.XmlDocument.WriteContentTo (); System.Xml.XmlDocument.WriteTo (); System.Xml.XmlDocument xd = new System.Xml.XmlDocument (System.Xml.XmlNameTable); System.Xml.XmlDocumentFragment.WriteContentTo (); System.Xml.XmlDocumentFragment.WriteTo (); System.Xml.XmlDocumentType.WriteContentTo (); System.Xml.XmlDocumentType.WriteTo (); } catch (Exception e) { } try { System.Xml.XmlWriter.WriteNode (); System.Xml.XmlWriter.WriteAttributes (); System.Xml.XmlWriter.WriteStartElement (); System.Xml.XmlWriter.WriteAttributeString (); System.Xml.XmlWriter.WriteStartAttribute (); System.Xml.XmlWriter.WriteElementString (); } catch (Exception e) { } try { System.Xml.XmlTextWriter xtw = System.Xml.XmlTextWriter (tempPath + "\\dummyFile.txt", System.Text.Encoding.ASCII); xtw.WriteNode (); xtw.WriteAttributes (); xtw.WriteQualifiedName ("localName", ); xtw.WriteName (); xtw.WriteNmToken (); xtw.WriteBinHex (); xtw.WriteBase64 (); xtw.WriteRaw (); xtw.WriteChars (); xtw.WriteSurrogateCharEntity (); xtw.WriteString (); xtw.WriteWhitespace (); xtw.WriteCharEntity (); xtw.WriteEntityRef (); xtw.WriteProcessingInstruction (); xtw.WriteComment (); xtw.WriteCData (); xtw.WriteEndAttribute (); xtw.WriteStartAttribute (); xtw.WriteFullEndElement (); xtw.WriteEndElement (); xtw.WriteStartElement (); xtw.WriteDocType (); xtw.WriteEndDocument (); xtw.WriteStartDocument (); xtw.WriteAttributeString (); xtw.WriteElementString (); xtw.Flush (); xtw.Close (); } catch (Exception e) { } try { System.Xml.XmlReader.IsStartElement (); System.Xml.XmlReader.ReadEndElement (); System.Xml.XmlReader.ReadElementString (); System.Xml.XmlReader.ReadStartElement (); System.Xml.XmlReader.MoveToContent (); System.Xml.XmlReader.Skip (); System.Xml.XmlReader.IsName (); System.Xml.XmlReader.IsNameToken (); } catch (Exception e) { } try { System.Xml.XmlTextReader.ReadAttributeValue (); System.Xml.XmlTextReader.ResolveEntity (); System.Xml.XmlTextReader.LookupNamespace (); System.Xml.XmlTextReader.ReadOuterXml (); System.Xml.XmlTextReader.ReadInnerXml (); System.Xml.XmlTextReader.IsStartElement (); System.Xml.XmlTextReader.ReadEndElement (); System.Xml.XmlTextReader.ReadElementString (); System.Xml.XmlTextReader.ReadStartElement (); System.Xml.XmlTextReader.MoveToContent (); System.Xml.XmlTextReader.ReadString (); System.Xml.XmlTextReader.Skip (); System.Xml.XmlTextReader.Close (); System.Xml.XmlTextReader.Read (); System.Xml.XmlTextReader.MoveToElement (); System.Xml.XmlTextReader.MoveToNextAttribute (); System.Xml.XmlTextReader.MoveToFirstAttribute (); System.Xml.XmlTextReader.MoveToAttribute (); System.Xml.XmlTextReader.GetAttribute (); System.Xml.XmlTextReader.GetRemainder (); System.Xml.XmlTextReader.ReadChars (); System.Xml.XmlTextReader.ReadBase64 (); System.Xml.XmlTextReader.ReadBinHex (); System.Xml.XmlTextReader.ctor (); } catch (Exception e) { } try { System.Xml.XmlEntityReference.WriteContentTo (); System.Xml.XmlEntityReference.WriteTo (); System.Xml.XmlImplementation.CreateDocument (); System.Xml.XmlImplementation.ctor (); System.Xml.XmlText.WriteContentTo (); System.Xml.XmlText.WriteTo (); } catch (Exception e) { } */ outFile.Flush (); outFile.Close (); try { sL = System.IO.Directory.GetFiles (tempPath, "tempFile*.txt"); foreach (string str in sL) { try { System.IO.File.Delete (str); } catch (Exception) { } } sL = System.IO.Directory.GetFiles (tempPath, "dummyFile*.txt"); foreach (string str in sL) { try { System.IO.File.Delete (str); } catch (Exception) { } } sL = System.IO.Directory.GetDirectories (tempPath, "TempDir*"); foreach (string str in sL) { try { System.IO.Directory.Delete (str); } catch (Exception) { } } } catch (Exception) { } }