private static void CheckUpdateManager() { if (!Directory.Exists(Ap.FolderTempUpdater) || !Directory.Exists(Ap.FolderUpdaterBin)) { return; } string[] elements = Directory.GetFileSystemEntries(Ap.FolderTempUpdater); foreach (string element in elements) { String filePath = Ap.FolderUpdaterBin + Path.GetFileName(element); if (File.Exists(filePath)) { UFile.RemoveReadOnly(filePath); File.Delete(filePath); } File.Copy(element, filePath, true); } if (Directory.Exists(Ap.FolderTempBin)) { Directory.Delete(Ap.FolderTempBin, true); } }
public void SaveColorScheme1(string filePath, DataSet ds) { UFile.RemoveReadOnly(filePath); System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); ds.WriteXml(memoryStream); InfinityStreamsManager.WriteStreamToFile(filePath, memoryStream); memoryStream.Close(); }
public void Save(string filePath) { UFile.RemoveReadOnly(filePath); System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); BoardThemeDataSet.WriteXml(memoryStream); InfinityStreamsManager.WriteStreamToFile(filePath, memoryStream); memoryStream.Close(); }
public static void WriteXml(DataTable table, string filePath) { UFile.RemoveReadOnly(filePath); MemoryStream memoryStream = new MemoryStream(); table.WriteXml(memoryStream); InfinityStreamsManager.WriteStreamToFile(filePath, memoryStream); memoryStream.Close(); }
public virtual void SaveAs(string filePath) { if (fu.PostedFile != null && fu.PostedFile.ContentLength > 0) { UFile.RemoveReadOnly(filePath); UFile.CreateFolderFromFilePath(filePath); fu.PostedFile.SaveAs(filePath); } }
public void WriteLog(string message) { isFileInUsed = true; StreamWriter debuggerWriter = new StreamWriter(Ap.FileLogTxt, true); UFile.RemoveReadOnly(Ap.FileLogTxt); debuggerWriter.WriteLine(message); debuggerWriter.Close(); debuggerWriter = null; isFileInUsed = false; }
private void SaveUserImage(string filePath) { DataTable userImageTable = new DataTable("UserImageTable"); DataColumn nameColumn; nameColumn = new DataColumn(); nameColumn.DataType = System.Type.GetType("System.String"); nameColumn.ColumnName = "ImageName"; userImageTable.Columns.Add(nameColumn); DataColumn imageColumn; imageColumn = new DataColumn(); imageColumn.DataType = System.Type.GetType("System.Byte[]"); imageColumn.ColumnName = "ImageBytes"; userImageTable.Columns.Add(imageColumn); System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); MemoryStream ms = new MemoryStream(encoding.GetBytes(UserImage)); userImageTable.ReadXml(ms); ms.Close(); //Image img = Image.FromStream(ms); if (userImageTable != null && userImageTable.Rows.Count > 0) { MemoryStream memoryStream = new MemoryStream((byte[])userImageTable.Rows[0]["ImageBytes"]); Bitmap img = new Bitmap(memoryStream); UFile.Delete(filePath + ".bmp"); UFile.Delete(filePath + ".jpeg"); UFile.Delete(filePath + ".jpg"); UFile.Delete(filePath + ".gif"); UFile.RemoveReadOnly(filePath + UserImageType); img.Save(filePath + UserImageType); memoryStream.Close(); } }
public static void WriteXmlDecrypted(DataTable table, string filePath) { UFile.RemoveReadOnly(filePath); table.WriteXml(filePath); }
public static void Copy(string sourceFilePath, string targetFilePath) { File.Copy(sourceFilePath, targetFilePath, true); UFile.RemoveReadOnly(targetFilePath); }
public static void Write(string filePath, string text) { UFile.RemoveReadOnly(filePath); File.WriteAllText(filePath, text); }