Rename all instances of os and oses to app and apps.

This commit is contained in:
2018-02-23 03:33:22 +00:00
parent 229ae55f37
commit 6cf15e7c9e
5 changed files with 131 additions and 131 deletions

View File

@@ -102,8 +102,8 @@
<TabPage Text="Files"> <TabPage Text="Files">
<GridView ID="treeFiles" SelectionChanged="treeFilesSelectionChanged" /> <GridView ID="treeFiles" SelectionChanged="treeFilesSelectionChanged" />
</TabPage> </TabPage>
<TabPage Text="OSes" ID="tabOSes" Visible="False"> <TabPage Text="Applications" ID="tabApps" Visible="False">
<GridView ID="treeOSes" /> <GridView ID="treeApps" />
</TabPage> </TabPage>
</TabControl> </TabControl>
</StackLayoutItem> </StackLayoutItem>

View File

@@ -44,11 +44,11 @@ namespace apprepodbmgr.Eto
{ {
public class dlgAdd : Dialog public class dlgAdd : Dialog
{ {
public delegate void OnAddedOSDelegate(DbEntry os); public delegate void OnAddedAppDelegate(DbEntry app);
ObservableCollection<FileEntry> fileView; ObservableCollection<FileEntry> fileView;
int knownFiles; int knownFiles;
ObservableCollection<DBEntryForEto> osView; ObservableCollection<DBEntryForEto> appView;
bool stopped; bool stopped;
Thread thdAddFiles; Thread thdAddFiles;
Thread thdCheckFiles; Thread thdCheckFiles;
@@ -98,85 +98,85 @@ namespace apprepodbmgr.Eto
e.BackgroundColor = ((FileEntry)e.Item).Known ? Colors.Green : Colors.Red; e.BackgroundColor = ((FileEntry)e.Item).Known ? Colors.Green : Colors.Red;
}; };
osView = new ObservableCollection<DBEntryForEto>(); appView = new ObservableCollection<DBEntryForEto>();
treeOSes.DataStore = osView; treeApps.DataStore = appView;
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.developer)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.developer)},
HeaderText = "Developer" HeaderText = "Developer"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.product)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.product)},
HeaderText = "Product" HeaderText = "Product"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.version)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.version)},
HeaderText = "Version" HeaderText = "Version"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.languages)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.languages)},
HeaderText = "Languages" HeaderText = "Languages"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.architecture)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.architecture)},
HeaderText = "Architecture" HeaderText = "Architecture"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.machine)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.machine)},
HeaderText = "Machine" HeaderText = "Machine"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.format)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.format)},
HeaderText = "Format" HeaderText = "Format"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.description)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.description)},
HeaderText = "Description" HeaderText = "Description"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.oem)}, DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.oem)},
HeaderText = "OEM?" HeaderText = "OEM?"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.upgrade)}, DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.upgrade)},
HeaderText = "Upgrade?" HeaderText = "Upgrade?"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.update)}, DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.update)},
HeaderText = "Update?" HeaderText = "Update?"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.source)}, DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.source)},
HeaderText = "Source?" HeaderText = "Source?"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.files)}, DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.files)},
HeaderText = "Files?" HeaderText = "Files?"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.netinstall)}, DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.netinstall)},
HeaderText = "NetInstall?" HeaderText = "NetInstall?"
}); });
treeOSes.AllowMultipleSelection = false; treeApps.AllowMultipleSelection = false;
} }
public event OnAddedOSDelegate OnAddedOS; public event OnAddedAppDelegate OnAddedApp;
void UnarChangeStatus() void UnarChangeStatus()
{ {
@@ -293,8 +293,8 @@ namespace apprepodbmgr.Eto
Workers.Finished += ChkFilesFinished; Workers.Finished += ChkFilesFinished;
Workers.UpdateProgress += UpdateProgress; Workers.UpdateProgress += UpdateProgress;
Workers.UpdateProgress2 += UpdateProgress2; Workers.UpdateProgress2 += UpdateProgress2;
Workers.AddFileForOS += AddFile; Workers.AddFileForApp += AddFile;
Workers.AddOS += AddOs; Workers.AddApp += AddApp;
thdCheckFiles.Start(); thdCheckFiles.Start();
}); });
} }
@@ -312,15 +312,15 @@ namespace apprepodbmgr.Eto
Workers.Finished -= ChkFilesFinished; Workers.Finished -= ChkFilesFinished;
Workers.UpdateProgress -= UpdateProgress; Workers.UpdateProgress -= UpdateProgress;
Workers.UpdateProgress2 -= UpdateProgress2; Workers.UpdateProgress2 -= UpdateProgress2;
Workers.AddFileForOS -= AddFile; Workers.AddFileForApp -= AddFile;
Workers.AddOS -= AddOs; Workers.AddApp -= AddApp;
thdCheckFiles?.Abort(); thdCheckFiles?.Abort();
thdHashFiles = null; thdHashFiles = null;
fileView?.Clear(); fileView?.Clear();
if(osView == null) return; if(appView == null) return;
tabOSes.Visible = false; tabApps.Visible = false;
osView.Clear(); appView.Clear();
}); });
} }
@@ -332,8 +332,8 @@ namespace apprepodbmgr.Eto
Workers.Finished -= ChkFilesFinished; Workers.Finished -= ChkFilesFinished;
Workers.UpdateProgress -= UpdateProgress; Workers.UpdateProgress -= UpdateProgress;
Workers.UpdateProgress2 -= UpdateProgress2; Workers.UpdateProgress2 -= UpdateProgress2;
Workers.AddFileForOS -= AddFile; Workers.AddFileForApp -= AddFile;
Workers.AddOS -= AddOs; Workers.AddApp -= AddApp;
thdCheckFiles?.Abort(); thdCheckFiles?.Abort();
@@ -418,12 +418,12 @@ namespace apprepodbmgr.Eto
}); });
} }
void AddOs(DbEntry os) void AddApp(DbEntry app)
{ {
Application.Instance.Invoke(delegate Application.Instance.Invoke(delegate
{ {
tabOSes.Visible = true; tabApps.Visible = true;
osView.Add(new DBEntryForEto(os)); appView.Add(new DBEntryForEto(app));
}); });
} }
@@ -447,10 +447,10 @@ namespace apprepodbmgr.Eto
btnRemoveFile.Visible = false; btnRemoveFile.Visible = false;
btnToggleCrack.Visible = false; btnToggleCrack.Visible = false;
fileView?.Clear(); fileView?.Clear();
if(osView != null) if(appView != null)
{ {
tabOSes.Visible = false; tabApps.Visible = false;
osView.Clear(); appView.Clear();
} }
txtFormat.ReadOnly = true; txtFormat.ReadOnly = true;
@@ -560,8 +560,8 @@ namespace apprepodbmgr.Eto
{ {
stopped = true; stopped = true;
Workers.AddFileForOS -= AddFile; Workers.AddFileForApp -= AddFile;
Workers.AddOS -= AddOs; Workers.AddApp -= AddApp;
Workers.Failed -= AddFilesToDbFailed; Workers.Failed -= AddFilesToDbFailed;
Workers.Failed -= ChkFilesFailed; Workers.Failed -= ChkFilesFailed;
Workers.Failed -= ExtractArchiveFailed; Workers.Failed -= ExtractArchiveFailed;
@@ -670,10 +670,10 @@ namespace apprepodbmgr.Eto
Workers.UpdateProgress2 -= UpdateProgress2; Workers.UpdateProgress2 -= UpdateProgress2;
btnStop.Visible = false; btnStop.Visible = false;
fileView?.Clear(); fileView?.Clear();
if(osView == null) return; if(appView == null) return;
tabOSes.Visible = false; tabApps.Visible = false;
osView.Clear(); appView.Clear();
} }
void RemoveTempFilesFailed(string text) void RemoveTempFilesFailed(string text)
@@ -776,16 +776,16 @@ namespace apprepodbmgr.Eto
long counter = 0; long counter = 0;
fileView.Clear(); fileView.Clear();
foreach(KeyValuePair<string, DbOsFile> kvp in Context.Hashes) foreach(KeyValuePair<string, DbAppFile> kvp in Context.Hashes)
{ {
UpdateProgress(null, "Updating table", counter, Context.Hashes.Count); UpdateProgress(null, "Updating table", counter, Context.Hashes.Count);
fileView.Add(new FileEntry {Path = kvp.Key, Hash = kvp.Value.Sha256, Known = true}); fileView.Add(new FileEntry {Path = kvp.Key, Hash = kvp.Value.Sha256, Known = true});
counter++; counter++;
} }
// TODO: Update OS table // TODO: Update application table
OnAddedOS?.Invoke(Context.DbInfo); OnAddedApp?.Invoke(Context.DbInfo);
lblProgress.Visible = false; lblProgress.Visible = false;
prgProgress.Visible = false; prgProgress.Visible = false;
@@ -1118,14 +1118,14 @@ namespace apprepodbmgr.Eto
string name = ((FileEntry)treeFiles.SelectedItem).Path; string name = ((FileEntry)treeFiles.SelectedItem).Path;
bool known = ((FileEntry)treeFiles.SelectedItem).Known; bool known = ((FileEntry)treeFiles.SelectedItem).Known;
if(!Context.Hashes.TryGetValue(name, out DbOsFile osfile)) return; if(!Context.Hashes.TryGetValue(name, out DbAppFile appFile)) return;
osfile.Crack = !osfile.Crack; appFile.Crack = !appFile.Crack;
Context.Hashes.Remove(name); Context.Hashes.Remove(name);
Context.Hashes.Add(name, osfile); Context.Hashes.Add(name, appFile);
((FileEntry)treeFiles.SelectedItem).IsCrack = osfile.Crack; ((FileEntry)treeFiles.SelectedItem).IsCrack = appFile.Crack;
fileView.Remove((FileEntry)treeFiles.SelectedItem); fileView.Remove((FileEntry)treeFiles.SelectedItem);
fileView.Add(new FileEntry {Path = name, Hash = osfile.Sha256, Known = known, IsCrack = osfile.Crack}); fileView.Add(new FileEntry {Path = name, Hash = appFile.Sha256, Known = known, IsCrack = appFile.Crack});
} }
void treeFilesSelectionChanged(object sender, EventArgs e) void treeFilesSelectionChanged(object sender, EventArgs e)
@@ -1160,8 +1160,8 @@ namespace apprepodbmgr.Eto
CheckBox chkSource; CheckBox chkSource;
CheckBox chkNetinstall; CheckBox chkNetinstall;
GridView treeFiles; GridView treeFiles;
TabPage tabOSes; TabPage tabApps;
GridView treeOSes; GridView treeApps;
Label lblProgress; Label lblProgress;
ProgressBar prgProgress; ProgressBar prgProgress;
Label lblProgress2; Label lblProgress2;

