@@ -98,7 +98,7 @@ public MainForm ViewLeakedAbstraction
98
98
/// </summary>
99
99
public void ViewFiles ( )
100
100
{
101
- using ( var msidb = new Database ( this . SelectedMsiFile . FullName , OpenDatabase . ReadOnly ) )
101
+ using ( var msidb = MsiDatabase . Create ( new LessIO . Path ( this . SelectedMsiFile . FullName ) ) )
102
102
{
103
103
ViewFiles ( msidb ) ;
104
104
ToggleSelectAllFiles ( true ) ;
@@ -120,14 +120,23 @@ private void ViewFiles(Database msidb)
120
120
{
121
121
Status ( ) ;
122
122
123
- MsiFile [ ] dataItems = MsiFile . CreateMsiFilesFromMSI ( msidb ) ;
124
- MsiFileItemView [ ] viewItems = Array . ConvertAll < MsiFile , MsiFileItemView > ( dataItems ,
125
- inItem => new MsiFileItemView ( inItem )
126
- ) ;
127
- fileDataSource = new SortableBindingList < MsiFileItemView > ( viewItems ) ;
128
- ViewLeakedAbstraction . fileGrid . DataSource = fileDataSource ;
129
- View . AutoSizeFileGridColumns ( ) ;
130
- Status ( fileDataSource . Count + " files found." ) ;
123
+ ViewLeakedAbstraction . fileGrid . DataSource = null ;
124
+
125
+ if ( msidb . TableExists ( "File" ) )
126
+ {
127
+ MsiFile [ ] dataItems = MsiFile . CreateMsiFilesFromMSI ( msidb ) ;
128
+ MsiFileItemView [ ] viewItems = Array . ConvertAll < MsiFile , MsiFileItemView > ( dataItems ,
129
+ inItem => new MsiFileItemView ( inItem )
130
+ ) ;
131
+ fileDataSource = new SortableBindingList < MsiFileItemView > ( viewItems ) ;
132
+ ViewLeakedAbstraction . fileGrid . DataSource = fileDataSource ;
133
+ View . AutoSizeFileGridColumns ( ) ;
134
+ Status ( fileDataSource . Count + " files found." ) ;
135
+ }
136
+ else
137
+ {
138
+ Status ( "No files present." ) ;
139
+ }
131
140
}
132
141
catch ( Exception eUnexpected )
133
142
{
@@ -144,7 +153,7 @@ public void UpdatePropertyTabView()
144
153
try
145
154
{
146
155
MsiPropertyInfo [ ] props ;
147
- using ( var msidb = new Database ( this . SelectedMsiFile . FullName , OpenDatabase . ReadOnly ) )
156
+ using ( var msidb = MsiDatabase . Create ( new LessIO . Path ( this . SelectedMsiFile . FullName ) ) )
148
157
{
149
158
props = MsiPropertyInfo . GetPropertiesFromDatabase ( msidb ) ;
150
159
}
@@ -315,7 +324,7 @@ public void LoadTables()
315
324
316
325
IEnumerable < string > msiTableNames = allTableNames ;
317
326
318
- using ( var msidb = new Database ( this . SelectedMsiFile . FullName , OpenDatabase . ReadOnly ) )
327
+ using ( var msidb = MsiDatabase . Create ( new LessIO . Path ( this . SelectedMsiFile . FullName ) ) )
319
328
{
320
329
using ( View . StartWaitCursor ( ) )
321
330
{
@@ -407,7 +416,7 @@ public void OnSelectedStreamChanged()
407
416
/// </summary>
408
417
public void UpdateMSiTableGrid ( )
409
418
{
410
- using ( var msidb = new Database ( this . SelectedMsiFile . FullName , OpenDatabase . ReadOnly ) )
419
+ using ( var msidb = MsiDatabase . Create ( new LessIO . Path ( this . SelectedMsiFile . FullName ) ) )
411
420
{
412
421
string tableName = View . SelectedTableName ;
413
422
UpdateMSiTableGrid ( msidb , tableName ) ;
0 commit comments