- Timestamp:
- 08/05/13 16:42:08 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Data.Views/3.3/Path Views/TextFileView.cs
r9841 r9850 25 25 using System.Windows.Forms; 26 26 using HeuristicLab.MainForm; 27 using HeuristicLab.PluginInfrastructure; 27 28 28 29 namespace HeuristicLab.Data.Views { … … 216 217 if (!File.Exists(path)) return null; 217 218 string fileContent = string.Empty; 218 using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { 219 using (StreamReader streamReader = new StreamReader(fileStream)) { 220 fileContent = streamReader.ReadToEnd(); 221 } 219 try { 220 using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { 221 using (StreamReader streamReader = new StreamReader(fileStream)) { 222 fileContent = streamReader.ReadToEnd(); 223 } 224 } 225 } 226 catch (Exception e) { 227 ErrorHandling.ShowErrorDialog(e); 222 228 } 223 229 return fileContent; … … 225 231 226 232 private static void WriteFile(string path, string fileContent) { 227 using (FileStream fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None)) { 228 using (StreamWriter streamWriter = new StreamWriter(fileStream)) { 229 streamWriter.Write(fileContent); 230 } 233 try { 234 using (FileStream fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None)) { 235 using (StreamWriter streamWriter = new StreamWriter(fileStream)) { 236 streamWriter.Write(fileContent); 237 } 238 } 239 } 240 catch (Exception e) { 241 ErrorHandling.ShowErrorDialog(e); 231 242 } 232 243 }
Note: See TracChangeset
for help on using the changeset viewer.