Skip to content

Commit

Permalink
Fix stream reader
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillGutyrchik committed Aug 28, 2024
1 parent abdb739 commit 4d43077
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Main/ImportIcpWagoModulesAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ public bool Execute(ActionCallingContext oActionCallingContext)
return true;
}

var data = new StreamReader(openFileDialog.FileName, EncodingDetector.DetectFileEncoding(openFileDialog.FileName), true).ReadToEnd();
var data = "";
using (var reader = new StreamReader(openFileDialog.FileName, EncodingDetector.DetectFileEncoding(openFileDialog.FileName), true))
{
// read main.wago.plua file data
data = reader.ReadToEnd();
}

var modulesImporter = new ModulesImporter(currentProject, data);
modulesImporter.Import();
Expand Down

0 comments on commit 4d43077

Please sign in to comment.