View File

@@ -208,7 +208,7 @@ namespace apprepodbmgr.Eto
void FillFilesCombos() void FillFilesCombos()
{ {
foreach(KeyValuePair<string, DbOsFile> files in Context.Hashes) lstFilesForMedia.Add(files.Key); foreach(KeyValuePair<string, DbAppFile> files in Context.Hashes) lstFilesForMedia.Add(files.Key);
} }
public void FillFields() public void FillFields()

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Form xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="365" Width="612" Title="App Repository DB Manager"> <Form xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="365" Width="612" Title="App Repository DB Manager">
<TabControl> <TabControl>
<TabPage Text="Operating systems" ID="tabOSes"> <TabPage Text="Operating systems" ID="tabApps">
<StackLayout Orientation="Vertical"> <StackLayout Orientation="Vertical">
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch"> <StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
<GridView ID="treeOSes" Enabled="False" /> <GridView ID="treeApps" Enabled="False" />
</StackLayoutItem> </StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Center"> <StackLayoutItem HorizontalAlignment="Center">
<Label ID="lblOSStatus" Visible="False">lblOSStatus</Label> <Label ID="lblAppStatus" Visible="False">lblAppStatus</Label>
</StackLayoutItem> </StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch"> <StackLayoutItem HorizontalAlignment="Stretch">
<Label ID="lblProgress">lblProgress</Label> <Label ID="lblProgress">lblProgress</Label>

