-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSplashForm.cs
More file actions
72 lines (62 loc) · 2.38 KB
/
SplashForm.cs
File metadata and controls
72 lines (62 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* Evrika: Splash form
* (c) 2019, Petros Kyladitis <http://www.multipetros.gr>
*
* This is free software distributed under the GNU GPL 3, for license details see at license.txt
* file, distributed with this program source, or see at <http://www.gnu.org/licenses/>
*/
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Resources;
using System.Globalization;
using System.Collections.Generic;
using System.IO;
using PInvoke;
using UsnJournal;
namespace Evrika{
public partial class SplashForm : Form{
//constant strings representing resources keys
private const string RES_LBL_TITLE = "LBL_TITLE" ;
private const string RES_LBL_JOB = "LBL_JOB" ;
//init vars
private ResourceManager resmgr ;
private CultureInfo ci ;
public SplashForm(CultureInfo ci){
// The InitializeComponent() call is required for Windows Forms designer support.
InitializeComponent();
resmgr = new ResourceManager(typeof(SplashForm)) ;
this.ci = ci ;
LoadRes() ;
}
private string GetRes(string key){
return resmgr.GetString(key, ci) ;
}
private void LoadRes(){
labelJob.Text = GetRes(RES_LBL_JOB) ;
labelTitle.Text = GetRes(RES_LBL_TITLE) ;
}
void SplashFormLoad(object sender, EventArgs e){
backgroundWorkerPreload.RunWorkerAsync() ;
}
void BackgroundWorkerPreloadDoWork(object sender, System.ComponentModel.DoWorkEventArgs e){
string appExe = Path.GetFileName(Application.ExecutablePath) ;
string drive = null ;
try{
foreach(DriveInfo dInf in DriveInfo.GetDrives()){
if(dInf.IsReady && dInf.DriveFormat == "NTFS"){
drive = dInf.Name.Substring(0, 1) ;
break ;
}
}
//List<NtfsWinApi.UsnEntry> usnList = new List<NtfsWinApi.UsnEntry>() ;
UsnJournal.FileSet[] results ;
NtfsUsnJournal ntfs = new NtfsUsnJournal(new DriveInfo(drive)) ;
//NtfsUsnJournal.UsnJournalReturnCode code = ntfs.GetFilesMatchingName(out results, appExe, NtfsUsnJournal.SearchType.FILES_ONLY, true) ;
NtfsUsnJournal.UsnJournalReturnCode code = ntfs.GetFilesMatchingName(out results, appExe, NtfsUsnJournal.SearchType.FILES_ONLY, NtfsUsnJournal.ComparisonType.EXACT_MATCH) ;
}catch(Exception){}
}
void BackgroundWorkerPreloadRunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e){
Close() ;
}
}
}