This commit is contained in:
2018-02-23 03:42:57 +00:00
parent 46e86ef1b2
commit cc26497093
13 changed files with 83 additions and 80 deletions

View File

@@ -37,29 +37,29 @@ namespace apprepodbmgr.Core
{ {
public delegate void UnarChangeStatusDelegate(); public delegate void UnarChangeStatusDelegate();
public static List<string> Files; public static List<string> Files;
public static List<string> Folders; public static List<string> Folders;
public static List<string> Symlinks; public static List<string> Symlinks;
public static Dictionary<string, DbAppFile> Hashes; public static Dictionary<string, DbAppFile> Hashes;
public static Dictionary<string, DbFolder> FoldersDict; public static Dictionary<string, DbFolder> FoldersDict;
public static Dictionary<string, string> SymlinksDict; public static Dictionary<string, string> SymlinksDict;
public static string Path; public static string Path;
public static DbEntry DbInfo; public static DbEntry DbInfo;
public static bool UnarUsable; public static bool UnarUsable;
public static string TmpFolder; public static string TmpFolder;
public static long NoFilesInArchive; public static long NoFilesInArchive;
public static string ArchiveFormat; public static string ArchiveFormat;
public static Process UnarProcess; public static Process UnarProcess;
public static bool UnzipWithUnAr; public static bool UnzipWithUnAr;
public static string SelectedFile; public static string SelectedFile;
public static OpticalDiscType WorkingDisc; public static OpticalDiscType WorkingDisc;
public static BlockMediaType WorkingDisk; public static BlockMediaType WorkingDisk;
public static CICMMetadataType Metadata; public static CICMMetadataType Metadata;
public static bool UserExtracting; public static bool UserExtracting;
public static bool UsableDotNetZip; public static bool UsableDotNetZip;
public static string ClamdVersion; public static string ClamdVersion;
public static bool VirusTotalEnabled; public static bool VirusTotalEnabled;
public static event UnarChangeStatusDelegate UnarChangeStatus; public static event UnarChangeStatusDelegate UnarChangeStatus;
public static void CheckUnar() public static void CheckUnar()
{ {

View File

@@ -889,10 +889,10 @@ namespace apprepodbmgr.Core
dbcmd.Transaction = trans; dbcmd.Transaction = trans;
dbcmd.CommandText = dbcmd.CommandText =
$"DROP TABLE IF EXISTS `app_{id}_symlinks`;\n\n" + $"DROP TABLE IF EXISTS `app_{id}_symlinks`;\n\n" +
$"CREATE TABLE IF NOT EXISTS `app_{id}_symlinks` (\n" + $"CREATE TABLE IF NOT EXISTS `app_{id}_symlinks` (\n" +
" `path` VARCHAR(8192) PRIMARY KEY,\n" + " `path` VARCHAR(8192) PRIMARY KEY,\n" +
" `target` VARCHAR(8192) NOT NULL);\n\n" + " `target` VARCHAR(8192) NOT NULL);\n\n" +
$"CREATE UNIQUE INDEX `app_{id}_symlinks_path_UNIQUE` ON `app_{id}_symlinks` (`path` ASC);\n\n" + $"CREATE UNIQUE INDEX `app_{id}_symlinks_path_UNIQUE` ON `app_{id}_symlinks` (`path` ASC);\n\n" +
$"CREATE INDEX `app_{id}_symlinks_target_idx` ON `app_{id}_symlinks` (`target` ASC);"; $"CREATE INDEX `app_{id}_symlinks_target_idx` ON `app_{id}_symlinks` (`target` ASC);";

View File

@@ -60,7 +60,7 @@ namespace apprepodbmgr.Core
} }
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
catch { } catch { }
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
// Check only RAW plugin // Check only RAW plugin
if(imageFormat != null) return imageFormat; if(imageFormat != null) return imageFormat;
@@ -77,7 +77,7 @@ namespace apprepodbmgr.Core
} }
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
catch { } catch { }
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
// Still not recognized // Still not recognized

View File

@@ -64,7 +64,7 @@ namespace DiscImageChef.Interop
{ {
#if __ANDROID__ #if __ANDROID__
return PlatformID.Android; return PlatformID.Android;
#else #else
return PlatformID.Linux; return PlatformID.Linux;
#endif #endif
} }