View File

@@ -42,14 +42,14 @@ namespace apprepodbmgr.Eto
int infectedFiles; int infectedFiles;
ObservableCollection<DbFile> lstFiles; ObservableCollection<DbFile> lstFiles;
ObservableCollection<DBEntryForEto> lstOSes; ObservableCollection<DBEntryForEto> lstApps;
DbFile outIter; DbFile outIter;
bool populatingFiles; bool populatingFiles;
bool scanningFiles; bool scanningFiles;
Thread thdCleanFiles; Thread thdCleanFiles;
Thread thdCompressTo; Thread thdCompressTo;
Thread thdPopulateFiles; Thread thdPopulateFiles;
Thread thdPopulateOSes; Thread thdPopulateApps;
Thread thdSaveAs; Thread thdSaveAs;
Thread thdScanFile; Thread thdScanFile;
@@ -59,81 +59,81 @@ namespace apprepodbmgr.Eto
Workers.InitDB(); Workers.InitDB();
lstOSes = new ObservableCollection<DBEntryForEto>(); lstApps = new ObservableCollection<DBEntryForEto>();
treeOSes.DataStore = lstOSes; treeApps.DataStore = lstApps;
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.developer)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.developer)},
HeaderText = "Developer" HeaderText = "Developer"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.product)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.product)},
HeaderText = "Product" HeaderText = "Product"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.version)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.version)},
HeaderText = "Version" HeaderText = "Version"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.languages)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.languages)},
HeaderText = "Languages" HeaderText = "Languages"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.architecture)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.architecture)},
HeaderText = "Architecture" HeaderText = "Architecture"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.machine)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.machine)},
HeaderText = "Machine" HeaderText = "Machine"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.format)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.format)},
HeaderText = "Format" HeaderText = "Format"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.description)}, DataCell = new TextBoxCell {Binding = Binding.Property<DBEntryForEto, string>(r => r.description)},
HeaderText = "Description" HeaderText = "Description"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.oem)}, DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.oem)},
HeaderText = "OEM?" HeaderText = "OEM?"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.upgrade)}, DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.upgrade)},
HeaderText = "Upgrade?" HeaderText = "Upgrade?"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.update)}, DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.update)},
HeaderText = "Update?" HeaderText = "Update?"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.source)}, DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.source)},
HeaderText = "Source?" HeaderText = "Source?"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.files)}, DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.files)},
HeaderText = "Files?" HeaderText = "Files?"
}); });
treeOSes.Columns.Add(new GridColumn treeApps.Columns.Add(new GridColumn
{ {
DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.netinstall)}, DataCell = new CheckBoxCell {Binding = Binding.Property<DBEntryForEto, bool?>(r => r.netinstall)},
HeaderText = "NetInstall?" HeaderText = "NetInstall?"
}); });
treeOSes.AllowMultipleSelection = false; treeApps.AllowMultipleSelection = false;
lstFiles = new ObservableCollection<DbFile>(); lstFiles = new ObservableCollection<DbFile>();
@@ -206,60 +206,60 @@ namespace apprepodbmgr.Eto
mnuCompress.Enabled = false; mnuCompress.Enabled = false;
} }
Workers.Failed += LoadOSesFailed; Workers.Failed += LoadAppsFailed;
Workers.Finished += LoadOSesFinished; Workers.Finished += LoadAppsFinished;
Workers.UpdateProgress += UpdateProgress; Workers.UpdateProgress += UpdateProgress;
Workers.AddOS += AddOs; Workers.AddApp += AddApp;
Workers.AddFile += AddFile; Workers.AddFile += AddFile;
Workers.AddFiles += AddFiles; Workers.AddFiles += AddFiles;
thdPopulateOSes = new Thread(Workers.GetAllOSes); thdPopulateApps = new Thread(Workers.GetAllApps);
thdPopulateOSes.Start(); thdPopulateApps.Start();
} }
void LoadOSesFailed(string text) void LoadAppsFailed(string text)
{ {
Application.Instance.Invoke(delegate Application.Instance.Invoke(delegate
{ {
MessageBox.Show($"Error {text} when populating OSes file, exiting...", MessageBoxButtons.OK, MessageBox.Show($"Error {text} when populating applications, exiting...", MessageBoxButtons.OK,
MessageBoxType.Error, MessageBoxDefaultButton.OK); MessageBoxType.Error, MessageBoxDefaultButton.OK);
if(thdPopulateOSes != null) if(thdPopulateApps != null)
{ {
thdPopulateOSes.Abort(); thdPopulateApps.Abort();
thdPopulateOSes = null; thdPopulateApps = null;
} }
Workers.Failed -= LoadOSesFailed; Workers.Failed -= LoadAppsFailed;
Workers.Finished -= LoadOSesFinished; Workers.Finished -= LoadAppsFinished;
Workers.UpdateProgress -= UpdateProgress; Workers.UpdateProgress -= UpdateProgress;
Application.Instance.Quit(); Application.Instance.Quit();
}); });
} }
void LoadOSesFinished() void LoadAppsFinished()
{ {
Application.Instance.Invoke(delegate Application.Instance.Invoke(delegate
{ {
Workers.Failed -= LoadOSesFailed; Workers.Failed -= LoadAppsFailed;
Workers.Finished -= LoadOSesFinished; Workers.Finished -= LoadAppsFinished;
Workers.UpdateProgress -= UpdateProgress; Workers.UpdateProgress -= UpdateProgress;
Workers.AddOS -= AddOs; Workers.AddApp -= AddApp;
if(thdPopulateOSes != null) if(thdPopulateApps != null)
{ {
thdPopulateOSes.Abort(); thdPopulateApps.Abort();
thdPopulateOSes = null; thdPopulateApps = null;
} }
lblProgress.Visible = false; lblProgress.Visible = false;
prgProgress.Visible = false; prgProgress.Visible = false;
treeOSes.Enabled = true; treeApps.Enabled = true;
btnAdd.Visible = true; btnAdd.Visible = true;
btnRemove.Visible = true; btnRemove.Visible = true;
btnCompress.Visible = Context.UsableDotNetZip; btnCompress.Visible = Context.UsableDotNetZip;
btnSave.Visible = true; btnSave.Visible = true;
btnHelp.Enabled = true; btnHelp.Enabled = true;
btnSettings.Enabled = true; btnSettings.Enabled = true;
lblOSStatus.Visible = true; lblAppStatus.Visible = true;
lblOSStatus.Text = $"{lstOSes.Count} operating systems"; lblAppStatus.Text = $"{lstApps.Count} applications";
}); });
} }
@@ -319,43 +319,43 @@ namespace apprepodbmgr.Eto
}); });
} }
void AddOs(DbEntry os) void AddApp(DbEntry app)
{ {
Application.Instance.Invoke(delegate { lstOSes.Add(new DBEntryForEto(os)); }); Application.Instance.Invoke(delegate { lstApps.Add(new DBEntryForEto(app)); });
} }
protected void OnBtnAddClicked(object sender, EventArgs e) protected void OnBtnAddClicked(object sender, EventArgs e)
{ {
dlgAdd dlgAdd = new dlgAdd(); dlgAdd dlgAdd = new dlgAdd();
dlgAdd.OnAddedOS += os => { lstOSes.Add(new DBEntryForEto(os)); }; dlgAdd.OnAddedApp += app => { lstApps.Add(new DBEntryForEto(app)); };
dlgAdd.ShowModal(this); dlgAdd.ShowModal(this);
} }
protected void OnBtnRemoveClicked(object sender, EventArgs e) protected void OnBtnRemoveClicked(object sender, EventArgs e)
{ {
if(treeOSes.SelectedItem == null) return; if(treeApps.SelectedItem == null) return;
if(MessageBox.Show("Are you sure you want to remove the selected OS?", MessageBoxButtons.YesNo, if(MessageBox.Show("Are you sure you want to remove the selected application?", MessageBoxButtons.YesNo,
MessageBoxType.Question, MessageBoxDefaultButton.No) != DialogResult.Yes) return; MessageBoxType.Question, MessageBoxDefaultButton.No) != DialogResult.Yes) return;
Workers.RemoveOS(((DBEntryForEto)treeOSes.SelectedItem).id, ((DBEntryForEto)treeOSes.SelectedItem).mdid); Workers.RemoveApp(((DBEntryForEto)treeApps.SelectedItem).id, ((DBEntryForEto)treeApps.SelectedItem).mdid);
lstOSes.Remove((DBEntryForEto)treeOSes.SelectedItem); lstApps.Remove((DBEntryForEto)treeApps.SelectedItem);
} }
protected void OnBtnSaveClicked(object sender, EventArgs e) protected void OnBtnSaveClicked(object sender, EventArgs e)
{ {
if(treeOSes.SelectedItem == null) return; if(treeApps.SelectedItem == null) return;
SelectFolderDialog dlgFolder = new SelectFolderDialog {Title = "Save to..."}; SelectFolderDialog dlgFolder = new SelectFolderDialog {Title = "Save to..."};
if(dlgFolder.ShowDialog(this) != DialogResult.Ok) return; if(dlgFolder.ShowDialog(this) != DialogResult.Ok) return;
Context.DbInfo.Id = ((DBEntryForEto)treeOSes.SelectedItem).id; Context.DbInfo.Id = ((DBEntryForEto)treeApps.SelectedItem).id;
Context.Path = dlgFolder.Directory; Context.Path = dlgFolder.Directory;
lblProgress.Visible = true; lblProgress.Visible = true;
prgProgress.Visible = true; prgProgress.Visible = true;
lblProgress2.Visible = true; lblProgress2.Visible = true;
prgProgress2.Visible = true; prgProgress2.Visible = true;
treeOSes.Enabled = false; treeApps.Enabled = false;
btnAdd.Visible = false; btnAdd.Visible = false;
btnRemove.Visible = false; btnRemove.Visible = false;
btnCompress.Visible = false; btnCompress.Visible = false;
@@ -382,7 +382,7 @@ namespace apprepodbmgr.Eto
prgProgress.Visible = false; prgProgress.Visible = false;
lblProgress2.Visible = false; lblProgress2.Visible = false;
prgProgress2.Visible = false; prgProgress2.Visible = false;
treeOSes.Enabled = true; treeApps.Enabled = true;
btnAdd.Visible = true; btnAdd.Visible = true;
btnRemove.Visible = true; btnRemove.Visible = true;
btnCompress.Visible = Context.UsableDotNetZip; btnCompress.Visible = Context.UsableDotNetZip;
@@ -414,7 +414,7 @@ namespace apprepodbmgr.Eto
prgProgress.Visible = false; prgProgress.Visible = false;
lblProgress2.Visible = false; lblProgress2.Visible = false;
prgProgress2.Visible = false; prgProgress2.Visible = false;
treeOSes.Enabled = true; treeApps.Enabled = true;
btnAdd.Visible = true; btnAdd.Visible = true;
btnRemove.Visible = true; btnRemove.Visible = true;
btnCompress.Visible = Context.UsableDotNetZip; btnCompress.Visible = Context.UsableDotNetZip;
@@ -459,26 +459,26 @@ namespace apprepodbmgr.Eto
protected void OnBtnStopClicked(object sender, EventArgs e) protected void OnBtnStopClicked(object sender, EventArgs e)
{ {
Workers.AddOS -= AddOs; Workers.AddApp -= AddApp;
Workers.Failed -= CompressToFailed; Workers.Failed -= CompressToFailed;
Workers.Failed -= LoadOSesFailed; Workers.Failed -= LoadAppsFailed;
Workers.Failed -= SaveAsFailed; Workers.Failed -= SaveAsFailed;
Workers.Finished -= CompressToFinished; Workers.Finished -= CompressToFinished;
Workers.Finished -= LoadOSesFinished; Workers.Finished -= LoadAppsFinished;
Workers.Finished -= SaveAsFinished; Workers.Finished -= SaveAsFinished;
Workers.UpdateProgress -= UpdateProgress; Workers.UpdateProgress -= UpdateProgress;
Workers.UpdateProgress2 -= UpdateProgress2; Workers.UpdateProgress2 -= UpdateProgress2;
if(thdPopulateOSes != null) if(thdPopulateApps != null)
{ {
thdPopulateOSes.Abort(); thdPopulateApps.Abort();
thdPopulateOSes = null; thdPopulateApps = null;
} }
if(thdCompressTo != null) if(thdCompressTo != null)
{ {
thdPopulateOSes.Abort(); thdPopulateApps.Abort();
thdPopulateOSes = null; thdPopulateApps = null;
} }
if(thdSaveAs == null) return; if(thdSaveAs == null) return;
@@ -494,20 +494,20 @@ namespace apprepodbmgr.Eto
protected void OnBtnCompressClicked(object sender, EventArgs e) protected void OnBtnCompressClicked(object sender, EventArgs e)
{ {
if(treeOSes.SelectedItem == null) return; if(treeApps.SelectedItem == null) return;
SaveFileDialog dlgFile = new SaveFileDialog {Title = "Compress to..."}; SaveFileDialog dlgFile = new SaveFileDialog {Title = "Compress to..."};
if(dlgFile.ShowDialog(this) != DialogResult.Ok) return; if(dlgFile.ShowDialog(this) != DialogResult.Ok) return;
Context.DbInfo.Id = ((DBEntryForEto)treeOSes.SelectedItem).id; Context.DbInfo.Id = ((DBEntryForEto)treeApps.SelectedItem).id;
Context.Path = dlgFile.FileName; Context.Path = dlgFile.FileName;
lblProgress.Visible = true; lblProgress.Visible = true;
prgProgress.Visible = true; prgProgress.Visible = true;
lblProgress2.Visible = true; lblProgress2.Visible = true;
prgProgress2.Visible = true; prgProgress2.Visible = true;
treeOSes.Enabled = false; treeApps.Enabled = false;
btnAdd.Visible = false; btnAdd.Visible = false;
btnRemove.Visible = false; btnRemove.Visible = false;
btnCompress.Visible = false; btnCompress.Visible = false;
@@ -533,7 +533,7 @@ namespace apprepodbmgr.Eto
lblProgress2.Visible = false; lblProgress2.Visible = false;
prgProgress.Visible = false; prgProgress.Visible = false;
prgProgress2.Visible = false; prgProgress2.Visible = false;
treeOSes.Enabled = true; treeApps.Enabled = true;
btnAdd.Visible = true; btnAdd.Visible = true;
btnRemove.Visible = true; btnRemove.Visible = true;
btnCompress.Visible = Context.UsableDotNetZip; btnCompress.Visible = Context.UsableDotNetZip;
@@ -565,7 +565,7 @@ namespace apprepodbmgr.Eto
lblProgress2.Visible = false; lblProgress2.Visible = false;
prgProgress.Visible = false; prgProgress.Visible = false;
prgProgress2.Visible = false; prgProgress2.Visible = false;
treeOSes.Enabled = true; treeApps.Enabled = true;
btnAdd.Visible = true; btnAdd.Visible = true;
btnRemove.Visible = true; btnRemove.Visible = true;
btnCompress.Visible = Context.UsableDotNetZip; btnCompress.Visible = Context.UsableDotNetZip;
@@ -794,7 +794,7 @@ namespace apprepodbmgr.Eto
protected void OnBtnPopulateFilesClicked(object sender, EventArgs e) protected void OnBtnPopulateFilesClicked(object sender, EventArgs e)
{ {
lstFiles.Clear(); lstFiles.Clear();
tabOSes.Enabled = false; tabApps.Enabled = false;
btnStopFiles.Visible = true; btnStopFiles.Visible = true;
btnPopulateFiles.Visible = false; btnPopulateFiles.Visible = false;
@@ -908,7 +908,7 @@ namespace apprepodbmgr.Eto
thdPopulateFiles = null; thdPopulateFiles = null;
} }
tabOSes.Enabled = true; tabApps.Enabled = true;
lstFiles.Clear(); lstFiles.Clear();
btnStopFiles.Visible = false; btnStopFiles.Visible = false;
btnPopulateFiles.Visible = true; btnPopulateFiles.Visible = true;
@@ -941,7 +941,7 @@ namespace apprepodbmgr.Eto
btnPopulateFiles.Visible = false; btnPopulateFiles.Visible = false;
populatingFiles = false; populatingFiles = false;
treeFiles.Enabled = true; treeFiles.Enabled = true;
tabOSes.Enabled = true; tabApps.Enabled = true;
btnScanAllPending.Visible = true; btnScanAllPending.Visible = true;
btnCleanFiles.Visible = true; btnCleanFiles.Visible = true;
lblFileStatus.Visible = true; lblFileStatus.Visible = true;
@@ -1012,7 +1012,7 @@ namespace apprepodbmgr.Eto
protected void OnBtnCleanFilesClicked(object sender, EventArgs e) protected void OnBtnCleanFilesClicked(object sender, EventArgs e)
{ {
DialogResult result = DialogResult result =
MessageBox.Show("This option will search the database for any known file that doesn't\n" + "belong to any OS and remove it from the database.\n\n" + "It will then search the repository for any file not on the database and remove it.\n\n" + "THIS OPERATION MAY VERY LONG, CANNOT BE CANCELED AND REMOVES DATA ON DISK.\n\n" + "Are you sure to continue?", MessageBox.Show("This option will search the database for any known file that doesn't\n" + "belong to any application and remove it from the database.\n\n" + "It will then search the repository for any file not on the database and remove it.\n\n" + "THIS OPERATION MAY VERY LONG, CANNOT BE CANCELED AND REMOVES DATA ON DISK.\n\n" + "Are you sure to continue?",
MessageBoxButtons.YesNo, MessageBoxType.Question); MessageBoxButtons.YesNo, MessageBoxType.Question);
if(result != DialogResult.Yes) return; if(result != DialogResult.Yes) return;
@@ -1021,7 +1021,7 @@ namespace apprepodbmgr.Eto
btnScanWithClamd.Visible = false; btnScanWithClamd.Visible = false;
btnScanAllPending.Visible = false; btnScanAllPending.Visible = false;
btnCheckInVirusTotal.Visible = false; btnCheckInVirusTotal.Visible = false;
tabOSes.Enabled = false; tabApps.Enabled = false;
treeFiles.Enabled = false; treeFiles.Enabled = false;
lblProgressFiles1.Visible = true; lblProgressFiles1.Visible = true;
lblProgressFiles2.Visible = true; lblProgressFiles2.Visible = true;
@@ -1052,7 +1052,7 @@ namespace apprepodbmgr.Eto
btnScanWithClamd.Visible = true; btnScanWithClamd.Visible = true;
btnScanAllPending.Visible = true; btnScanAllPending.Visible = true;
btnCheckInVirusTotal.Visible = true; btnCheckInVirusTotal.Visible = true;
tabOSes.Enabled = true; tabApps.Enabled = true;
treeFiles.Enabled = true; treeFiles.Enabled = true;
Workers.Finished -= CleanFilesFinished; Workers.Finished -= CleanFilesFinished;
Workers.UpdateProgress -= UpdateFileProgress; Workers.UpdateProgress -= UpdateFileProgress;
@@ -1074,7 +1074,7 @@ namespace apprepodbmgr.Eto
#region XAML UI elements #region XAML UI elements
#pragma warning disable 0649 #pragma warning disable 0649
GridView treeOSes; GridView treeApps;
Label lblProgress; Label lblProgress;
ProgressBar prgProgress; ProgressBar prgProgress;
Label lblProgress2; Label lblProgress2;
@@ -1097,12 +1097,12 @@ namespace apprepodbmgr.Eto
Button btnScanWithClamd; Button btnScanWithClamd;
Button btnCheckInVirusTotal; Button btnCheckInVirusTotal;
Button btnPopulateFiles; Button btnPopulateFiles;
TabPage tabOSes; TabPage tabApps;
Button btnScanAllPending; Button btnScanAllPending;
Button btnCleanFiles; Button btnCleanFiles;
ButtonMenuItem btnQuit; ButtonMenuItem btnQuit;
ButtonMenuItem mnuFile; ButtonMenuItem mnuFile;
Label lblOSStatus; Label lblAppStatus;
Label lblFileStatus; Label lblFileStatus;
#pragma warning restore 0649 #pragma warning restore 0649
#endregion XAML UI elements #endregion XAML UI elements