Exemplo n.º 1
0
 private void LoadScanFolders()
 {
     lstScanFolders.Items.Clear();
     foreach (var s in SqliteConnector.GetScanFolders())
     {
         lstScanFolders.Items.Add(s);
     }
 }
Exemplo n.º 2
0
        private void LoadBasicInfo()
        {
            _hashes = new HashSet<string>();

            //Scanfolders ophalen
            _folders = SqliteConnector.GetScanFolders();
            var files = new HashSet<string>();
            var listViewGroups = new HashSet<string>();

            foreach (var folder in _folders)
            {
                if (Directory.Exists(folder))
                {
                    if (_groupResults)
                    {
                        listViewGroups.Add(folder);
                    }

                    var filesInFolder = Directory.GetFiles(folder, "*.apk", SearchOption.AllDirectories);

                    foreach (var file in filesInFolder)
                    {
                        files.Add(file);
                        if (_groupResults && _newGroupSub)
                        {
                            listViewGroups.Add(Path.GetDirectoryName(file));
                        }
                    }
                }
            }

            if (_groupResults)
            {
                lvMain.Invoke(new AppendGroupsDelegate(AppendGroups), listViewGroups);
            }

#if (DEBUG)
            foreach (var apk in files)
#endif
#if (!DEBUG)
            Parallel.ForEach(files, (apk) =>
#endif
            {
                var apkFile = new ApkFile {LongFileName = apk};
                var lvi = new ListViewItem(apkFile.ShortFileName);

                //Read APK
                apkFile = SqliteConnector.ReadApkFile(apkFile);

                //Add hash to hashset
                _hashes.Add(apkFile.Md5Hash);

                //Package
                lvi.SubItems.Add(apkFile.PackageName);

                //Name
                lvi.SubItems.Add(apkFile.InternalName);

                //Google Play Name (Loaded from Google Play Page)
                lvi.SubItems.Add(apkFile.GooglePlayName);

                //Category (Loaded from Google Play Page)
                lvi.SubItems.Add(apkFile.Category);

                //Local Version
                lvi.SubItems.Add(apkFile.LocalVersion);

                //Latest Version (Loaded from Google Play Page)
                lvi.SubItems.Add(apkFile.LatestVersion);

                //Price (Loaded from Google Play Page)
                lvi.SubItems.Add(apkFile.Price);

                //Refresh date
                if (apkFile.LastGooglePlayFetch.HasValue)
                {
                    lvi.SubItems.Add(apkFile.LastGooglePlayFetch.Value.ToRelativeTimeString());
                }
                else
                {
                    lvi.SubItems.Add("never");
                }

                //Refresh
                //lvi.UseItemStyleForSubItems = false;
                lvi.SubItems.Add(string.Empty);

                //Set ListViewItem Tag to ApkFile object
                lvi.Tag = apkFile;

                SetColorsForListViewItem(lvi);

                //Add listitem
                lvMain.Invoke(new AppendResultDelegate(AppendResult), lvi);
#if (DEBUG)
            }
#endif
#if (!DEBUG)
            });
#endif
        }