public static void LogException(Java.Lang.Throwable ex) { System.IO.DirectoryInfo myDir = new System.IO.DirectoryInfo(Android.OS.Environment.ExternalStorageDirectory.ToString()); if (!myDir.Exists) { myDir.Create(); } string saveFile = System.IO.Path.Combine(myDir.FullName, "errorLog.txt"); Java.IO.File logFile = new Java.IO.File(saveFile); if (!logFile.Exists()) { try { logFile.CreateNewFile(); } catch (Java.IO.IOException e) { Android.Util.Log.Error("LogException unable to create file", e.Message); } } Java.IO.PrintWriter pw; try { pw = new Java.IO.PrintWriter(new Java.IO.FileWriter(saveFile, true)); ex.PrintStackTrace(pw); pw.Flush(); pw.Close(); } catch (Java.IO.IOException e) { Android.Util.Log.Error("LogException unable to save file", e.Message); } }
public ActionResult AddManualImage(int Img_Manual_ID, int Manual_Active, HttpPostedFileBase Img_Manual_Image) { if (Session["Roles"] != null && Session["Roles"].Equals("Admin")) { hypster_tv_DAL.manualManagement manualManager = new hypster_tv_DAL.manualManagement(); hypster_tv_DAL.Manual currManual = new hypster_tv_DAL.Manual(); currManual = manualManager.GetManualByID(Img_Manual_ID); currManual.Manual_Active = Manual_Active; manualManager.UpdateManual(currManual); if (Img_Manual_Image != null && Img_Manual_Image.FileName != null && Img_Manual_Image.FileName != "") { System.IO.DirectoryInfo dirInf = new System.IO.DirectoryInfo(System.Configuration.ConfigurationManager.AppSettings["ManualsStorage_Path"] + "\\" + currManual.Manual_Guid); if (dirInf.Exists == false) { dirInf.Create(); } var extension = ".jpg"; //System.IO.Path.GetExtension(Img_Manual_Image.FileName); string tmp_image_path = System.Configuration.ConfigurationManager.AppSettings["ManualsStorage_Path"] + "\\" + currManual.Manual_Guid + "\\TMP_" + Img_Manual_ID + extension; string perm_image_path = System.Configuration.ConfigurationManager.AppSettings["ManualsStorage_Path"] + "\\" + currManual.Manual_Guid + "\\" + Img_Manual_ID + extension; Img_Manual_Image.SaveAs(tmp_image_path); hypster_tv_DAL.Image_Resize_Manager imageResizer = new hypster_tv_DAL.Image_Resize_Manager(); imageResizer.Resize_Image(tmp_image_path, 700, -1, System.Drawing.Imaging.ImageFormat.Jpeg, perm_image_path, 70L); System.IO.FileInfo file_del = new System.IO.FileInfo(tmp_image_path); file_del.Delete(); } return(RedirectPermanent("/WebsiteManagement/manageManuals")); } else { return(RedirectPermanent("/home/")); } }
public static void Core_DataUpload(Connectome.Core.DataUploadEventArgs e) { var image = Connectome.Visualize.Imaging(e, Visualization.CameraLocation, Visualization.ViewLocation, Visualization.ImageSize, RequestDrawCell, RequestDrawEdgeLine); Form.SetImage(image); if (RequestSave) { int index = SaveImageIndex++; System.Drawing.Bitmap temporary = (System.Drawing.Bitmap)image.Bitmap.Clone(); new System.Threading.Thread(() => { var dinfo = new System.IO.DirectoryInfo("img"); if (!dinfo.Exists) { dinfo.Create(); } string name = index.ToString(); while (name.Length < 10) { name = "0" + name; } temporary.Save(dinfo.FullName + @"\f" + name + ".png", System.Drawing.Imaging.ImageFormat.Png); }).Start(); } }
/// <summary> /// 上传文件到指定文件夹 /// </summary> /// <param name="inputfile"></param> /// <param name="uploadfilepath"></param> /// <returns></returns> public static string UpLoadfile(HttpPostedFileBase inputfile, string uploadfilepath) { string orifilename = string.Empty; string modifyfilename = string.Empty; string fileExt = ""; //文件扩展名 int fileSize = 0; //文件大小 try { if (inputfile.FileName != string.Empty) { //得到文件的大小 fileSize = inputfile.ContentLength; //得到扩展名 fileExt = inputfile.FileName.Substring(inputfile.FileName.LastIndexOf(".") + 1); //新文件名 string guid = System.Guid.NewGuid().ToString(); modifyfilename = guid + "." + fileExt; //判断是否有该目录 System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(uploadfilepath); if (!dir.Exists) { dir.Create(); } // 上传文件 inputfile.SaveAs(uploadfilepath + modifyfilename); orifilename = modifyfilename; } } catch (Exception ex) { throw ex; } return(orifilename); }
public void DirectoryCopy(string sourcePath, string destinationPath) { System.IO.DirectoryInfo sourceDirectory = new System.IO.DirectoryInfo(sourcePath); System.IO.DirectoryInfo destinationDirectory = new System.IO.DirectoryInfo(destinationPath); //コピー先のディレクトリがなければ作成する if (destinationDirectory.Exists == false) { destinationDirectory.Create(); destinationDirectory.Attributes = sourceDirectory.Attributes; } //ファイルのコピー foreach (System.IO.FileInfo fileInfo in sourceDirectory.GetFiles()) { //同じファイルが存在していたら、常に上書きする fileInfo.CopyTo(destinationDirectory.FullName + @"\" + fileInfo.Name, true); } //ディレクトリのコピー(再帰を使用) foreach (System.IO.DirectoryInfo directoryInfo in sourceDirectory.GetDirectories()) { DirectoryCopy(directoryInfo.FullName, destinationDirectory.FullName + @"\" + directoryInfo.Name); } }
public JobContainerViewModel(ImageDownloaderContainer downloader) { ThumbDir = new System.IO.DirectoryInfo(string.Format("{0}\\{1}", System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName())); ThumbDir.Create(); _downloader = downloader; _downloader.AddedDownloadingImage += _downloader_DownloadingImageEvent; }
private void CopyDirectoryFile(string sourceDirNm, string destDirNm) { string destDirSub = string.Empty; string sourceFileDir = string.Empty; foreach (string filePath in lstFilesChOrJp) { sourceFileDir = new System.IO.FileInfo(filePath).DirectoryName; destDirSub = destDirNm + sourceFileDir.Substring(sourceDirNm.Length); // コピー先のディレクトリがないとき if (!System.IO.Directory.Exists(destDirSub)) { //DirectoryInfoオブジェクトを作成する System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(destDirSub); di.Create(); } // コピー先のディレクトリ名の末尾に"\"をつける if (destDirSub[destDirSub.Length - 1] != System.IO.Path.DirectorySeparatorChar) { destDirSub += System.IO.Path.DirectorySeparatorChar; } // コピー先のディレクトリにあるファイルをコピー System.IO.File.Copy(filePath, destDirSub + System.IO.Path.GetFileName(filePath), true); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { #region Check direcrories System.IO.DirectoryInfo DataTemp = new System.IO.DirectoryInfo(Environment.CurrentDirectory + "\\Data\\Temp"); if (!DataTemp.Exists) { DataTemp.Create(); Log.Message("Folder Data\\Temp crated."); } System.IO.DirectoryInfo DataDataBase = new System.IO.DirectoryInfo(Environment.CurrentDirectory + "\\Data\\DataBase"); if (!DataDataBase.Exists || !System.IO.File.Exists(Consts.DBPath)) { DataDataBase.Create(); Log.Message("Folder Data\\DataBase crated."); System.Data.SQLite.SQLiteConnection db = new System.Data.SQLite.SQLiteConnection($"Data source={Consts.DBPath}; Version=3"); db.Open(); var cmd = new System.Data.SQLite.SQLiteCommand("CREATE TABLE Songs (Name TEXT NOT NULL UNIQUE, Lang TEXT NOT NULL, Number INTEGER (0, 2500) NOT NULL, Category TEXT NOT NULL, MP3 BLOB NOT NULL, Popularity INTEGER NOT NULL DEFAULT(0));", db); cmd.ExecuteNonQuery(); Log.Message("File Data\\Temp\\Songs.db crated."); db.Close(); } System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(Environment.CurrentDirectory + "\\Data\\Log"); if (!log.Exists) { log.Create(); } UpdateSongs(); #endregion Log.Message("Window Loaded."); GC.Collect(); }
public static string[] GetActions(string TID) { if (setIP(TID)) { var dir = new System.IO.DirectoryInfo(Dir); if (!dir.Exists) { dir.Create(); } var files = dir.GetFiles("*.xml"); if (files.Length > 0) { List <string> tmp = new List <string>(); foreach (var file in files) { tmp.Add(System.IO.Path.GetFileNameWithoutExtension(file.Name)); } return(tmp.ToArray()); } else { return(new string[0]); } } return(new string[0]); }
// Copy or overwrite destination file with source file. public static bool OverwriteFile(string srcFilePath, string destFilePath) { var fi = new System.IO.FileInfo(srcFilePath); if (!fi.Exists) { UnityEngine.Debug.LogError(string.Format("WwiseUnity: Failed to overwrite. Source is missing: {0}.", srcFilePath)); return(false); } var di = new System.IO.DirectoryInfo(System.IO.Path.GetDirectoryName(destFilePath)); if (!di.Exists) { di.Create(); } const bool IsToOverwrite = true; try { fi.CopyTo(destFilePath, IsToOverwrite); } catch (System.Exception ex) { UnityEngine.Debug.LogError(string.Format("WwiseUnity: Error during installation: {0}.", ex.Message)); return(false); } return(true); }
public static string DownloadAndPlay(string UrlFile, string subFolder, string NamaFile) { string TargetFileName = string.Empty; try { // Create a new WebClient instance. using (WebClient myWebClient = new WebClient()) { string AudioFile = Hadith.WPF.Tools.Logs.getPath() + "\\audio\\" + subFolder; System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(AudioFile); if (!dir.Exists) { dir.Create(); } // Download the Web resource and save it into the current filesystem folder. TargetFileName = AudioFile + "\\" + NamaFile; if (System.IO.File.Exists(TargetFileName)) { return(TargetFileName); } myWebClient.DownloadFile(new Uri(UrlFile, UriKind.RelativeOrAbsolute), TargetFileName); } return(TargetFileName); } catch { return(null); } }
public TemporaryDirectory(bool isNetwork, string folderPrefix = null, string root = null) { if (Alphaleonis.Utils.IsNullOrWhiteSpace(folderPrefix)) { folderPrefix = "AlphaFS.TempRoot"; } if (Alphaleonis.Utils.IsNullOrWhiteSpace(root)) { root = TempPath; } if (isNetwork) { root = Alphaleonis.Win32.Filesystem.Path.LocalToUnc(root); } UnitTestConstants.PrintUnitTestHeader(isNetwork); do { Directory = new System.IO.DirectoryInfo(System.IO.Path.Combine(root, folderPrefix + "." + RandomString)); } while (Directory.Exists); Directory.Create(); }
public string ConvertCtagsFileBlobAdd(Guid uploadID, System.IO.Stream fileSection) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); fileSection.CopyTo(ms); try { System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(TempFileLocation + CurrPathSeparator + "tmp-" + uploadID.ToString()); if (!dir.Exists) { dir.Create(); } using (System.IO.FileStream fs = new System.IO.FileStream(dir.FullName + CurrPathSeparator + "temp.raw", System.IO.FileMode.Append)) { ms.Seek(0, System.IO.SeekOrigin.Begin); ms.CopyTo(fs); } } catch (Exception e) { WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.InternalServerError; WebOperationContext.Current.OutgoingResponse.ContentType = "text/plain"; return("Error while receiving data: " + e.Message); } return(""); }
protected void AttachmentAdd_Click(System.Object sender, System.EventArgs args) { this.UI_case = 2; if (this.newMessageWindowAttachFile.PostedFile != null && Session["sharpwebmail/send/message/temppath"] != null) { System.String path = Session["sharpwebmail/send/message/temppath"].ToString(); System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(path); try { dir.Create(); System.String filename = System.IO.Path.GetFileName(this.newMessageWindowAttachFile.PostedFile.FileName); if (dir.GetFiles(filename).Length == 0) { this.newMessageWindowAttachFile.PostedFile.SaveAs(System.IO.Path.Combine(path, filename)); this.bindAttachments(); foreach (System.Web.UI.WebControls.ListItem item in this.newMessageWindowAttachmentsList.Items) { if (item.Value.Equals(System.IO.Path.Combine(dir.Name, filename))) { item.Selected = true; } } if (Application["sharpwebmail/send/message/attach_ui"].Equals("simple")) { this.Attach_Click(sender, args); } } } catch (System.Exception e) { if (log.IsErrorEnabled) { log.Error("", e); } } } }
private void _initCacheDirectory(Directory cacheDirectory) { #if COMPRESSBLOBS CompressBlobs = true; #endif if (cacheDirectory != null) { // save it off _cacheDirectory = cacheDirectory; } else { string cachePath = System.IO.Path.Combine(Environment.ExpandEnvironmentVariables("%temp%"), "AzureDirectory"); System.IO.DirectoryInfo azureDir = new System.IO.DirectoryInfo(cachePath); if (!azureDir.Exists) { azureDir.Create(); } string catalogPath = System.IO.Path.Combine(cachePath, _catalog); System.IO.DirectoryInfo catalogDir = new System.IO.DirectoryInfo(catalogPath); if (!catalogDir.Exists) { catalogDir.Create(); } _cacheDirectory = FSDirectory.GetDirectory(catalogPath); } CreateContainer(); }
private void Save_Button_Click(object sender, RoutedEventArgs e) { datetime = ((MainWindow)Application.Current.MainWindow).datetime; System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"\diary_data\" + datetime.ToString("yy_MM")); string titleContent = titleBox.Text; string savePath = di.FullName + @"\" + titleBox.Text + ".txt"; if (!di.Exists) { di.Create(); } string nowDate = DateTime.Now.ToString("yyyy_MM_dd-"); foreach (char c in System.IO.Path.GetInvalidFileNameChars()) { titleContent = titleContent.Replace(c, '_'); } if (titleBox.IsEnabled) { savePath = di.FullName + @"\" + nowDate + titleContent + ".txt"; } System.IO.File.WriteAllText(savePath, contentBox.Text, Encoding.UTF8); Window.GetWindow(this).Close(); }
private void ChangeVendorImagePath(VendorModel vendortype) { try { string path = HttpContext.Current.Server.MapPath("~/Content/VendorImages/"); path = path + vendortype.VendorId.Value; System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(path); info.Create(); string destlogopath = string.Empty; string destprofilepath = string.Empty; string destproductpath = string.Empty; if (!string.IsNullOrEmpty(vendortype.LogoImage)) { destlogopath = vendortype.LogoImage.Replace("Temp", vendortype.VendorId.Value.ToString()); System.IO.File.Copy(HttpContext.Current.Server.MapPath("~/" + vendortype.LogoImage), HttpContext.Current.Server.MapPath("~/" + destlogopath), true); } if (!string.IsNullOrEmpty(vendortype.ProfileImage)) { destprofilepath = vendortype.ProfileImage.Replace("Temp", vendortype.VendorId.Value.ToString()); System.IO.File.Copy(HttpContext.Current.Server.MapPath("~/" + vendortype.ProfileImage), HttpContext.Current.Server.MapPath("~/" + destprofilepath), true); } if (!string.IsNullOrEmpty(vendortype.ProductImage)) { destproductpath = vendortype.ProductImage.Replace("Temp", vendortype.VendorId.Value.ToString()); System.IO.File.Copy(HttpContext.Current.Server.MapPath("~/" + vendortype.ProfileImage), HttpContext.Current.Server.MapPath("~/" + destproductpath), true); } if (!string.IsNullOrEmpty(destlogopath) || !string.IsNullOrEmpty(destproductpath) || !string.IsNullOrEmpty(destprofilepath)) { UpdateImagePath(destlogopath, destproductpath, destprofilepath, vendortype.VendorId); } } catch (Exception ex) { } }
static public void Delete() { string path = @"C:\RACC\Data\"; System.IO.DirectoryInfo directory = new System.IO.DirectoryInfo(path); try { directory.Delete(true); Thread.Sleep(60000); directory.Create(); } catch (Exception) { directory.Create(); } }
private void _Mtd_CrearArchivoISLR(string _P_Str_ID_Archivo) { System.IO.DirectoryInfo _DirInf = new System.IO.DirectoryInfo("c:\\seniat"); if (!_DirInf.Exists) { _DirInf.Create(); } string _Str_Cadena = "SELECT REPLACE(crifagenretencion,'-','') AS crifagenretencion,cfecha FROM TARCHIVOISLRD WHERE cgroupcomp='" + Frm_Padre._Str_GroupComp + "' AND ccompany='" + Frm_Padre._Str_Comp + "' AND cidarchivoislr='" + _P_Str_ID_Archivo + "'"; DataSet _Ds = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset(_Str_Cadena); if (_Ds.Tables[0].Rows.Count > 0) { string _Str_RifAgente = _Ds.Tables[0].Rows[0]["crifagenretencion"].ToString().Trim(); string _Str_Periodo = _Ds.Tables[0].Rows[0]["cfecha"].ToString().Trim(); _Str_Cadena = "SELECT REPLACE(crifprovee,'-','') AS RifRetenido,REPLACE(cnumfact,'-','') AS NumeroFactura, REPLACE(cnumcont,'-','') AS NumeroControl,CONVERT(VARCHAR,cfechaoperacion,103) AS FechaOperacion,ccodigoconcepto AS CodigoConcepto,REPLACE(cmontdocu,',','.') AS MontoOperacion,REPLACE(cporcenreten,',','.') AS PorcentajeRetencion FROM TARCHIVOISLRD WHERE cgroupcomp='" + Frm_Padre._Str_GroupComp + "' AND ccompany='" + Frm_Padre._Str_Comp + "' AND cidarchivoislr='" + _P_Str_ID_Archivo + "'"; _Ds = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset(_Str_Cadena); _Ds.Tables[0].TableName = "DetalleRetencion"; //const string _Str_Comillas = "\""; //_Ds.DataSetName = "RelacionRetencionesISLR RifAgente=" + _Str_Comillas + _Str_RifAgente + _Str_Comillas + " Periodo=" + _Str_Periodo; _Ds.DataSetName = "RelacionRetencionesISLR"; _Ds.EnforceConstraints = false; XmlDataDocument _Xml_d = new XmlDataDocument(_Ds); XmlDeclaration _Xml_Decl = _Xml_d.CreateXmlDeclaration("1.0", "ISO-8859-1", null); XmlElement _Xml_Elem = _Xml_d.DocumentElement; _Xml_d.InsertBefore(_Xml_Decl, _Xml_Elem); XmlAttribute _Xml_a = _Xml_d.CreateAttribute("RifAgente"); _Xml_a.Value = _Str_RifAgente; _Xml_d["RelacionRetencionesISLR"].Attributes.Append(_Xml_a); _Xml_a = _Xml_d.CreateAttribute("Periodo"); _Xml_a.Value = _Str_Periodo; _Xml_d["RelacionRetencionesISLR"].Attributes.Append(_Xml_a); _Xml_d.Save("c:\\seniat\\XML_relacionRetencionesISLR_.xml"); } }
/// <summary> /// Constructs a new SQLiteConnectionString with all the data needed to open an SQLiteConnection. /// </summary> /// <param name="databasePath"> /// Specifies the path to the database file. /// </param> /// <param name="openFlags"> /// Flags controlling how the connection should be opened. /// </param> /// <param name="storeDateTimeAsTicks"> /// Specifies whether to store DateTime properties as ticks (true) or strings (false). You /// absolutely do want to store them as Ticks in all new projects. The value of false is /// only here for backwards compatibility. There is a *significant* speed advantage, with no /// down sides, when setting storeDateTimeAsTicks = true. /// If you use DateTimeOffset properties, it will be always stored as ticks regardingless /// the storeDateTimeAsTicks parameter. /// </param> /// <param name="key"> /// Specifies the encryption key to use on the database. Should be a string or a byte[]. /// </param> /// <param name="preKeyAction"> /// Executes prior to setting key for SQLCipher databases /// </param> /// <param name="postKeyAction"> /// Executes after setting key for SQLCipher databases /// </param> /// <param name="vfsName"> /// Specifies the Virtual File System to use on the database. /// </param> /// <param name="dateTimeStringFormat"> /// Specifies the format to use when storing DateTime properties as strings. /// </param> /// <param name="storeTimeSpanAsTicks"> /// Specifies whether to store TimeSpan properties as ticks (true) or strings (false). You /// absolutely do want to store them as Ticks in all new projects. The value of false is /// only here for backwards compatibility. There is a *significant* speed advantage, with no /// down sides, when setting storeTimeSpanAsTicks = true. /// </param> public SQLiteConnectionString(string databasePath, SQLiteOpenFlags openFlags, bool storeDateTimeAsTicks, object key = null, Action <SQLiteConnection> preKeyAction = null, Action <SQLiteConnection> postKeyAction = null, string vfsName = null, string dateTimeStringFormat = DateTimeSqliteDefaultFormat, bool storeTimeSpanAsTicks = true) { if (key != null && !((key is byte[]) || (key is string))) { throw new ArgumentException("Encryption keys must be strings or byte arrays", nameof(key)); } UniqueKey = string.Format("{0}_{1:X8}", databasePath, (uint)openFlags); StoreDateTimeAsTicks = storeDateTimeAsTicks; StoreTimeSpanAsTicks = storeTimeSpanAsTicks; DateTimeStringFormat = dateTimeStringFormat; DateTimeStyle = "o".Equals(DateTimeStringFormat, StringComparison.OrdinalIgnoreCase) || "r".Equals(DateTimeStringFormat, StringComparison.OrdinalIgnoreCase) ? System.Globalization.DateTimeStyles.RoundtripKind : System.Globalization.DateTimeStyles.None; Key = key; PreKeyAction = preKeyAction; PostKeyAction = postKeyAction; OpenFlags = openFlags; VfsName = vfsName; #if NETFX_CORE DatabasePath = IsInMemoryPath(databasePath) ? databasePath : System.IO.Path.Combine(MetroStyleDataPath, databasePath); #else DatabasePath = databasePath; #endif var directoryinfo = new System.IO.DirectoryInfo(DatabasePath).Parent; if (!directoryinfo.Exists) { directoryinfo.Create(); } }
private void Directory_GetFileIdInfo(bool isNetwork) { UnitTestConstants.PrintUnitTestHeader(isNetwork); var tempPath = System.IO.Path.GetTempPath(); if (isNetwork) { tempPath = Alphaleonis.Win32.Filesystem.Path.LocalToUnc(tempPath); } using (var rootDir = new TemporaryDirectory(tempPath, MethodBase.GetCurrentMethod().Name)) { var folder = rootDir.RandomDirectoryFullPath; Console.WriteLine("\nInput Directory Path: [{0}]]", folder); var dirInfo = new System.IO.DirectoryInfo(folder); dirInfo.Create(); var fid = Alphaleonis.Win32.Filesystem.Directory.GetFileIdInfo(folder); Console.WriteLine("\n\tToString(): {0}", fid); Assert.IsNotNull(fid); } Console.WriteLine(); }
public void WriteException(Exception ex, int maxFiles, string logsFolder, bool writeAsHtml) { var prefix = "FCE_" + ex.GetType().Name; var ext = writeAsHtml ? "htm" : "txt"; var di = new System.IO.DirectoryInfo(logsFolder); if (di.Exists) { var files = di.GetFiles(prefix + "*." + ext).OrderBy(x => x.CreationTime).ToArray(); if (maxFiles > 0 && files.Count() > 0 && files.Count() > maxFiles) { // Remove oldest file. files[0].Delete(); } } else { di.Create(); } //var fileTime = JocysCom.ClassLibrary.HiResDateTime.Current.Now; var fileTime = DateTime.Now; var fileName = string.Format("{0}\\{1}_{2:yyyyMMdd_HHmmss.ffffff}.{3}", di.FullName, prefix, fileTime, ext); var content = writeAsHtml ? ExceptionInfo(ex, "") : ex.ToString(); System.IO.File.AppendAllText(fileName, content); }
public string ConvertCtagsGithubRepositoryStartRequest(Guid uploadID, System.IO.Stream fileSection) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); fileSection.CopyTo(ms); try { byte[] buff = ms.GetBuffer(); string str = UnicodeEncoding.Unicode.GetString(buff, 0, (int)ms.Length); System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(TempFileLocation + CurrPathSeparator + "tmp-github-request-" + uploadID.ToString()); if (!dir.Exists) { dir.Create(); } using (System.IO.StreamWriter fs = new System.IO.StreamWriter(dir.FullName + CurrPathSeparator + "exclusion.txt", true)) { fs.Write(str); } } catch (Exception e) { WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.InternalServerError; WebOperationContext.Current.OutgoingResponse.ContentType = "text/plain"; return("Error while receiving data: " + e.Message); } return(""); }
private void btn_Add_Performer_Click(object sender, EventArgs e) { string Dest_path = DestPath; if (NameAuthorTextBox_AddPerformer.Text == "" || Country_TextBox_AddPerformer.Text == "") { if (AuthorComboBox.Items.Contains(NameAuthorTextBox_AddPerformer.Text)) { MessageBox.Show("Такой автор уже есть!\nВведите другого автора или выйдите из этой формы", "Уже существует!"); return; } else { MessageBox.Show("Проверьте вводимые данные!\nВозможно одно из полей осталось незаполненным", "Не все данные заполнены!"); return; } } MyQuery = $"EXEC [AddPerformer] '{NameAuthorTextBox_AddPerformer.Text}','{Country_TextBox_AddPerformer.Text}'"; StoredProcedureEXEC.ExecuteProcedure(MyQuery, "Автор успешно добавлен!", null); System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(Dest_path + @"\"); if (!dirInfo.Exists) { dirInfo.Create(); } dirInfo.CreateSubdirectory(NameAuthorTextBox_AddPerformer.Text); btn_Cancel_AddPerformer_Click(sender, e); }
public ActionResult AddNewManual(string ManualHeader, int ManualActive) { if (Session["Roles"] != null && Session["Roles"].Equals("Admin")) { hypster_tv_DAL.manualManagement manualManager = new hypster_tv_DAL.manualManagement(); hypster_tv_DAL.Manual manual = new hypster_tv_DAL.Manual(); manual.Manual_Active = ManualActive; manual.Manual_Date = DateTime.Now; manual.Manual_Header = ManualHeader; manual.Manual_Guid = ManualHeader.Replace("/", "").Replace("\\", "").Replace("&", "").Replace("+", "").Replace(" ", "-").Replace("?", "").Replace("!", "").Replace("*", "").Replace("$", "").Replace("\"", "").Replace("'", "").Replace("{", "").Replace("}", "").Replace(")", "").Replace("(", "").Replace("[", "").Replace("]", "").Replace("|", "").Replace(".", "").Replace(",", "").Replace(":", "").Replace(";", ""); if (manualManager.GetManualByGuid(manual.Manual_Guid).Manual_ID != 0) { Random r = new Random(); manual.Manual_Guid = manual.Manual_Guid + "-" + r.Next(1, 100000); } System.IO.DirectoryInfo dirInf = new System.IO.DirectoryInfo(System.Configuration.ConfigurationManager.AppSettings["ManualsStorage_Path"] + "\\" + manual.Manual_Guid); dirInf.Create(); manualManager.AddNewManual(manual); return(RedirectPermanent("/WebsiteManagement/manageManuals")); } else { return(RedirectPermanent("/home/")); } }
//Create Materials private void Awake() { DontDestroyOnLoad(this); m_Instance = this; m_Material = Resources.Load <Material>("Plane_No_zTest"); //Black Screen #if UNITY_EDITOR if (m_Material == null) { var resDir = new System.IO.DirectoryInfo(System.IO.Path.Combine(Application.dataPath, "Resources")); if (!resDir.Exists) { resDir.Create(); } Shader s = Shader.Find("Plane/No zTest"); if (s == null) { string shaderText = "Shader \"Plane/No zTest\" { SubShader { Pass { Blend SrcAlpha OneMinusSrcAlpha ZWrite Off Cull Off Fog { Mode Off } BindChannels { Bind \"Color\",color } } } }"; string path = System.IO.Path.Combine(resDir.FullName, "Plane_No_zTest.shader"); Debug.Log("Shader missing, create asset: " + path); System.IO.File.WriteAllText(path, shaderText); UnityEditor.AssetDatabase.Refresh(UnityEditor.ImportAssetOptions.ForceSynchronousImport); UnityEditor.AssetDatabase.LoadAssetAtPath <Shader>("Resources/Plane_No_zTest.shader"); s = Shader.Find("Plane/No zTest"); } var mat = new Material(s); mat.name = "Plane_No_zTest"; UnityEditor.AssetDatabase.CreateAsset(mat, "Assets/Resources/Plane_No_zTest.mat"); m_Material = mat; } #endif }
/// <summary> /// 获得保存的文件夹的物理路径 /// 返回保存的文件夹的物理路径,若为null则表示出错 /// </summary> /// <param name="format">保存的文件夹路径 或者 格式化方式创建保存文件的文件夹,如按日期"yyyy"+"MM"+"dd":20060511</param> /// <returns>保存的文件夹的物理路径,若为null则表示出错</returns> private string getSaveFileFolderPath(string format) { string mySaveFolder = null; try { string folderPath = null; //以当前时间创建文件夹, //!!!!!!!!!!!!以后用正则表达式替换下面的验证语句!!!!!!!!!!!!!!!!!!! if (format.IndexOf("yyyy") > -1 || format.IndexOf("MM") > -1 || format.IndexOf("dd") > -1 || format.IndexOf("hh") > -1 || format.IndexOf("mm") > -1 || format.IndexOf("ss") > -1 || format.IndexOf("ff") > -1) { //以通用标准时间创建文件夹的名字 folderPath = DateTime.UtcNow.ToString(format); mySaveFolder = System.Web.HttpContext.Current.Server.MapPath(".") + @"" + folderPath + @""; } else { mySaveFolder = System.Web.HttpContext.Current.Server.MapPath(".") + "\\" + format; } System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(mySaveFolder); //判断文件夹否存在,不存在则创建 if (!dir.Exists) { dir.Create(); } } catch { message("获取保存路径出错"); } return(mySaveFolder); }
private void Init() { var fi = new System.IO.FileInfo(ProgressFilePath); if (fi.Exists) { lock (ProgressLocker) { using (var fs = new System.IO.StreamReader(ProgressFilePath)) { string l; while ((l = fs.ReadLine()) != null) { l = l.Trim(); if (string.IsNullOrEmpty(l)) { continue; } this.ProgressDone.Add(l); } } } IsResuming = ProgressDone.Count != 0; } if (this.ProgressDone.Count == 0) { var dir = new System.IO.DirectoryInfo("Data/Grass"); if (!dir.Exists) { dir.Create(); } var files = dir.GetFiles(); foreach (var x in files) { if (x.Name.EndsWith(".dgid", StringComparison.OrdinalIgnoreCase) || x.Name.EndsWith(".cgid", StringComparison.OrdinalIgnoreCase)) { x.Delete(); } } } this.FileStream = new System.IO.StreamWriter(ProgressFilePath, true); string tx; if (IsResuming) { tx = "Resuming grass cache generation now.\n\nThis will take a while!\n\nIf the game crashes you can run it again to resume.\n\nWhen all is finished the game will say.\n\nOpen console to see progress."; } else { tx = "Generating new grass cache now.\n\nThis will take a while!\n\nIf the game crashes you can run it again to resume.\n\nWhen all is finished the game will say.\n\nOpen console to see progress."; } GidFileGenerationTask.ShowMessageBox(tx); }
// Move file to destination directory and create the directory when none exists. public static void MoveFileToDirectory(string srcFilePath, string destDir) { var fi = new System.IO.FileInfo(srcFilePath); if (!fi.Exists) { UnityEngine.Debug.LogError(string.Format("WwiseUnity: Failed to move. Source is missing: {0}.", srcFilePath)); return; } var di = new System.IO.DirectoryInfo(destDir); if (!di.Exists) { di.Create(); } var destFilePath = System.IO.Path.Combine(di.FullName, fi.Name); try { fi.MoveTo(destFilePath); } catch (System.Exception ex) { UnityEngine.Debug.LogError(string.Format("WwiseUnity: Error during installation: {0}.", ex.Message)); } }
public SettingManager() { _cookieFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); _imageHashSerializer = new System.Xml.Serialization.XmlSerializer(typeof(HashSet<string>)); //設定ファイル読み込み EmailAddress = GPlusImageDownloader.Properties.Settings.Default.EmailAddress; Password = GPlusImageDownloader.Properties.Settings.Default.Password; ImageSaveDirectory = new System.IO.DirectoryInfo( string.IsNullOrEmpty(GPlusImageDownloader.Properties.Settings.Default.ImageSaveDirectory) ? Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\testFolder" : GPlusImageDownloader.Properties.Settings.Default.ImageSaveDirectory); Cookies = DeserializeCookie(); ImageHashList = DeserializeHashes(); if (!ImageSaveDirectory.Exists) try { ImageSaveDirectory.Create(); ImageSaveDirectory.Refresh(); } catch (System.IO.IOException) { IsErrorNotFoundImageSaveDirectory = !ImageSaveDirectory.Exists; } else IsErrorNotFoundImageSaveDirectory = false; }
public ECompanyInboxAttachment AddCompanyInboxAttachment(DatabaseConnection dbConn, string AttachmentFileName, string AttachmentFullPath) { attachmentFileCount++; string uploadFolder = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_BANKFILE_UPLOAD_FOLDER); string relativePath = System.IO.Path.Combine(System.IO.Path.Combine(this.CompanyDBID.ToString(), "CompanyInbox"), CompanyInboxID + "_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + "-" + attachmentFileCount + ".hrd"); string destinationFile = System.IO.Path.Combine(uploadFolder, relativePath); System.IO.DirectoryInfo CompanyInboxDirectoryInfo = new System.IO.DirectoryInfo(System.IO.Path.GetDirectoryName(destinationFile)); if (!CompanyInboxDirectoryInfo.Exists) { CompanyInboxDirectoryInfo.Create(); } zip.Compress(System.IO.Path.GetDirectoryName(AttachmentFullPath), System.IO.Path.GetFileName(AttachmentFullPath), destinationFile); System.IO.File.Delete(AttachmentFullPath); ECompanyInboxAttachment attachment = new ECompanyInboxAttachment(); attachment.CompanyInboxID = CompanyInboxID; attachment.CompanyInboxAttachmentOriginalFileName = AttachmentFileName; attachment.CompanyInboxAttachmentStoredFileName = relativePath; attachment.CompanyInboxAttachmentIsCompressed = true; attachment.CompanyInboxAttachmentSize = new System.IO.FileInfo(destinationFile).Length; ECompanyInboxAttachment.db.insert(dbConn, attachment); return(attachment); }
public void SaveFile(HttpPostedFile httpPostedFileBase) { string filename = string.Empty; try { /*Geting the file name*/ filename = System.IO.Path.GetFileName(httpPostedFileBase.FileName); string mapPath = Server.MapPath("~/Documents/"); var dirInfo = new System.IO.DirectoryInfo(mapPath); if (!dirInfo.Exists) { dirInfo.Create(); } string filepathtosave = mapPath + filename; httpPostedFileBase.SaveAs(filepathtosave); } catch (Exception ex) { throw ex; } }
public static string CreateTargetLocation(string downloadToPath) { string filePath = downloadToPath; System.IO.DirectoryInfo newFolder = new System.IO.DirectoryInfo(filePath); if (!newFolder.Exists) newFolder.Create(); return filePath; }
static ApiWrapperWithLogger() { exeDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); logDir = new System.IO.DirectoryInfo(exeDir + "\\NetworkLogs"); if (logDir.Exists == false) logDir.Create(); else foreach (var item in logDir.EnumerateFiles()) item.Delete(); }
private string HandlerData(HttpContext context) { StringBuilder sbResult = new StringBuilder(); try { HttpPostedFile file = context.Request.Files.Count > 0 ? context.Request.Files[0] : null; if (file == null) { sbResult.Append("{sucess:false,msg:'上传文件为空!'}"); return sbResult.ToString(); } string fileExtention = CY.Utility.Common.FileUtility.GetFileExtension(file.FileName); string fileName = CY.Utility.Common.FileUtility.GetFileName(file.FileName); if (fileExtention != ".doc" && fileExtention != ".docx" && fileExtention != ".pdf" && fileExtention != ".txt" && fileExtention != ".text" && fileExtention != "html" && fileExtention != ".htm") { sbResult.Append("{result:false,msg:'上传文件格式不正确,只允许上传:doc(x),pdf,t(e)xt,htm(l)等格式的文档!'}"); return sbResult.ToString(); } if (file.ContentLength > 2000000) { sbResult.Append("{result:false,msg:'文件太大,上传文件的大小不能超过2Mb'}"); return sbResult.ToString(); } string appPath = CY.Utility.Common.RequestUtility.CurPhysicalApplicationPath; string dirPath = appPath + "\\Content\\Instrument\\File\\"; System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(dirPath); if (!di.Exists) { di.Create(); } string filesaveName = fileName + DateTime.Now.ToString("yyyyMMddmmhhss") + DateTime.Now.Millisecond.ToString(); file.SaveAs(dirPath + filesaveName + fileExtention); sbResult.Append("{success:true"); sbResult.Append(string.Format(",filePath:'{0}'", "../../../Content/Instrument/File/" + filesaveName + fileExtention)); sbResult.Append(string.Format(",fileName:'{0}'", fileName + fileExtention)); sbResult.Append("}"); } catch (Exception ex) { throw ex; } finally { } return sbResult.ToString(); }
public static void DownloadOnly(string UrlFile, string subFolder, string NamaFile) { // Create a new WebClient instance. using (WebClient myWebClient = new WebClient()) { string AudioFile = Hadith.WPF.Tools.Logs.getPath() + "\\audio\\" + subFolder; System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(AudioFile); if (!dir.Exists) dir.Create(); // Download the Web resource and save it into the current filesystem folder. myWebClient.DownloadFileAsync(new Uri(UrlFile, UriKind.RelativeOrAbsolute), AudioFile + "\\" + NamaFile); } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new Engine()); System.IO.DirectoryInfo di_ImageUpload = new System.IO.DirectoryInfo(Server.MapPath("~/") + "ImageUpload/"); di_ImageUpload.Create(); System.IO.DirectoryInfo di_HeadImg = new System.IO.DirectoryInfo(Server.MapPath("~/") + "HeadImg/"); di_HeadImg.Create(); System.IO.DirectoryInfo di_Attribute = new System.IO.DirectoryInfo(Server.MapPath("~/") + "Attribute/"); di_Attribute.Create(); Config.ArticleDataPath = Server.MapPath("~/") + "Article.db"; Qing.QLog.Init(); Qing.QLog.StartWS(Config.LogPort); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); }
public static void XMLResponse(Process[] toWrite, Type type) { XmlWriterSettings settings = new XmlWriterSettings(); settings.Async = true; settings.CheckCharacters = false; string path = @"D:/Alt/Cat/xml"; System.IO.DirectoryInfo dr= new System.IO.DirectoryInfo(path.Remove(path.LastIndexOf('/'))); if (!dr.Exists) dr.Create(); XmlWriter xml = XmlWriter.Create(path, settings); xml.WriteStartDocument(); foreach (var elem in toWrite) { xml.WriteValue(elem. } xml.WriteEndDocument(); xml.Close(); }
public rasterUtil() { string mainPath = System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\RmrsRasterUtilityHelp"; string globFuncDir = mainPath + "\\func"; string globMosaicDir = mainPath + "\\mosaic"; string globConvDir = mainPath + "\\conv"; System.IO.DirectoryInfo DInfo = new System.IO.DirectoryInfo(globFuncDir); if (!DInfo.Exists) { DInfo.Create(); } if (!System.IO.Directory.Exists(globMosaicDir)) System.IO.Directory.CreateDirectory(globMosaicDir); if (!System.IO.Directory.Exists(globConvDir)) System.IO.Directory.CreateDirectory(globConvDir); mosaicDir = globMosaicDir + "\\" + newGuid; funcDir = globFuncDir + "\\" + newGuid; convDir = globConvDir + "\\" + newGuid; fp = newGuid.Substring(1, 3); System.IO.Directory.CreateDirectory(funcDir); System.IO.Directory.CreateDirectory(convDir); System.IO.Directory.CreateDirectory(mosaicDir); }
public static void Run(ControllerConfiguration context, Guid versionKey) { var versionsController = new Versions(context); System.IO.DirectoryInfo pushFolder = new System.IO.DirectoryInfo(Program.STR_PUSH_FOLDER); System.IO.DirectoryInfo pullFolder = new System.IO.DirectoryInfo(Program.STR_PULL_FOLDER); versionsController.PushVersion(pushFolder, versionKey); if (!pullFolder.Exists) { pullFolder.Create(); pullFolder.Refresh(); } versionsController.PullVersion(versionKey, pullFolder); pullFolder.Refresh(); var pulledFiles = pullFolder.GetFiles("*", System.IO.SearchOption.AllDirectories); Debug.Assert(pulledFiles.Length == 2); Debug.Assert(pulledFiles.Any(f => f.FullName == String.Format(@"{0}\Subfolder\AnImage.bmp", Program.STR_PULL_FOLDER))); Debug.Assert(pulledFiles.Any(f => f.FullName == String.Format(@"{0}\README.txt", Program.STR_PULL_FOLDER))); }
public void Put(System.IO.Stream stream, string fileName) { var prefix = fileName.Substring(0, 2); var folder = new System.IO.DirectoryInfo(System.IO.Path.Combine(this.RootPath, prefix)); if (!folder.Exists) folder.Create(); var buffer = new byte[4096]; int count = 0; using (var outFile = System.IO.File.Open(System.IO.Path.Combine(this.RootPath, prefix, fileName), System.IO.FileMode.CreateNew)) { while (true) { count = stream.Read(buffer, 0, buffer.Length); if (count <= 0) break; outFile.Write(buffer, 0, count); } } }
public void ProcessRequest(System.Web.HttpContext context) { if (!string.IsNullOrEmpty(context.Request.Headers["X-File-Name"])) { string path = context.Server.MapPath("~/Uploads"); string file = System.IO.Path.Combine(path, context.Request.Headers["X-File-Name"]); // throw new Exception(System.Environment.UserName); int cnt = context.Request.Files.Count; System.Console.WriteLine (cnt); System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(path); if (!di.Exists) di.Create(); using (System.IO.FileStream fileStream = new System.IO.FileStream(file, System.IO.FileMode.OpenOrCreate)) { // context.Request.InputStream.CopyTo(fileStream); CopyStream(context.Request.InputStream, fileStream); fileStream.Close(); } // End Using fileStream } // End if (!string.IsNullOrEmpty(context.Request.Headers["X-File-Name"])) }
public static string DownloadAndPlay(string UrlFile, string subFolder, string NamaFile) { string TargetFileName = string.Empty; try { // Create a new WebClient instance. using (WebClient myWebClient = new WebClient()) { string AudioFile = Hadith.WPF.Tools.Logs.getPath() + "\\audio\\" + subFolder; System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(AudioFile); if (!dir.Exists) dir.Create(); // Download the Web resource and save it into the current filesystem folder. TargetFileName = AudioFile + "\\" + NamaFile; if (System.IO.File.Exists(TargetFileName)) return TargetFileName; myWebClient.DownloadFile(new Uri(UrlFile, UriKind.RelativeOrAbsolute), TargetFileName); } return TargetFileName; } catch { return null; } }
private void SaveAnnex(int type, Guid id) { CY.CSTS.Core.Business.VirtualLabDataSon vs; if (type == 1)//Load { vs = CY.CSTS.Core.Business.VirtualLabDataSon.Load(id); } else if (type == 2)//Add { vs = new CY.CSTS.Core.Business.VirtualLabDataSon(); } try { HttpFileCollection files = HttpContext.Current.Request.Files; if (files.Count > 0 && files[0].ContentLength > 0) { for (int i = 0; i < files.Count; i++) { HttpPostedFile postedFile = files[i]; if (postedFile.ContentLength > 20971520) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('上传附件不能超过20M,附件:" + postedFile.FileName + "上传失败');</script>"); return; } else { string fileSHowName = postedFile.FileName; int dotIndex = postedFile.FileName.IndexOf("\\"); string fileName = string.Empty; if (dotIndex == -1) { fileName = CY.Utility.Common.FileUtility.GetFileName(postedFile.FileName);//文件名 } else { string fileNameTemp = CY.Utility.Common.FileUtility.GetFileName(postedFile.FileName); int indElx = fileNameTemp.LastIndexOf("\\") + 1; fileName = fileNameTemp.Substring(indElx); } string fileExtension = CY.Utility.Common.FileUtility.GetFileExtension(postedFile.FileName);//后缀名 string appPath = CY.Utility.Common.RequestUtility.CurPhysicalApplicationPath;//绝对路径 string dirPath = string.Empty; string httpPath = string.Empty; dirPath = appPath + CY.Utility.Common.AnnexUtility.VirtualLabFileDir; httpPath = "/Content/VirtualLab/File/"; System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(dirPath); if (!di.Exists) { di.Create(); } string FileName = fileName + DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond.ToString(); postedFile.SaveAs(dirPath + "\\" + FileName + fileExtension); CY.CSTS.Core.Business.VirtualLabDataAnnex annex = new CY.CSTS.Core.Business.VirtualLabDataAnnex(); annex.ContentID = id; annex.Name = fileName; annex.Url = httpPath + FileName + fileExtension; annex.Save(); } } } } catch (Exception ex) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert(" + ex.Message + ");</script>"); } }
/// <summary> /// Dumps the body of this entity into a file /// </summary> /// <param name="path">path of the destination folder</param> /// <param name="name">name of the file</param> /// <returns><see cref="System.IO.FileInfo" /> that represents the file where the body has been saved</returns> public System.IO.FileInfo DumpBody( System.String path, System.String name ) { System.IO.FileInfo file = null; if ( name!=null ) { #if LOG if ( log.IsDebugEnabled ) log.Debug ("Found attachment: " + name); #endif name = System.IO.Path.GetFileName(name); // Dump file contents try { System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo ( path ); dir.Create(); try { file = new System.IO.FileInfo (System.IO.Path.Combine (path, name) ); } catch ( System.ArgumentException ) { file = null; #if LOG if ( log.IsErrorEnabled ) log.Error(System.String.Concat("Filename [", System.IO.Path.Combine (path, name), "] is not allowed by the filesystem")); #endif } if ( file!=null && dir.Exists ) { if ( dir.FullName.Equals (new System.IO.DirectoryInfo (file.Directory.FullName).FullName) ) { if ( !file.Exists ) { #if LOG if ( log.IsDebugEnabled ) log.Debug (System.String.Concat("Saving attachment [", file.FullName, "] ...")); #endif System.IO.Stream stream = null; try { stream = file.Create(); #if LOG } catch ( System.Exception e ) { if ( log.IsErrorEnabled ) log.Error(System.String.Concat("Error creating file [", file.FullName, "]"), e); #else } catch ( System.Exception ) { #endif } bool error = !this.DumpBody (stream); if ( stream!=null ) stream.Close(); stream = null; if ( error ) { #if LOG if ( log.IsErrorEnabled ) log.Error (System.String.Concat("Error writting file [", file.FullName, "] to disk")); #endif if ( stream!=null ) file.Delete(); } else { #if LOG if ( log.IsDebugEnabled ) log.Debug (System.String.Concat("Attachment saved [", file.FullName, "]")); #endif // The file should be there file.Refresh(); // Set file dates if ( this.Header.ContentDispositionParameters.ContainsKey("creation-date") ) file.CreationTime = anmar.SharpMimeTools.SharpMimeTools.parseDate ( this.Header.ContentDispositionParameters["creation-date"] ); if ( this.Header.ContentDispositionParameters.ContainsKey("modification-date") ) file.LastWriteTime = anmar.SharpMimeTools.SharpMimeTools.parseDate ( this.Header.ContentDispositionParameters["modification-date"] ); if ( this.Header.ContentDispositionParameters.ContainsKey("read-date") ) file.LastAccessTime = anmar.SharpMimeTools.SharpMimeTools.parseDate ( this.Header.ContentDispositionParameters["read-date"] ); } #if LOG } else if ( log.IsDebugEnabled ) { log.Debug("File already exists, skipping."); #endif } #if LOG } else if ( log.IsDebugEnabled ) { log.Debug(System.String.Concat ("Folder name mistmatch. [", dir.FullName, "]<>[", new System.IO.DirectoryInfo (file.Directory.FullName).FullName, "]")); #endif } #if LOG } else if ( file!=null && log.IsErrorEnabled ) { log.Error ("Destination folder does not exists."); #endif } dir = null; #if LOG } catch ( System.Exception e ) { if ( log.IsErrorEnabled ) log.Error ("Error writting to disk: " + name, e); #else } catch ( System.Exception ) { #endif try { if ( file!=null ) { file.Refresh(); if ( file.Exists ) file.Delete (); } } catch ( System.Exception ) {} file = null; } } return file; }
/* Remote Local Backlog X X (foi apagado enquanto offline, envia o remoto para a lixeira) X X (foi apagado remotamente, envia o local para a lixeira e apaga) X X X (verifica sincronia, se dessincronizado, ver qual o mais atual e atualizar) X (foi apagado local e remotamente, enquanto estava offline, nao faz nada) X (foi criado enquanto offline, faz o download) X (foi criado enquanto offline, faz o upload) X X (backlog desatualizado, remoto ganha) */ public override bool Synchronize() { Synchronized = false; try { SQ.Util.Logger.LogInfo("Synchronizer", "Sync starting from backlog"); List<string[]> filesInBackLog = Read (); if (filesInBackLog != null) { List<File> filesInLocalRepo = LocalRepo.Files; List<RemoteFile> filesInRemoteRepo = RemoteRepo.Files; TimeSpan diffClocks = RemoteRepo.DiffClocks; List<File> alreadyAnalyzed = new List<File>(); foreach (RemoteFile remoteFile in filesInRemoteRepo) { if(remoteFile.IsIgnoreFile) continue; bool backlogFile = false; string date = ""; if(filesInBackLog != null) { if(filesInBackLog.Count > 0) { if (filesInBackLog.Where (fibl => LocalRepo.ResolveDecodingProblem(string.Format("{0}{1}",fibl [4], fibl [3])) == LocalRepo.ResolveDecodingProblem(remoteFile.AbsolutePath)).Any()){ date = filesInBackLog.Where (fibl => LocalRepo.ResolveDecodingProblem(string.Format("{0}{1}",fibl [4], fibl [3])) == LocalRepo.ResolveDecodingProblem(remoteFile.AbsolutePath)).First() [2]; backlogFile = true; } } } LocalFile localFile = null; if (remoteFile.IsAFolder){ System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(remoteFile.FullLocalName); if(!dir.Exists){ ChangesMade.Add (remoteFile); dir.Create(); } continue; } if (filesInLocalRepo.Where (filr => LocalRepo.ResolveDecodingProblem(filr.AbsolutePath) == LocalRepo.ResolveDecodingProblem(remoteFile.AbsolutePath)).Any ()) { File temp = filesInLocalRepo.Where (filr => LocalRepo.ResolveDecodingProblem(filr.AbsolutePath) == LocalRepo.ResolveDecodingProblem(remoteFile.AbsolutePath)).First (); localFile = new LocalFile(LocalRepo.ResolveDecodingProblem(temp.AbsolutePath), temp.TimeOfLastChange); } if (localFile == null && backlogFile) { if(RemoteRepo.SendToTrash (remoteFile)) { ChangesMade.Add (remoteFile); RemoteRepo.Delete (remoteFile); } } else if (localFile != null && backlogFile) { if (!FilesIsSync (localFile, remoteFile)) { DateTime localLastTime = Convert.ToDateTime (date); if (localFile.TimeOfLastChange > localLastTime) localLastTime = localFile.TimeOfLastChange; DateTime referencialClock = localLastTime.Subtract (diffClocks); if (referencialClock.Subtract (Convert.ToDateTime (remoteFile.AsS3Object.LastModified)).TotalSeconds > 0) { Console.WriteLine ("2"); if(RemoteRepo.SendToTrash (remoteFile)) RemoteRepo.Upload (localFile); } else { Console.WriteLine ("3"); if(RemoteRepo.SendToTrash (localFile)) { ChangesMade.Add (remoteFile); RemoteRepo.Download (remoteFile); LocalRepo.Files.Add (new LocalFile(remoteFile.AbsolutePath)); } } } alreadyAnalyzed.Add(localFile); } else if (!backlogFile) { Console.WriteLine ("4"); ChangesMade.Add (remoteFile); RemoteRepo.Download (remoteFile); LocalRepo.Files.Add (new LocalFile(remoteFile.AbsolutePath)); if(localFile != null) alreadyAnalyzed.Add (localFile); } } foreach(File localFile in filesInLocalRepo){ string localAbsolutePath = LocalRepo.ResolveDecodingProblem (localFile.AbsolutePath); if (alreadyAnalyzed.Where (lf => LocalRepo.ResolveDecodingProblem (lf.AbsolutePath) == localAbsolutePath).Any()) continue; if (localFile.IsAFolder) { continue; } bool backlogFile = false; if(filesInBackLog!=null) if(filesInBackLog.Count>0) backlogFile = filesInBackLog.Where (fibl => LocalRepo.ResolveDecodingProblem (string.Format("{0}{1}",fibl [4] , fibl [3])) == localAbsolutePath).Any (); if(backlogFile) { Console.WriteLine ("5"); LocalFile lf = new LocalFile(localAbsolutePath); if (RemoteRepo.SendToTrash (lf)) { ChangesMade.Add (lf); System.IO.File.Delete(localFile.FullLocalName); } } else{ Console.WriteLine ("6"); RemoteRepo.Upload (localFile); } alreadyAnalyzed.Add (localFile); } } Write(); Repo.LastSyncTime = DateTime.Now; SQ.Util.Logger.LogInfo("Synchronizer", "Backlog Sync is finished"); Synchronized = true; return true; } catch (Exception e){ SQ.Util.Logger.LogInfo("Backlog", e); return false; } }
static void HandleConnection(System.IO.DirectoryInfo info, TcpClient client) { Area ws = null; ClientStateInfo clientInfo = new ClientStateInfo(); using (client) using (SharedNetwork.SharedNetworkInfo sharedInfo = new SharedNetwork.SharedNetworkInfo()) { try { var stream = client.GetStream(); Handshake hs = ProtoBuf.Serializer.DeserializeWithLengthPrefix<Handshake>(stream, ProtoBuf.PrefixStyle.Fixed32); DomainInfo domainInfo = null; lock (SyncObject) { if (hs.RequestedModule == null) hs.RequestedModule = string.Empty; if (!Domains.TryGetValue(hs.RequestedModule, out domainInfo)) { domainInfo = Domains.Where(x => x.Key.Equals(hs.RequestedModule, StringComparison.OrdinalIgnoreCase)).Select(x => x.Value).FirstOrDefault(); } if (domainInfo == null) { if (!Config.AllowVaultCreation || !Config.RequiresAuthentication || string.IsNullOrEmpty(hs.RequestedModule) || System.IO.Directory.Exists(System.IO.Path.Combine(info.FullName, hs.RequestedModule))) { Network.StartTransaction startSequence = Network.StartTransaction.CreateRejection(); Printer.PrintDiagnostics("Rejecting client due to invalid domain: \"{0}\".", hs.RequestedModule); ProtoBuf.Serializer.SerializeWithLengthPrefix<Network.StartTransaction>(stream, startSequence, ProtoBuf.PrefixStyle.Fixed32); return; } domainInfo = new DomainInfo() { Bare = true, Directory = null }; } } try { ws = Area.Load(domainInfo.Directory, true, true); if (domainInfo.Bare) throw new Exception("Domain is bare, but workspace could be loaded!"); } catch { if (!domainInfo.Bare) throw new Exception("Domain not bare, but couldn't load workspace!"); } Printer.PrintDiagnostics("Received handshake - protocol: {0}", hs.VersionrProtocol); SharedNetwork.Protocol? clientProtocol = hs.CheckProtocol(); bool valid = true; if (clientProtocol == null) valid = false; else { valid = SharedNetwork.AllowedProtocols.Contains(clientProtocol.Value); if (Config.RequiresAuthentication && !SharedNetwork.SupportsAuthentication(clientProtocol.Value)) valid = false; } if (valid) { sharedInfo.CommunicationProtocol = clientProtocol.Value; Network.StartTransaction startSequence = null; clientInfo.Access = Rights.Read | Rights.Write; clientInfo.BareAccessRequired = domainInfo.Bare; if (PrivateKey != null) { startSequence = Network.StartTransaction.Create(domainInfo.Bare ? string.Empty : ws.Domain.ToString(), PublicKey, clientProtocol.Value); Printer.PrintDiagnostics("Sending RSA key..."); ProtoBuf.Serializer.SerializeWithLengthPrefix<Network.StartTransaction>(stream, startSequence, ProtoBuf.PrefixStyle.Fixed32); if (!HandleAuthentication(clientInfo, client, sharedInfo)) throw new Exception("Authentication failed."); StartClientTransaction clientKey = ProtoBuf.Serializer.DeserializeWithLengthPrefix<StartClientTransaction>(stream, ProtoBuf.PrefixStyle.Fixed32); System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter exch = new System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter(PrivateKey); byte[] aesKey = exch.DecryptKeyExchange(clientKey.Key); byte[] aesIV = exch.DecryptKeyExchange(clientKey.IV); Printer.PrintDiagnostics("Got client key: {0}", System.Convert.ToBase64String(aesKey)); var aesCSP = System.Security.Cryptography.AesManaged.Create(); sharedInfo.DecryptorFunction = () => { return aesCSP.CreateDecryptor(aesKey, aesIV); }; sharedInfo.EncryptorFunction = () => { return aesCSP.CreateEncryptor(aesKey, aesIV); }; } else { startSequence = Network.StartTransaction.Create(domainInfo.Bare ? string.Empty : ws.Domain.ToString(), clientProtocol.Value); ProtoBuf.Serializer.SerializeWithLengthPrefix<Network.StartTransaction>(stream, startSequence, ProtoBuf.PrefixStyle.Fixed32); if (!HandleAuthentication(clientInfo, client, sharedInfo)) throw new Exception("Authentication failed."); StartClientTransaction clientKey = ProtoBuf.Serializer.DeserializeWithLengthPrefix<StartClientTransaction>(stream, ProtoBuf.PrefixStyle.Fixed32); } sharedInfo.Stream = stream; sharedInfo.Workspace = ws; sharedInfo.ChecksumType = Config.ChecksumType; clientInfo.SharedInfo = sharedInfo; while (true) { NetCommand command = ProtoBuf.Serializer.DeserializeWithLengthPrefix<NetCommand>(stream, ProtoBuf.PrefixStyle.Fixed32); if (command.Type == NetCommandType.Close) { Printer.PrintDiagnostics("Client closing connection."); break; } else if (command.Type == NetCommandType.PushInitialVersion) { bool fresh = false; if (domainInfo.Directory == null) { if (!clientInfo.Access.HasFlag(Rights.Create)) throw new Exception("Access denied."); fresh = true; System.IO.DirectoryInfo newDirectory = new System.IO.DirectoryInfo(System.IO.Path.Combine(info.FullName, hs.RequestedModule)); newDirectory.Create(); domainInfo.Directory = newDirectory; if (!newDirectory.Exists) throw new Exception("Access denied."); } if (!clientInfo.Access.HasFlag(Rights.Write)) throw new Exception("Access denied."); lock (SyncObject) { ws = Area.InitRemote(domainInfo.Directory, Utilities.ReceiveEncrypted<ClonePayload>(clientInfo.SharedInfo)); clientInfo.SharedInfo.Workspace = ws; domainInfo.Bare = false; if (fresh) Domains[hs.RequestedModule] = domainInfo; } } else if (command.Type == NetCommandType.PushBranchJournal) { if (!clientInfo.Access.HasFlag(Rights.Write)) throw new Exception("Access denied."); SharedNetwork.ReceiveBranchJournal(sharedInfo); } else if (command.Type == NetCommandType.QueryBranchID) { if (!clientInfo.Access.HasFlag(Rights.Read)) throw new Exception("Access denied."); Printer.PrintDiagnostics("Client is requesting a branch info for {0}", string.IsNullOrEmpty(command.AdditionalPayload) ? "<root>" : "\"" + command.AdditionalPayload + "\""); bool multiple = false; Objects.Branch branch = string.IsNullOrEmpty(command.AdditionalPayload) ? ws.RootBranch : ws.GetBranchByPartialName(command.AdditionalPayload, out multiple); if (branch != null) { ProtoBuf.Serializer.SerializeWithLengthPrefix<NetCommand>(stream, new NetCommand() { Type = NetCommandType.Acknowledge, AdditionalPayload = branch.ID.ToString() }, ProtoBuf.PrefixStyle.Fixed32); } else if (!multiple) { ProtoBuf.Serializer.SerializeWithLengthPrefix<NetCommand>(stream, new NetCommand() { Type = NetCommandType.Error, AdditionalPayload = "branch not recognized" }, ProtoBuf.PrefixStyle.Fixed32); } else { ProtoBuf.Serializer.SerializeWithLengthPrefix<NetCommand>(stream, new NetCommand() { Type = NetCommandType.Error, AdditionalPayload = "multiple branches with that name!" }, ProtoBuf.PrefixStyle.Fixed32); } } else if (command.Type == NetCommandType.ListBranches) { if (!clientInfo.Access.HasFlag(Rights.Read)) throw new Exception("Access denied."); Printer.PrintDiagnostics("Client is requesting a branch list."); ProtoBuf.Serializer.SerializeWithLengthPrefix<NetCommand>(stream, new NetCommand() { Type = NetCommandType.Acknowledge }, ProtoBuf.PrefixStyle.Fixed32); if (command.Identifier == 1) // send extra data { BranchList bl = new BranchList(); bl.Branches = clientInfo.SharedInfo.Workspace.Branches.ToArray(); Dictionary<Guid, Objects.Version> importantVersions = new Dictionary<Guid, Objects.Version>(); List<KeyValuePair<Guid, Guid>> allHeads = new List<KeyValuePair<Guid, Guid>>(); foreach (var x in bl.Branches) { if (x.Terminus.HasValue && !importantVersions.ContainsKey(x.Terminus.Value)) { importantVersions[x.Terminus.Value] = clientInfo.SharedInfo.Workspace.GetVersion(x.Terminus.Value); continue; } var heads = clientInfo.SharedInfo.Workspace.GetBranchHeads(x); foreach (var head in heads) { if (!importantVersions.ContainsKey(head.Version)) importantVersions[head.Version] = clientInfo.SharedInfo.Workspace.GetVersion(head.Version); } allHeads.AddRange(heads.Select(y => new KeyValuePair<Guid, Guid>(y.Branch, y.Version))); } bl.Heads = allHeads.ToArray(); bl.ImportantVersions = importantVersions.Values.ToArray(); Utilities.SendEncrypted<BranchList>(clientInfo.SharedInfo, bl); } else { BranchList bl = new BranchList(); bl.Branches = clientInfo.SharedInfo.Workspace.Branches.ToArray(); List<KeyValuePair<Guid, Guid>> allHeads = new List<KeyValuePair<Guid, Guid>>(); foreach (var x in bl.Branches) { if (x.Terminus.HasValue) continue; var heads = clientInfo.SharedInfo.Workspace.GetBranchHeads(x); if (heads.Count == 1) allHeads.Add(new KeyValuePair<Guid, Guid>(x.ID, heads[0].Version)); } bl.Heads = allHeads.ToArray(); Utilities.SendEncrypted<BranchList>(clientInfo.SharedInfo, bl); } } else if (command.Type == NetCommandType.RequestRecordUnmapped) { if (!clientInfo.Access.HasFlag(Rights.Read)) throw new Exception("Access denied."); Printer.PrintDiagnostics("Client is requesting specific record data blobs."); SharedNetwork.SendRecordDataUnmapped(sharedInfo); } else if (command.Type == NetCommandType.Clone) { if (!clientInfo.Access.HasFlag(Rights.Read)) throw new Exception("Access denied."); Printer.PrintDiagnostics("Client is requesting to clone the vault."); Objects.Version initialRevision = ws.GetVersion(ws.Domain); Objects.Branch initialBranch = ws.GetBranch(initialRevision.Branch); Utilities.SendEncrypted<ClonePayload>(sharedInfo, new ClonePayload() { InitialBranch = initialBranch, RootVersion = initialRevision }); } else if (command.Type == NetCommandType.PullVersions) { if (!clientInfo.Access.HasFlag(Rights.Read)) throw new Exception("Access denied."); Printer.PrintDiagnostics("Client asking for remote version information."); Branch branch = ws.GetBranch(new Guid(command.AdditionalPayload)); if (branch == null) ProtoBuf.Serializer.SerializeWithLengthPrefix<NetCommand>(stream, new NetCommand() { Type = NetCommandType.Error, AdditionalPayload = string.Format("Unknown branch {0}", command.AdditionalPayload) }, ProtoBuf.PrefixStyle.Fixed32); else ProtoBuf.Serializer.SerializeWithLengthPrefix<NetCommand>(stream, new NetCommand() { Type = NetCommandType.Acknowledge }, ProtoBuf.PrefixStyle.Fixed32); Stack<Objects.Branch> branchesToSend = new Stack<Branch>(); Stack<Objects.Version> versionsToSend = new Stack<Objects.Version>(); if (!SharedNetwork.SendBranchJournal(sharedInfo)) throw new Exception(); if (!SharedNetwork.GetVersionList(sharedInfo, sharedInfo.Workspace.GetBranchHeadVersion(branch), out branchesToSend, out versionsToSend)) throw new Exception(); if (!SharedNetwork.SendBranches(sharedInfo, branchesToSend)) throw new Exception(); if (!SharedNetwork.SendVersions(sharedInfo, versionsToSend)) throw new Exception(); } else if (command.Type == NetCommandType.PushObjectQuery) { if (!clientInfo.Access.HasFlag(Rights.Write)) throw new Exception("Access denied."); Printer.PrintDiagnostics("Client asking about objects on the server..."); SharedNetwork.ProcesPushObjectQuery(sharedInfo); } else if (command.Type == NetCommandType.PushBranch) { if (!clientInfo.Access.HasFlag(Rights.Write)) throw new Exception("Access denied."); Printer.PrintDiagnostics("Client attempting to send branch data..."); SharedNetwork.ReceiveBranches(sharedInfo); } else if (command.Type == NetCommandType.PushVersions) { if (!clientInfo.Access.HasFlag(Rights.Write)) throw new Exception("Access denied."); Printer.PrintDiagnostics("Client attempting to send version data..."); SharedNetwork.ReceiveVersions(sharedInfo); } else if (command.Type == NetCommandType.PushHead) { if (!clientInfo.Access.HasFlag(Rights.Write)) throw new Exception("Access denied."); Printer.PrintDiagnostics("Determining head information."); string errorData; lock (ws) { clientInfo.SharedInfo.Workspace.RunLocked(() => { try { clientInfo.SharedInfo.Workspace.BeginDatabaseTransaction(); if (!SharedNetwork.ImportBranchJournal(clientInfo.SharedInfo, false)) { clientInfo.SharedInfo.Workspace.RollbackDatabaseTransaction(); return false; } if (AcceptHeads(clientInfo, ws, out errorData)) { ImportVersions(ws, clientInfo); clientInfo.SharedInfo.Workspace.CommitDatabaseTransaction(); ProtoBuf.Serializer.SerializeWithLengthPrefix<NetCommand>(stream, new NetCommand() { Type = NetCommandType.AcceptPush }, ProtoBuf.PrefixStyle.Fixed32); return true; } else ProtoBuf.Serializer.SerializeWithLengthPrefix<NetCommand>(stream, new NetCommand() { Type = NetCommandType.RejectPush, AdditionalPayload = errorData }, ProtoBuf.PrefixStyle.Fixed32); clientInfo.SharedInfo.Workspace.RollbackDatabaseTransaction(); return false; } catch { clientInfo.SharedInfo.Workspace.RollbackDatabaseTransaction(); return false; } }, false); } } else if (command.Type == NetCommandType.SynchronizeRecords) { if (!clientInfo.Access.HasFlag(Rights.Read)) throw new Exception("Access denied."); Printer.PrintDiagnostics("Received {0} versions in version pack, but need {1} records to commit data.", sharedInfo.PushedVersions.Count, sharedInfo.UnknownRecords.Count); Printer.PrintDiagnostics("Beginning record synchronization..."); if (sharedInfo.UnknownRecords.Count > 0) { Printer.PrintDiagnostics("Requesting record metadata..."); SharedNetwork.RequestRecordMetadata(clientInfo.SharedInfo); Printer.PrintDiagnostics("Requesting record data..."); SharedNetwork.RequestRecordData(sharedInfo); if (!sharedInfo.Workspace.RunLocked(() => { return SharedNetwork.ImportRecords(sharedInfo); }, false)) { throw new Exception("Unable to import records!"); } } ProtoBuf.Serializer.SerializeWithLengthPrefix<NetCommand>(stream, new NetCommand() { Type = NetCommandType.Synchronized }, ProtoBuf.PrefixStyle.Fixed32); } else if (command.Type == NetCommandType.FullClone) { if (!clientInfo.Access.HasFlag(Rights.Read)) throw new Exception("Access denied."); ProtoBuf.Serializer.SerializeWithLengthPrefix<NetCommand>(stream, new NetCommand() { Type = NetCommandType.Acknowledge, Identifier = (int)ws.DatabaseVersion }, ProtoBuf.PrefixStyle.Fixed32); command = ProtoBuf.Serializer.DeserializeWithLengthPrefix<NetCommand>(stream, ProtoBuf.PrefixStyle.Fixed32); if (command.Type == NetCommandType.Acknowledge) { bool accept = false; BackupInfo backupInfo = null; lock (domainInfo) { string backupKey = ws.LastVersion + "-" + ws.LastBranch + "-" + ws.BranchJournalTipID.ToString(); backupInfo = domainInfo.Backup; if (backupKey != backupInfo.Key) { Printer.PrintMessage("Backup key out of date for domain DB[{0}] - {1}", domainInfo.Directory, backupKey); if (System.Threading.Interlocked.Decrement(ref backupInfo.Refs) == 0) backupInfo.Backup.Delete(); backupInfo = new BackupInfo(); domainInfo.Backup = backupInfo; var directory = new System.IO.DirectoryInfo(System.IO.Path.Combine(ws.AdministrationFolder.FullName, "backups")); directory.Create(); backupInfo.Backup = new System.IO.FileInfo(System.IO.Path.Combine(directory.FullName, System.IO.Path.GetRandomFileName())); if (ws.BackupDB(backupInfo.Backup)) { System.Threading.Interlocked.Increment(ref backupInfo.Refs); accept = true; backupInfo.Key = backupKey; } } else { accept = true; } if (accept) System.Threading.Interlocked.Increment(ref backupInfo.Refs); } if (accept) { Printer.PrintDiagnostics("Backup complete. Sending data."); byte[] blob = new byte[256 * 1024]; long filesize = backupInfo.Backup.Length; long position = 0; using (System.IO.FileStream reader = backupInfo.Backup.OpenRead()) { while (true) { long remainder = filesize - position; int count = blob.Length; if (count > remainder) count = (int)remainder; reader.Read(blob, 0, count); position += count; Printer.PrintDiagnostics("Sent {0}/{1} bytes.", position, filesize); if (count == remainder) { Utilities.SendEncrypted(sharedInfo, new DataPayload() { Data = blob.Take(count).ToArray(), EndOfStream = true }); break; } else { Utilities.SendEncrypted(sharedInfo, new DataPayload() { Data = blob, EndOfStream = false }); } } } ProtoBuf.Serializer.SerializeWithLengthPrefix<NetCommand>(stream, new NetCommand() { Type = NetCommandType.Acknowledge }, ProtoBuf.PrefixStyle.Fixed32); lock (domainInfo) { if (System.Threading.Interlocked.Decrement(ref backupInfo.Refs) == 0) backupInfo.Backup.Delete(); } } else { Utilities.SendEncrypted<DataPayload>(sharedInfo, new DataPayload() { Data = new byte[0], EndOfStream = true }); ProtoBuf.Serializer.SerializeWithLengthPrefix<NetCommand>(stream, new NetCommand() { Type = NetCommandType.Error }, ProtoBuf.PrefixStyle.Fixed32); } } } else { Printer.PrintDiagnostics("Client sent invalid command: {0}", command.Type); throw new Exception(); } } } else { Network.StartTransaction startSequence = Network.StartTransaction.CreateRejection(); Printer.PrintDiagnostics("Rejecting client due to protocol mismatch."); ProtoBuf.Serializer.SerializeWithLengthPrefix<Network.StartTransaction>(stream, startSequence, ProtoBuf.PrefixStyle.Fixed32); return; } } catch (Exception e) { Printer.PrintDiagnostics("Client was a terrible person, because: {0}", e); } finally { if (ws != null) ws.Dispose(); } } Printer.PrintDiagnostics("Ended client processor task!"); }
/// <summary> /// 获得组织机构版本信息 /// </summary> /// <param name="org"></param> private void onOrgVersion(OrgVersion org) { try { #region 判断登录的用户本地数据库文件夹是否存在 System.IO.DirectoryInfo dInfo = new System.IO.DirectoryInfo(MyAuth.UserID); if (!dInfo.Exists) dInfo.Create(); string FileNamePath =Application.StartupPath +"\\"+ MyAuth.UserID + "\\Record.mdb"; if (!System.IO.File.Exists(FileNamePath)) System.IO.File.Copy(Application.StartupPath + "\\Record.db", FileNamePath); ////初始化本地数据库连接字符串 IMLibrary3.Data.SQLiteDBHelper.connectionString = "data source=" + FileNamePath; #endregion OrgVersion localOrg = OpeRecordDB.GetOrgVersion(MyAuth.UserID); #region 如果版本已经改变下载组织机构组信息 if (org.GroupsVersion != localOrg.GroupsVersion)//true { Groups.Clear(); treeView_Organization.Nodes.Clear(); OpeRecordDB.DeleteAllGroup();//删除本地数据库中分组信息 frmOrg = new FormDownOrganization(); frmOrg.Shown += delegate(object sender, EventArgs e) { DownloadGroups dGroups = new DownloadGroups(); dGroups.from = MyAuth.UserID; dGroups.type = type.get; SendMessageToServer(dGroups);//请求下载分组信息 }; frmOrg.MaxValue = org.GroupsCount; frmOrg.ShowText = "正在下载分组信息..."; frmOrg.ShowDialog(); OpeRecordDB.AddGroups(this.Groups);//将下载的分组信息保存于数据库中 } #endregion #region 下载组织机构用户信息 if (org.UsersVersion != localOrg.UsersVersion)//(true) { Users.Clear(); treeView_Organization.Nodes.Clear(); OpeRecordDB.DeleteAllUser();//删除本地数据库中用户信息 frmOrg = new FormDownOrganization(); frmOrg.Shown += delegate(object sender, EventArgs e) { DownloadUsers dUsers = new DownloadUsers(); dUsers.from = MyAuth.UserID; dUsers.type = type.get; SendMessageToServer(dUsers);//请求下载联系人信息 }; frmOrg.MaxValue = org.UsersCount; frmOrg.ShowText = "正在下载用户信息..."; frmOrg.ShowDialog(); OpeRecordDB.AddUsers(this.Users); } #endregion #region 下载群信息 if (org.RoomsCount !=0)//如果群数大于0 { Rooms.Clear(); treeView_Rooms.Nodes.Clear(); //OpeRecordDB.DeleteAllRoom();//删除本地数据库中群信息 frmOrg = new FormDownOrganization(); frmOrg.Shown += delegate(object sender, EventArgs e) { DownloadRooms dRooms = new DownloadRooms(); dRooms.from = MyAuth.UserID; dRooms.type = type.get; SendMessageToServer(dRooms);//请求下载群信息 }; frmOrg.MaxValue = org.RoomsCount; frmOrg.ShowText = "正在下载群资料..."; frmOrg.ShowDialog(); //OpeRecordDB.AddRooms(this.Rooms); } #endregion //如果组织机构已经更改或组织机构未加载到树图 if (this.treeView_Organization.Nodes.Count == 0) { //则更新到本地数据库 OpeRecordDB.UpdateOrgVersion(org); this.Groups = OpeRecordDB.GetGroups(); this.Users = OpeRecordDB.GetUsers(); treeViewAddOrg();//加载树 } if (this.treeView_Rooms.Nodes.Count == 0) { //this.Rooms = OpeRecordDB.GetRooms(); foreach (Room room in this.Rooms) { foreach (string userID in room.UserIDs.Split(';')) { User user = findUser(userID); if (user != null) room.Users.Add(user.UserID, user); } } treeViewAddRooms(this.Rooms); } //请求联系人在线状态信息 Presence pre = new Presence(); pre.from = MyAuth.UserID; pre.type = type.get;//必须设置 set,以表示是设置,如果为get,则是获取所有联系人的状态 SendMessageToServer(pre); } catch (Exception ex) { IMLibrary3.Global.MsgShow(ex.Source + ex.Message); } }
/// <summary> /// 处理接收图片文件 /// </summary> /// <param name="msg"></param> private void onTCPImageFile(ImageFileMsg msg) { exUser user = findUser(msg.from); if (user == null) return; if (user.UserID == MyAuth.UserID) return;//如果是自己发送给自己的消息,则不处理 System.IO.DirectoryInfo dInfo = new System.IO.DirectoryInfo(MyAuth.UserID + "\\ArrivalImage"); if (!dInfo.Exists) dInfo.Create(); string fileName = MyAuth.UserID + "\\ArrivalImage\\" + msg.MD5 + msg.Extension; if (System.IO.File.Exists(fileName)) return;//如果本地已经有此文件已经存在,则退出(不接收文件) TFileInfo fileinfo = new TFileInfo(); fileinfo.MD5 = msg.MD5; fileinfo.Length = msg.Length; fileinfo.Extension = msg.Extension; fileinfo.fullName = fileName; if (msg.MessageType == IMLibrary3.Enmu.MessageType.User)//如果图片发送给用户 { ImageFileClient tcpfile = new ImageFileClient(Global.ImageServerEP, fileinfo); tcpfile.fileTransmitted += delegate(object sender, fileTransmitEvnetArgs e) { FormTalkUser fs = user.Tag as FormTalkUser; if (fs != null) { List<MyPicture> needRecPics = fs.GetNeedRecPicture(); foreach (MyPicture pic in needRecPics) if (pic.MD5 == e.fileInfo.MD5) { needRecPics.Remove(pic); pic.Image = System.Drawing.Image.FromFile(e.fileInfo.fullName); fs.Invalidate(); } } (sender as ImageFileClient).Dispose(); sender = null; }; } else if (msg.MessageType == IMLibrary3.Enmu.MessageType.Group)//如果图片发送给群 { exRoom room = findRoom(msg.to);//获得消息接收群 if (room == null) return; FormTalkRoom fs = room.Tag as FormTalkRoom; ImageFileClient tcpfile = new ImageFileClient(Global.ImageServerEP, fileinfo); tcpfile.fileTransmitted += delegate(object sender, fileTransmitEvnetArgs e) { if (fs != null) { List<MyPicture> needRecPics = fs.GetNeedRecPicture(); foreach (MyPicture pic in needRecPics) if (pic.MD5 == e.fileInfo.MD5) { needRecPics.Remove(pic); pic.Image = System.Drawing.Image.FromFile(e.fileInfo.fullName); fs.Invalidate(); } } (sender as ImageFileClient).Dispose(); sender = null; }; } }
private void LoadCachedApkIconsToImageList(ImageList il) { AlphaImageList.AddFromImage((Image)DroidExplorer.Resources.Images.folder_Closed_16xLG, SmallImageList); AlphaImageList.AddFromImage((Image)DroidExplorer.Resources.Images.folder_Closed_16xLG_Link, SmallImageList); AlphaImageList.AddFromImage((Image)DroidExplorer.Resources.Images.text_document_16, SmallImageList); AlphaImageList.AddFromImage((Image)DroidExplorer.Resources.Images.application_16xLG, SmallImageList); AlphaImageList.AddFromImage((Image)DroidExplorer.Resources.Images.text_document_16_link, SmallImageList); AlphaImageList.AddFromImage((Image)DroidExplorer.Resources.Images.application_16xLG_Link, SmallImageList); AlphaImageList.AddFromImage((Image)DroidExplorer.Resources.Images.folder_Closed_32xLG, LargeImageList); AlphaImageList.AddFromImage((Image)DroidExplorer.Resources.Images.folder_Closed_32xLG_Link, LargeImageList); AlphaImageList.AddFromImage((Image)DroidExplorer.Resources.Images.text_document_32, LargeImageList); AlphaImageList.AddFromImage((Image)DroidExplorer.Resources.Images.application_32xLG, LargeImageList); AlphaImageList.AddFromImage((Image)DroidExplorer.Resources.Images.text_document_32_Link, LargeImageList); AlphaImageList.AddFromImage((Image)DroidExplorer.Resources.Images.application_32xLG_Link, LargeImageList); AddFileTypeImage(".txt", (Image)DroidExplorer.Resources.Images.text_document_16, (Image)DroidExplorer.Resources.Images.text_document_32); AddFileTypeImage(".prop", (Image)DroidExplorer.Resources.Images.text_document_16, (Image)DroidExplorer.Resources.Images.text_document_32); AddFileTypeImage(".log", (Image)DroidExplorer.Resources.Images.PickAxe_16xLG, (Image)DroidExplorer.Resources.Images.PickAxe_32xLG); AddFileTypeImage(".sh", (Image)DroidExplorer.Resources.Images.shellscript_16xLG, (Image)DroidExplorer.Resources.Images.shellscript_32xLG); AddFileTypeImage(".csv", (Image)DroidExplorer.Resources.Images.text_document_16, (Image)DroidExplorer.Resources.Images.text_document_32); AddFileTypeImage(".so", (Image)DroidExplorer.Resources.Images.library_16xLG, (Image)DroidExplorer.Resources.Images.library_32xLG); AddFileTypeImage(".dex", (Image)DroidExplorer.Resources.Images.package, (Image)DroidExplorer.Resources.Images.package32); AddFileTypeImage(".odex", (Image)DroidExplorer.Resources.Images.package, (Image)DroidExplorer.Resources.Images.package32); AddFileTypeImage(".sqlite", (Image)DroidExplorer.Resources.Images.database_16xLG, (Image)DroidExplorer.Resources.Images.database_32xLG); AddFileTypeImage(".db", (Image)DroidExplorer.Resources.Images.database_16xLG, (Image)DroidExplorer.Resources.Images.database_32xLG); AddFileTypeImage(".database", (Image)DroidExplorer.Resources.Images.database_16xLG, (Image)DroidExplorer.Resources.Images.database_32xLG); // apk cache icons var path = System.IO.Path.Combine(CommandRunner.Settings.UserDataDirectory, Cache.APK_IMAGE_CACHE); System.IO.DirectoryInfo apkCache = new System.IO.DirectoryInfo(path); if(!apkCache.Exists) { apkCache.Create(); } foreach(System.IO.FileInfo fi in apkCache.GetFiles("*.png")) { Image image = Image.FromFile(fi.FullName); AddFileTypeImage(System.IO.Path.GetFileNameWithoutExtension(fi.Name).ToLower(), image, image); } // file cache icons path = System.IO.Path.Combine(CommandRunner.Settings.UserDataDirectory, Cache.ICON_IMAGE_CACHE); System.IO.DirectoryInfo cache = new System.IO.DirectoryInfo(path); if(!cache.Exists) { cache.Create(); } foreach(System.IO.FileInfo fi in cache.GetFiles("*.png").Union(cache.GetFiles("*.jpg"))) { var image = Image.FromFile(fi.FullName); AddFileTypeImage(System.IO.Path.GetFileNameWithoutExtension(fi.Name).ToLower(), image, image); } }
public void makeBinBackup(int file) { System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(ROM.romfile.Directory.FullName+"/bak"); //Console.Out.WriteLine("Backing up " + file + " "+dir.FullName); if (!dir.Exists) dir.Create(); dir = ROM.romfile.Directory; System.IO.FileStream fs; string filename; if (file == -1) filename = dir.FullName + "/bak/" + "main.bin"; else filename = dir.FullName + "/bak/" + file + ".bin"; if(System.IO.File.Exists(filename)) return; fs = new System.IO.FileStream(filename, System.IO.FileMode.CreateNew); File f = ROM.arm9binFile; if (file != -1) { f = ROM.arm9ovs[file].f; ROM.arm9ovs[file].decompress(); } fs.Write(f.getContents(), 0, f.fileSize); fs.Close(); }
/// <summary> /// 保存附件 /// </summary> /// <param name="id"></param> private void SaveAttach(Guid id) { try { HttpFileCollection files = HttpContext.Current.Request.Files; if (files.Count == 0) { NewsContent n = NewsContent.Load(id); n.Annex = 2;//没有附件 n.Save(); } else { for (int i = 0; i < files.Count; i++) { HttpPostedFile postedFile = files[i]; if (postedFile.ContentLength > 20971520) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('上传附件不能超过20M,附件:" + postedFile.FileName + "上传失败');</script>"); return; } else { string fileSHowName = postedFile.FileName; int dotIndex = postedFile.FileName.IndexOf("\\"); string fileName = string.Empty; if (dotIndex == -1) { fileName = CY.Utility.Common.FileUtility.GetFileName(postedFile.FileName);//文件名 } else { string fileNameTemp = CY.Utility.Common.FileUtility.GetFileName(postedFile.FileName); int indElx = fileNameTemp.LastIndexOf("\\") + 1; fileName = fileNameTemp.Substring(indElx); } //string fileName = CY.Utility.Common.FileUtility.GetFileName(postedFile.FileName);//文件名 string fileExtension = CY.Utility.Common.FileUtility.GetFileExtension(postedFile.FileName);//后缀名 string appPath = CY.Utility.Common.RequestUtility.CurPhysicalApplicationPath;//绝对路径 string dirPath = string.Empty; string httpPath = string.Empty; string annexTypeComon = string.Empty; if (fileExtension == ".jpg" || fileExtension == ".jpeg" || fileExtension == ".gif" || fileExtension == ".png" || fileExtension == ".bmp") { dirPath = appPath + CY.Utility.Common.AnnexUtility.NewsAnnexImgDir; annexTypeComon = CY.Utility.Common.AnnexUtility.ImgAnnexType; httpPath = "/Content/News/Img/"; } else if (fileExtension == ".doc" || fileExtension == ".docx" || fileExtension == ".xls" || fileExtension == ".pdf" || fileExtension == ".txt") { dirPath = appPath + CY.Utility.Common.AnnexUtility.NewsAnnexOfficeDir; annexTypeComon = CY.Utility.Common.AnnexUtility.DocAnnexType; httpPath = "/Content/News/Office/"; } else if (fileExtension == ".rar" || fileExtension == ".zip") { dirPath = appPath + CY.Utility.Common.AnnexUtility.NewsAnnexRARDir; annexTypeComon = CY.Utility.Common.AnnexUtility.RaRAnneType; httpPath = "/Content/News/RAR/"; } else { dirPath = appPath + CY.Utility.Common.AnnexUtility.NewsAnnexOtherDir; annexTypeComon = CY.Utility.Common.AnnexUtility.OtherAnneType; httpPath = "/Content/News/Other/"; } System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(dirPath); if (!di.Exists) { di.Create(); } string FileName = fileName + DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond.ToString(); postedFile.SaveAs(dirPath + "\\" + FileName + fileExtension); AnnexType annexTYPE = AnnexType.SelectAnnexTypeByTypeName(annexTypeComon); Guid typeID = new Guid(); if (annexTYPE == null) { AnnexType annexType = new AnnexType(); annexType.TypeName = annexTypeComon; annexType.Save(); typeID = annexType.Id; } else { typeID = annexTYPE.Id; } Annex annex = new Annex(); annex.AnnexTypeID = typeID; annex.ContentType = 1; annex.ContentID = id; annex.Name = fileName; annex.AnnexURI = httpPath + FileName + fileExtension; annex.Save(); } } } } catch (Exception ex) { lbErr.Text = ex.Message; } }
public void makeBinBackup(int file) { System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(ROM.romfile.Directory.FullName+"/bak"); Console.Out.WriteLine("Backing up " + file + " "+dir.FullName); if (!dir.Exists) dir.Create(); dir = ROM.romfile.Directory; System.IO.FileStream fs; try { if (file == -1) fs = new System.IO.FileStream(dir.FullName + "/bak/" + "main.bin", System.IO.FileMode.CreateNew); else fs = new System.IO.FileStream(dir.FullName + "/bak/" + file + ".bin", System.IO.FileMode.CreateNew); } catch (System.IO.IOException) {return;} File f = ROM.FS.arm9binFile; if (file != -1) { f = ROM.FS.arm9ovs[file]; ROM.FS.arm9ovs[file].decompress(); //b4ckupz r 41w4ys cmpr3zzd } fs.Write(f.getContents(), 0, f.fileSize); fs.Close(); }
/// <summary> /// Validar los cambios y cerrar la ventana /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Validar_Cambios(object sender, RoutedEventArgs e) { bool valido = true; float a; int b = 0; //Validación de los campos if (txtNuevoPrecioProveedor.Text == "" || !float.TryParse(txtNuevoPrecioProveedor.Text, out a)) { txtNuevoPrecioProveedor.Text = "*"; valido = false; } if (txtNuevoPrecioUnitario.Text == "" || !float.TryParse(txtNuevoPrecioUnitario.Text, out a)) { txtNuevoPrecioUnitario.Text = "*"; valido = false; } if (txtNuevoExistencia.Text == "" || !int.TryParse(txtNuevoExistencia.Text, out b)) { txtNuevoExistencia.Text = "*"; valido = false; } //Adquisición de la imagen if (valido) { try { var imageFile = new System.IO.FileInfo(rutaFotoProducto); if (imageFile.Exists) { //Conseguir el directorio local var applicationPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); Console.WriteLine(applicationPath); //Adquirir ruta local de carpeta de Fotografias var dir = new System.IO.DirectoryInfo(System.IO.Path.Combine(applicationPath, "RepProductos")); if (!dir.Exists) dir.Create(); rutaFinal = String.Format("{0}\\{1}", dir.FullName, nombreImagen); Console.WriteLine(rutaFinal); //Copiar imagen a la carpeta de Fotografias imageFile.CopyTo(System.IO.Path.Combine(dir.FullName, nombreImagen),true); } } catch (Exception ex) { Console.WriteLine("Error: "); Console.WriteLine(ex.ToString()); } //Registro del producto en la base de datos //Conversión a flotante válido de los precios float pu = Convert.ToSingle(txtNuevoPrecioUnitario.Text, CultureInfo.InvariantCulture); float pv = Convert.ToSingle(txtNuevoPrecioProveedor.Text, CultureInfo.InvariantCulture); //Obtención del proveedor string consignacionVal = ""; switch (txtConsignacion.SelectedIndex) { case 0: consignacionVal = "La Modistería"; break; case 1: var consignacionBox = proveedorBox; consignacionVal = consignacionBox.Text; break; } //Actualización de la instancia producto.precioUnitario = pu; producto.precioProveedor = pv; producto.consignacion = consignacionVal; producto.existencia = b; producto.descripcion = txtNuevoDescripcion.Text; producto.foto = rutaFinal; //Almacenamiento en la base de datos var cfg = new Configuration(); cfg.Configure(); var sessions = cfg.BuildSessionFactory(); var sess = sessions.OpenSession(); sess.Update(producto); sess.Flush(); sess.Close(); this.Close(); } else MessageBox.Show("Alguno(s) de los campos son inválidos", "La Modistería | ERROR"); }
protected void Page_Load(object sender, EventArgs e) { Session[Authenticate.CALLER_URL] = null; dsReport = new SimplicityDBSchema(); dsTempReport = new DataSet(); if (Request["environment"] != null) //request for page environment { RequestedEnvironment = Request["environment"]; } else RequestedEnvironment = Authenticate.PRODUCTION; //put production in requested Environment errorLabel.Text = ""; //if (Request["environment"].CompareTo("SANDBOX") == 0) if (SchemaUtilty.isDebugMode) TextBox1.Visible = true; try { dir = new System.IO.DirectoryInfo(path); //dir k ander reports ka path rakh day ga if (!dir.Exists) dir.Create(); dirSchema = new System.IO.DirectoryInfo(path + @"\Upload"); //dir k ander reports ka path rakh day ga if (!dirSchema.Exists) dirSchema.Create(); } catch (Exception ex) { TextBox1.Text += "\n" + ex.Message; } TextBox1.Text += "\nOutside auth"; auth = (AuthenticationObject)Session[Authenticate.ACCESS_TOKEN];//////Taking Authentication from Session if (auth != null && Session[Authenticate.AUTHENTICATED_ENVIRONMENT] != null && Session[Authenticate.AUTHENTICATED_ENVIRONMENT].ToString().CompareTo(RequestedEnvironment) == 0)////Check Authenticated and Environment { TextBox1.Text += "\nInside auth"; reportType = Request[REPORT_TYPE]; if (reportType != null && reportType.Length > 0) { TextBox1.Text += "\nInside report Type " + reportType; ReadXMLConfiguration(reportType); if (reportsDict.ContainsKey(reportType)) { Report report = reportsDict[reportType]; TextBox1.Text += "\nReport_TYPE " + reportType; DataSet reportDataSet = new DataSet("SimplicityDBSchema"); for (int iterate = 0; iterate < report.Table.Count;iterate++ ) { try { String table = report.Table[iterate]; var result = Regex.Matches(table, "##(.*?)##"); foreach (Match match in result) { if (Request[match.Groups[1].Value] != null) { table = table.Replace("##" + match.Groups[1].Value + "##", Request[match.Groups[1].Value]); } else { error = true; ShowError("Missing report parameter " + match.Groups[1].Value); return; } } String tableName = report.TableName[iterate]; String tableRelation = report.TableRelation[iterate]; SchemaUtilty.CreateDataSet(Page.Server, path, auth, tableName, reportDataSet, TextBox1); SchemaUtilty.PopulateDataSet(Page.Server, auth, tableRelation, tableName, reportDataSet, table, reportParameter, TextBox1); } catch (Exception ex) { TextBox1.Text += "\n" + ex.Message; TextBox1.Text += "\n" + ex.StackTrace; } } reportDataSet.WriteXmlSchema(dirSchema.FullName + @"\SimplicityDBSchema.xsd"); ReportDocument ReportDoc = new ReportDocument(); ReportDoc.Load(dir + "\\Reports\\" + report.RPTFileName); ReportDoc.SetDataSource(reportDataSet); MyCrystalReportViewer.ReportSource = ReportDoc; MyCrystalReportViewer.RefreshReport(); MyCrystalReportViewer.Visible = true; TextBox1.Text += "\n Reports Loaded "; // } } else ShowError("No report with type " + reportType + " is found"); //String folderPath = Environment.GetFolderPath(Environment.SpecialFolder.System); //TextBox1.Text = Environment.CurrentDirectory.ToString(); //invoiceId = Request[INVOICE_ID]; //ReadXMLConfiguration(); } } else { Session["environment"] = RequestedEnvironment; Session[Authenticate.ACCESS_TOKEN] = null;/////Assuring to Redirect Other Environment If Login Already Session[Authenticate.CALLER_URL] = HttpContext.Current.Request.Url.AbsoluteUri; Response.Redirect("~/Authenticate.aspx"); //lblInvoice.Text = "no auth"; } }
public void Convert(System.IO.FileInfo output, int size) { var converters = new Output_aa[_bmpFiles.Length]; var captionDire = new System.IO.DirectoryInfo(output.Directory.FullName + "\\Captions"); var cssFileInfo = new System.IO.FileInfo(output.Directory.FullName + "\\" + System.IO.Path.GetFileNameWithoutExtension(output.Name) + ".css"); var jsFileInfo = new System.IO.FileInfo(output.Directory.FullName + "\\" + System.IO.Path.GetFileNameWithoutExtension(output.Name) + ".js"); captionDire.Create(); //Js�t�@�C���� OutputCaptions(captionDire, converters, size); //��i�{�̂ł���html������ using (var fileStrm = new System.IO.FileStream(output.FullName, System.IO.FileMode.Create)) { var htmlDocBase = new XmlDocument(); var importList = htmlDocBase.CreateElement("import-files"); //���搧��p�̃X�N���v�g�̎Q�� var main_js = htmlDocBase.CreateElement("file"); main_js.AppendChild(htmlDocBase.CreateTextNode(jsFileInfo.Name)); importList.AppendChild(main_js); //�e�t���[���̕������i�[�����X�N���v�g�̎Q�� for (int i = 0; i < converters.Length; i++) { var item = htmlDocBase.CreateElement("file"); item.AppendChild(htmlDocBase.CreateTextNode(captionDire.Name + "/" + _jsName + i + ".js")); importList.AppendChild(item); } htmlDocBase.AppendChild(importList); var xsltDoc = new XmlDocument(); var xsl = new System.Xml.Xsl.XslCompiledTransform(true); var xsl_args = new System.Xml.Xsl.XsltArgumentList(); xsltDoc.LoadXml(Properties.Resources.Xslt); xsl_args.AddParam("StyleSheetHref", "", cssFileInfo.Name); xsl_args.AddParam("Mode", "", "MoviePlayer"); xsl.Load(xsltDoc); xsl.Transform(htmlDocBase, xsl_args, fileStrm); } //css &JavaScript�̏����o�� System.IO.File.WriteAllText(cssFileInfo.FullName, Properties.Resources.Style_AA); System.IO.File.WriteAllText(jsFileInfo.FullName, Properties.Resources.JScript); }
protected static System. IO. DirectoryInfo appDirectory ( ) { System. IO. DirectoryInfo myDirectory = new System. IO. DirectoryInfo ( System. Windows. Forms. Application. UserAppDataPath ); if ( !myDirectory. Exists ) { myDirectory. Create ( ); } return myDirectory; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpPostedFile imgFile; string imgExtention = String.Empty; string imgName = string.Empty; int imgSizeLimit = 2;//2M #region -Validation and Get Basic Info- // Post file imgFile = context.Request.Files[0]; if (imgFile == null) { context.Response.Write("{success: false, msg: '未上传到照片'}"); return; } else { imgExtention = CY.Utility.Common.FileUtility.GetFileExtension(imgFile.FileName); imgName = CY.Utility.Common.FileUtility.GetFileName(imgFile.FileName); if (imgExtention != ".jpg" && imgExtention != ".jpeg" && imgExtention != ".gif" && imgExtention != ".png" && imgExtention != ".bmp") { context.Response.Write("{success: false, msg: '照片格式不正确,中允许上传jp(e)g,gif,png与bmp格式的照片!'}"); return; } if (imgFile.ContentLength > imgSizeLimit * 1024 * 1024)//限制上传图片的大小(2M) { context.Response.Write("{success: false, msg: '照片大小限制在 " +imgSizeLimit + "M 以内!'}"); return; } } #endregion Guid uniqueId = Guid.NewGuid(); string appPath = CY.Utility.Common.RequestUtility.CurPhysicalApplicationPath;//获取应用程序的物理地址 string dirPath = appPath + "\\Content\\Temp\\";//图片要保存的文件夹地址 System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(dirPath); if (!di.Exists) { di.Create(); } string fileName = uniqueId.ToString("N") + imgExtention;//文件名 imgFile.SaveAs(dirPath + fileName); imgName = CY.Utility.Common.StringUtility.RemoveIllegalCharacters(imgName); StringBuilder sbResult = new StringBuilder(); sbResult.Append("{success: true, imgName: '"); sbResult.Append(imgName); sbResult.Append("', imgExtention: '"); sbResult.Append(imgExtention); sbResult.Append("', imgPath: '"); sbResult.Append("Content/Temp/" + fileName); sbResult.Append("'}"); context.Response.Write(sbResult.ToString()); }
private void btGenBashScript_Click(object sender, EventArgs e) { var scriptPath = Application.StartupPath + "\\bashscript"; System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(scriptPath); if (!dir.Exists) { dir.Create(); } List<Iphone> iphones = GetListIPFromGrid(); string template = System.IO.File.ReadAllText(scriptPath + "\\template.txt"); foreach (Iphone item in iphones) { System.IO.StreamWriter sw = new System.IO.StreamWriter(scriptPath + "\\" + item.IP + ".sh"); //sw.WriteLine("sleep 10"); int numapp = 1; //string app1 = "", app2 = "", app3 = ""; //string appname1 = "", appname2 = "", appname3 = ""; string[] appstr = item.Apps.Split(','); // string[] appBundleID = new string[appstr.Length]; List<App> apps = new List<App>(); for (int i = 0; i < appstr.Length; i++) { int AppID = int.Parse(appstr[i]); App app = new App(); app = (App)Apps.Where(a => a.ID == AppID).FirstOrDefault(); apps.Add(app); } numapp = apps.Count; // app1 = apps[0].BundleID; string temp = template; temp = temp.Replace("[[[numapp]]]", numapp.ToString()); temp = temp.Replace("[[[numreset]]]", Config.iConfig.RoundResetIDFV.ToString()); temp = temp.Replace("[[[numclick]]]",Config.iConfig.RoundClickAd.ToString()); if (cbClearCaches.Checked) { temp = temp.Replace("[[[caches]]]", "rm $(find //var/mobile/Applications -name 'Caches') -rf"); } else { temp = temp.Replace("[[[caches]]]", ""); } if (apps.Count > 0) { temp = temp.Replace("[[[app1]]]", apps[0].BundleID); temp = temp.Replace("[[[appname1]]]", "'"+ apps[0].AppName + "'"); } if (apps.Count > 1) { temp = temp.Replace("[[[app2]]]", apps[1].BundleID); temp = temp.Replace("[[[appname2]]]", "'"+ apps[1].AppName + "'"); } if (apps.Count > 3) { temp = temp.Replace("[[[app3]]]", apps[2].BundleID); temp = temp.Replace("[[[appname3]]]", "'"+ apps[2].AppName + "'"); } sw.WriteLine(temp); sw.Close(); System.IO.StreamWriter sw1 = new System.IO.StreamWriter(scriptPath + "\\" + item.IP+ "-permission" + ".txt"); sw1.WriteLine("chmod 777 /User/Library/runbatch/scripts/" + item.IP + ".sh"); sw1.Close(); System.IO.StreamWriter sw2 = new System.IO.StreamWriter(scriptPath + "\\" + item.IP + "-run" + ".txt"); sw2.WriteLine("bash /User/Library/runbatch/scripts/" + item.IP + ".sh"); sw2.Close(); } }
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) { } }