View File

@@ -25,8 +25,8 @@
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes. // Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project. // Change them to the values specific to your project.

View File

@@ -173,7 +173,7 @@ namespace apprepodbmgr.Core
break; break;
} }
long totalSize = 0, currentSize = 0; long totalSize = 0, currentSize = 0;
foreach(KeyValuePair<string, DbAppFile> file in Context.Hashes) totalSize += file.Value.Length; foreach(KeyValuePair<string, DbAppFile> file in Context.Hashes) totalSize += file.Value.Length;
#if DEBUG #if DEBUG

View File

@@ -111,7 +111,7 @@ namespace apprepodbmgr.Core
UpdateProgress?.Invoke(null, "Checking files in database", counter, Context.Hashes.Count); UpdateProgress?.Invoke(null, "Checking files in database", counter, Context.Hashes.Count);
AddFileForApp?.Invoke(kvp.Key, kvp.Value.Sha256, dbCore.DbOps.ExistsFile(kvp.Value.Sha256), AddFileForApp?.Invoke(kvp.Key, kvp.Value.Sha256, dbCore.DbOps.ExistsFile(kvp.Value.Sha256),
kvp.Value.Crack); kvp.Value.Crack);
if(dbCore.DbOps.ExistsFile(kvp.Value.Sha256)) if(dbCore.DbOps.ExistsFile(kvp.Value.Sha256))
{ {
@@ -246,7 +246,8 @@ namespace apprepodbmgr.Core
counter = 0; counter = 0;
foreach(KeyValuePair<string, DbAppFile> kvp in Context.Hashes) foreach(KeyValuePair<string, DbAppFile> kvp in Context.Hashes)
{ {
UpdateProgress?.Invoke(null, "Adding files to application in database", counter, Context.Hashes.Count); UpdateProgress?.Invoke(null, "Adding files to application in database", counter,
Context.Hashes.Count);
dbCore.DbOps.AddFileToApp(kvp.Value, Context.DbInfo.Id); dbCore.DbOps.AddFileToApp(kvp.Value, Context.DbInfo.Id);

View File

@@ -32,14 +32,14 @@ namespace apprepodbmgr.Core
{ {
public static partial class Workers public static partial class Workers
{ {
public delegate void AddAppDelegate(DbEntry os);
public delegate void AddFileDelegate(DbFile file); public delegate void AddFileDelegate(DbFile file);
public delegate void AddFileForAppDelegate(string filename, string hash, bool known, bool isCrack); public delegate void AddFileForAppDelegate(string filename, string hash, bool known, bool isCrack);
public delegate void AddFilesDelegate(List<DbFile> file); public delegate void AddFilesDelegate(List<DbFile> file);
public delegate void AddAppDelegate(DbEntry os);
public delegate void FailedDelegate(string text); public delegate void FailedDelegate(string text);
public delegate void FinishedWithoutErrorDelegate(); public delegate void FinishedWithoutErrorDelegate();
@@ -57,8 +57,8 @@ namespace apprepodbmgr.Core
public static event FailedDelegate Failed; public static event FailedDelegate Failed;
public static event FinishedWithoutErrorDelegate Finished; public static event FinishedWithoutErrorDelegate Finished;
public static event FinishedWithTextDelegate FinishedWithText; public static event FinishedWithTextDelegate FinishedWithText;
public static event AddFileForAppDelegate AddFileForApp; public static event AddFileForAppDelegate AddFileForApp;
public static event AddAppDelegate AddApp; public static event AddAppDelegate AddApp;
public static event AddFileDelegate AddFile; public static event AddFileDelegate AddFile;
public static event AddFilesDelegate AddFiles; public static event AddFilesDelegate AddFiles;
public static event ScanFinishedDelegate ScanFinished; public static event ScanFinishedDelegate ScanFinished;

View File

@@ -25,6 +25,7 @@
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
using System; using System;
using apprepodbmgr.Core; using apprepodbmgr.Core;
using Eto; using Eto;
@@ -41,11 +42,11 @@ namespace apprepodbmgr.Eto.Desktop
Context.CheckUnar(); Context.CheckUnar();
if(Settings.Current.UseAntivirus) if(Settings.Current.UseAntivirus)
{ {
if(Settings.Current.UseClamd) if(Settings.Current.UseClamd) Workers.InitClamd();
Workers.InitClamd();
if(Settings.Current.UseVirusTotal) if(Settings.Current.UseVirusTotal)
Context.VirusTotalEnabled = Workers.InitVirusTotal(Settings.Current.VirusTotalKey); Context.VirusTotalEnabled = Workers.InitVirusTotal(Settings.Current.VirusTotalKey);
} }
Context.UsableDotNetZip = !Platform.Detect.IsMac && !Platform.Detect.IsIos; Context.UsableDotNetZip = !Platform.Detect.IsMac && !Platform.Detect.IsIos;
new Application(Platform.Detect).Run(new frmMain()); new Application(Platform.Detect).Run(new frmMain());

View File

@@ -25,8 +25,8 @@
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes. // Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project. // Change them to the values specific to your project.

View File

@@ -25,8 +25,8 @@
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes. // Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project. // Change them to the values specific to your project.

View File

@@ -46,18 +46,19 @@ namespace apprepodbmgr.Eto
{ {
public delegate void OnAddedAppDelegate(DbEntry app); public delegate void OnAddedAppDelegate(DbEntry app);
ObservableCollection<FileEntry> fileView;
int knownFiles;
ObservableCollection<DBEntryForEto> appView; ObservableCollection<DBEntryForEto> appView;
bool stopped;
Thread thdAddFiles; ObservableCollection<FileEntry> fileView;
Thread thdCheckFiles; int knownFiles;
Thread thdExtractArchive; bool stopped;
Thread thdFindFiles; Thread thdAddFiles;
Thread thdHashFiles; Thread thdCheckFiles;
Thread thdOpenArchive; Thread thdExtractArchive;
Thread thdPackFiles; Thread thdFindFiles;
Thread thdRemoveTemp; Thread thdHashFiles;
Thread thdOpenArchive;
Thread thdPackFiles;
Thread thdRemoveTemp;
public dlgAdd() public dlgAdd()
{ {
@@ -293,8 +294,8 @@ namespace apprepodbmgr.Eto
Workers.Finished += ChkFilesFinished; Workers.Finished += ChkFilesFinished;
Workers.UpdateProgress += UpdateProgress; Workers.UpdateProgress += UpdateProgress;
Workers.UpdateProgress2 += UpdateProgress2; Workers.UpdateProgress2 += UpdateProgress2;
Workers.AddFileForApp += AddFile; Workers.AddFileForApp += AddFile;
Workers.AddApp += AddApp; Workers.AddApp += AddApp;
thdCheckFiles.Start(); thdCheckFiles.Start();
}); });
} }
@@ -312,8 +313,8 @@ namespace apprepodbmgr.Eto
Workers.Finished -= ChkFilesFinished; Workers.Finished -= ChkFilesFinished;
Workers.UpdateProgress -= UpdateProgress; Workers.UpdateProgress -= UpdateProgress;
Workers.UpdateProgress2 -= UpdateProgress2; Workers.UpdateProgress2 -= UpdateProgress2;
Workers.AddFileForApp -= AddFile; Workers.AddFileForApp -= AddFile;
Workers.AddApp -= AddApp; Workers.AddApp -= AddApp;
thdCheckFiles?.Abort(); thdCheckFiles?.Abort();
thdHashFiles = null; thdHashFiles = null;
fileView?.Clear(); fileView?.Clear();
@@ -332,8 +333,8 @@ namespace apprepodbmgr.Eto
Workers.Finished -= ChkFilesFinished; Workers.Finished -= ChkFilesFinished;
Workers.UpdateProgress -= UpdateProgress; Workers.UpdateProgress -= UpdateProgress;
Workers.UpdateProgress2 -= UpdateProgress2; Workers.UpdateProgress2 -= UpdateProgress2;
Workers.AddFileForApp -= AddFile; Workers.AddFileForApp -= AddFile;
Workers.AddApp -= AddApp; Workers.AddApp -= AddApp;
thdCheckFiles?.Abort(); thdCheckFiles?.Abort();
@@ -560,8 +561,8 @@ namespace apprepodbmgr.Eto
{ {
stopped = true; stopped = true;
Workers.AddFileForApp -= AddFile; Workers.AddFileForApp -= AddFile;
Workers.AddApp -= AddApp; Workers.AddApp -= AddApp;
Workers.Failed -= AddFilesToDbFailed; Workers.Failed -= AddFilesToDbFailed;
Workers.Failed -= ChkFilesFailed; Workers.Failed -= ChkFilesFailed;
Workers.Failed -= ExtractArchiveFailed; Workers.Failed -= ExtractArchiveFailed;

View File

@@ -39,17 +39,17 @@ namespace apprepodbmgr.Eto
{ {
public class frmMain : Form public class frmMain : Form
{ {
int infectedFiles; int infectedFiles;
ObservableCollection<DbFile> lstFiles;
ObservableCollection<DBEntryForEto> lstApps; ObservableCollection<DBEntryForEto> lstApps;
ObservableCollection<DbFile> lstFiles;
DbFile outIter; DbFile outIter;
bool populatingFiles; bool populatingFiles;
bool scanningFiles; bool scanningFiles;
Thread thdCleanFiles; Thread thdCleanFiles;
Thread thdCompressTo; Thread thdCompressTo;
Thread thdPopulateFiles;
Thread thdPopulateApps; Thread thdPopulateApps;
Thread thdPopulateFiles;
Thread thdSaveAs; Thread thdSaveAs;
Thread thdScanFile; Thread thdScanFile;
@@ -209,7 +209,7 @@ namespace apprepodbmgr.Eto
Workers.Failed += LoadAppsFailed; Workers.Failed += LoadAppsFailed;
Workers.Finished += LoadAppsFinished; Workers.Finished += LoadAppsFinished;
Workers.UpdateProgress += UpdateProgress; Workers.UpdateProgress += UpdateProgress;
Workers.AddApp += AddApp; Workers.AddApp += AddApp;
Workers.AddFile += AddFile; Workers.AddFile += AddFile;
Workers.AddFiles += AddFiles; Workers.AddFiles += AddFiles;
thdPopulateApps = new Thread(Workers.GetAllApps); thdPopulateApps = new Thread(Workers.GetAllApps);
@@ -242,22 +242,22 @@ namespace apprepodbmgr.Eto
Workers.Failed -= LoadAppsFailed; Workers.Failed -= LoadAppsFailed;
Workers.Finished -= LoadAppsFinished; Workers.Finished -= LoadAppsFinished;
Workers.UpdateProgress -= UpdateProgress; Workers.UpdateProgress -= UpdateProgress;
Workers.AddApp -= AddApp; Workers.AddApp -= AddApp;
if(thdPopulateApps != null) if(thdPopulateApps != null)
{ {
thdPopulateApps.Abort(); thdPopulateApps.Abort();
thdPopulateApps = null; thdPopulateApps = null;
} }
lblProgress.Visible = false; lblProgress.Visible = false;
prgProgress.Visible = false; prgProgress.Visible = false;
treeApps.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;
lblAppStatus.Visible = true; lblAppStatus.Visible = true;
lblAppStatus.Text = $"{lstApps.Count} applications"; lblAppStatus.Text = $"{lstApps.Count} applications";
}); });
@@ -326,7 +326,7 @@ namespace apprepodbmgr.Eto
protected void OnBtnAddClicked(object sender, EventArgs e) protected void OnBtnAddClicked(object sender, EventArgs e)
{ {
dlgAdd dlgAdd = new dlgAdd(); dlgAdd dlgAdd = new dlgAdd();
dlgAdd.OnAddedApp += app => { lstApps.Add(new DBEntryForEto(app)); }; dlgAdd.OnAddedApp += app => { lstApps.Add(new DBEntryForEto(app)); };
dlgAdd.ShowModal(this); dlgAdd.ShowModal(this);
} }
@@ -459,7 +459,7 @@ namespace apprepodbmgr.Eto
protected void OnBtnStopClicked(object sender, EventArgs e) protected void OnBtnStopClicked(object sender, EventArgs e)
{ {
Workers.AddApp -= AddApp; Workers.AddApp -= AddApp;
Workers.Failed -= CompressToFailed; Workers.Failed -= CompressToFailed;
Workers.Failed -= LoadAppsFailed; Workers.Failed -= LoadAppsFailed;
Workers.Failed -= SaveAsFailed; Workers.Failed -= SaveAsFailed;