public void ImportBytes(CVariable editvar) { var dlg = new OpenFileDialog() { InitialDirectory = MainController.Get().Configuration.InitialExportDirectory }; if (dlg.ShowDialog() == DialogResult.OK) { MainController.Get().Configuration.InitialExportDirectory = Path.GetDirectoryName(dlg.FileName); using (var fs = new FileStream(dlg.FileName, FileMode.Open, FileAccess.Read)) { using (var reader = new BinaryReader(fs)) { var bytes = ImportExportUtility.GetImportBytes(reader); editvar.SetValue(bytes); MainController.LogString( $"{((CVariable) editvar).GetFullDependencyStringName()} succesfully imported from {dlg.FileName}", Logtype.Success); } } } }
private void ImportBytes(CVariable editvar) { var dlg = new OpenFileDialog() { InitialDirectory = Get().Configuration.InitialExportDirectory }; if (dlg.ShowDialog() == DialogResult.OK) { Get().Configuration.InitialExportDirectory = Path.GetDirectoryName(dlg.FileName); using (var fs = new FileStream(dlg.FileName, FileMode.Open, FileAccess.Read)) { using (var reader = new BinaryReader(fs)) { var bytes = ImportExportUtility.GetImportBytes(reader); editvar.SetValue(bytes); } } } }