mirror of
https://github.com/claunia/osrepodbmgr.git
synced 2025-12-16 19:14:25 +00:00
Added support for marking/unmarking/detecting cracks.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2017-05-18 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* DBOps.cs:
|
||||
* Workers.cs:
|
||||
Added support for marking/unmarking/detecting cracks.
|
||||
|
||||
2017-05-18 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Workers.cs:
|
||||
|
||||
@@ -76,6 +76,7 @@ namespace osrepodbmgr.Core
|
||||
public DateTime LastAccessTimeUtc;
|
||||
public DateTime LastWriteTimeUtc;
|
||||
public FileAttributes Attributes;
|
||||
public bool Crack;
|
||||
}
|
||||
|
||||
public struct DBFolder
|
||||
@@ -371,7 +372,7 @@ namespace osrepodbmgr.Core
|
||||
{
|
||||
entries = new List<DBFile>();
|
||||
|
||||
string sql = string.Format("SELECT * FROM files ORDER BY id LIMIT {0}, {1}", start, count);
|
||||
string sql = string.Format("SELECT * FROM files ORDER BY sha256 LIMIT {0}, {1}", start, count);
|
||||
|
||||
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||
@@ -728,6 +729,29 @@ namespace osrepodbmgr.Core
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ToggleCrack(string hash, bool crack)
|
||||
{
|
||||
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||
IDbTransaction trans = dbCon.BeginTransaction();
|
||||
IDbDataParameter param1 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param2 = dbcmd.CreateParameter();
|
||||
|
||||
param1.ParameterName = "@hash";
|
||||
param1.DbType = DbType.String;
|
||||
param1.Value = hash;
|
||||
param2.ParameterName = "@crack";
|
||||
param2.DbType = DbType.Boolean;
|
||||
param2.Value = crack;
|
||||
dbcmd.Parameters.Add(param1);
|
||||
dbcmd.Parameters.Add(param2);
|
||||
dbcmd.CommandText = "UPDATE files SET crack = @crack WHERE sha256 = @hash";
|
||||
dbcmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
dbcmd.Dispose();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace osrepodbmgr.Core
|
||||
public delegate void FailedDelegate(string text);
|
||||
public delegate void FinishedWithoutErrorDelegate();
|
||||
public delegate void FinishedWithTextDelegate(string text);
|
||||
public delegate void AddFileForOSDelegate(string filename, string hash, bool known);
|
||||
public delegate void AddFileForOSDelegate(string filename, string hash, bool known, bool isCrack);
|
||||
public delegate void AddOSDelegate(DBEntry os, bool existsInRepo, string pathInRepo);
|
||||
public delegate void AddFileDelegate(DBFile file);
|
||||
public delegate void AddFilesDelegate(List<DBFile> file);
|
||||
@@ -401,6 +401,11 @@ public static event AddFilesDelegate AddFiles;
|
||||
dbFile.Path = relpath;
|
||||
dbFile.Sha256 = hash;
|
||||
|
||||
// TODO: Add common cracker group names?
|
||||
dbFile.Crack |= (relpath.ToLowerInvariant().Contains("crack") || // Typical crack
|
||||
relpath.ToLowerInvariant().Contains("crack") || // Typical keygen
|
||||
relpath.ToLowerInvariant().Contains("[k]"));
|
||||
|
||||
Context.hashes.Add(relpath, dbFile);
|
||||
counter++;
|
||||
}
|
||||
@@ -543,7 +548,7 @@ public static event AddFilesDelegate AddFiles;
|
||||
UpdateProgress(null, "Checking files in database", counter, Context.hashes.Count);
|
||||
|
||||
if(AddFileForOS != null)
|
||||
AddFileForOS(kvp.Key, kvp.Value.Sha256, dbCore.DBOps.ExistsFile(kvp.Value.Sha256));
|
||||
AddFileForOS(kvp.Key, kvp.Value.Sha256, dbCore.DBOps.ExistsFile(kvp.Value.Sha256), kvp.Value.Crack);
|
||||
|
||||
counter++;
|
||||
}
|
||||
@@ -627,7 +632,7 @@ public static event AddFilesDelegate AddFiles;
|
||||
{
|
||||
DBFile file = new DBFile
|
||||
{
|
||||
Sha256 = kvp.Value.Sha256, ClamTime = null, Crack = false,
|
||||
Sha256 = kvp.Value.Sha256, ClamTime = null, Crack = kvp.Value.Crack,
|
||||
Length = kvp.Value.Length, Virus = null, HasVirus = null, VirusTotalTime = null
|
||||
};
|
||||
dbCore.DBOps.AddFile(file);
|
||||
@@ -1841,5 +1846,23 @@ public static event AddFilesDelegate AddFiles;
|
||||
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ToggleCrack(string hash, bool crack)
|
||||
{
|
||||
try
|
||||
{
|
||||
dbCore.DBOps.ToggleCrack(hash, crack);
|
||||
|
||||
if(Finished != null)
|
||||
Finished();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
if(Debugger.IsAttached)
|
||||
throw;
|
||||
if(Failed != null)
|
||||
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
2017-05-18 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* dlgAdd.xeto:
|
||||
* frmMain.xeto:
|
||||
* dlgAdd.xeto.cs:
|
||||
* frmMain.xeto.cs:
|
||||
Added support for marking/unmarking/detecting cracks.
|
||||
|
||||
2017-05-18 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* frmMain.xeto:
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<TabControl>
|
||||
<TabPage Text="Files">
|
||||
<GridView ID="treeFiles" />
|
||||
<GridView ID="treeFiles" SelectionChanged="treeFilesSelectionChanged"/>
|
||||
</TabPage>
|
||||
<TabPage Text="OSes" ID="tabOSes" Visible="False">
|
||||
<GridView ID="treeOSes" />
|
||||
@@ -126,6 +126,9 @@
|
||||
<StackLayoutItem HorizontalAlignment="Left">
|
||||
<Button ID="btnRemoveFile" Click="OnBtnRemoveFileClicked" Visible="False">Remove</Button>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Left">
|
||||
<Button ID="btnToggleCrack" Click="OnBtnToggleCrackClicked" Visible="False">Mark as crack</Button>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Left">
|
||||
<Button ID="btnMetadata" Click="OnBtnMetadataClicked" Visible="False">Metadata</Button>
|
||||
</StackLayoutItem>
|
||||
|
||||
@@ -60,6 +60,7 @@ namespace osrepodbmgr.Eto
|
||||
public string path { get; set; }
|
||||
public string hash { get; set; }
|
||||
public bool known { get; set; }
|
||||
public bool iscrack { get; set; }
|
||||
}
|
||||
|
||||
#region XAML UI elements
|
||||
@@ -93,6 +94,7 @@ namespace osrepodbmgr.Eto
|
||||
Button btnPack;
|
||||
Button btnClose;
|
||||
Button btnExit;
|
||||
Button btnToggleCrack;
|
||||
#pragma warning restore 0649
|
||||
#endregion XAML UI elements
|
||||
|
||||
@@ -116,6 +118,11 @@ namespace osrepodbmgr.Eto
|
||||
HeaderText = "Path"
|
||||
});
|
||||
treeFiles.Columns.Add(new GridColumn
|
||||
{
|
||||
DataCell = new CheckBoxCell { Binding = Binding.Property<FileEntry, bool?>(r => r.iscrack) },
|
||||
HeaderText = "Crack?"
|
||||
});
|
||||
treeFiles.Columns.Add(new GridColumn
|
||||
{
|
||||
DataCell = new TextBoxCell { Binding = Binding.Property<FileEntry, string>(r => r.hash) },
|
||||
HeaderText = "SHA256"
|
||||
@@ -394,6 +401,7 @@ namespace osrepodbmgr.Eto
|
||||
btnPack.Visible = true;
|
||||
btnPack.Enabled = true;
|
||||
btnRemoveFile.Visible = true;
|
||||
btnToggleCrack.Visible = true;
|
||||
|
||||
txtFormat.ReadOnly = false;
|
||||
txtMachine.ReadOnly = false;
|
||||
@@ -465,11 +473,11 @@ namespace osrepodbmgr.Eto
|
||||
});
|
||||
}
|
||||
|
||||
void AddFile(string filename, string hash, bool known)
|
||||
void AddFile(string filename, string hash, bool known, bool isCrack)
|
||||
{
|
||||
Application.Instance.Invoke(delegate
|
||||
{
|
||||
fileView.Add(new FileEntry { path = filename, hash = hash, known = known });
|
||||
fileView.Add(new FileEntry { path = filename, hash = hash, known = known, iscrack = isCrack });
|
||||
btnPack.Enabled |= !known;
|
||||
});
|
||||
}
|
||||
@@ -502,6 +510,7 @@ namespace osrepodbmgr.Eto
|
||||
btnPack.Visible = false;
|
||||
btnClose.Visible = false;
|
||||
btnRemoveFile.Visible = false;
|
||||
btnToggleCrack.Visible = false;
|
||||
if(fileView != null)
|
||||
fileView.Clear();
|
||||
if(osView != null)
|
||||
@@ -750,6 +759,7 @@ namespace osrepodbmgr.Eto
|
||||
void AddToDatabase()
|
||||
{
|
||||
btnRemoveFile.Enabled = false;
|
||||
btnToggleCrack.Enabled = false;
|
||||
btnPack.Enabled = false;
|
||||
btnClose.Enabled = false;
|
||||
prgProgress.Visible = true;
|
||||
@@ -867,6 +877,7 @@ namespace osrepodbmgr.Eto
|
||||
protected void OnBtnPackClicked(object sender, EventArgs e)
|
||||
{
|
||||
btnRemoveFile.Enabled = false;
|
||||
btnToggleCrack.Enabled = false;
|
||||
btnPack.Enabled = false;
|
||||
btnClose.Enabled = false;
|
||||
prgProgress.Visible = true;
|
||||
@@ -948,6 +959,7 @@ namespace osrepodbmgr.Eto
|
||||
thdPackFiles.Abort();
|
||||
|
||||
btnRemoveFile.Enabled = true;
|
||||
btnToggleCrack.Enabled = true;
|
||||
btnPack.Enabled = true;
|
||||
btnClose.Enabled = true;
|
||||
prgProgress.Visible = false;
|
||||
@@ -1196,5 +1208,37 @@ namespace osrepodbmgr.Eto
|
||||
fileView.Remove((FileEntry)treeFiles.SelectedItem);
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnBtnToggleCrackClicked(object sender, EventArgs e)
|
||||
{
|
||||
if(treeFiles.SelectedItem != null)
|
||||
{
|
||||
string name = ((FileEntry)treeFiles.SelectedItem).path;
|
||||
bool known = ((FileEntry)treeFiles.SelectedItem).known;
|
||||
|
||||
DBOSFile osfile;
|
||||
|
||||
if(Context.hashes.TryGetValue(name, out osfile))
|
||||
{
|
||||
osfile.Crack = !osfile.Crack;
|
||||
Context.hashes.Remove(name);
|
||||
Context.hashes.Add(name, osfile);
|
||||
((FileEntry)treeFiles.SelectedItem).iscrack = osfile.Crack;
|
||||
fileView.Remove((FileEntry)treeFiles.SelectedItem);
|
||||
fileView.Add(new FileEntry { path = name, hash = osfile.Sha256, known = known, iscrack = osfile.Crack });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void treeFilesSelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(treeFiles.SelectedItem != null)
|
||||
{
|
||||
if(((FileEntry)treeFiles.SelectedItem).iscrack)
|
||||
btnToggleCrack.Text = "Mark as not crack";
|
||||
else
|
||||
btnToggleCrack.Text = "Mark as crack";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@
|
||||
<TabPage Text="Files" ID="tabFiles">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||
<GridView ID="treeFiles" Enabled="False" />
|
||||
<GridView ID="treeFiles" Enabled="False" SelectionChanged="treeFilesSelectionChanged"/>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||
<Label ID="lblProgressFiles1" Visible="False">lblProgress</Label>
|
||||
@@ -49,7 +49,7 @@
|
||||
<StackLayoutItem HorizontalAlignment="Center">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Button x:Name="btnStopFiles" Click="OnBtnStopFilesClicked" Visible="False">Stop</Button>
|
||||
<Button x:Name="btnMarkAsCrack" Click="OnBtnMarkAsCrackClicked" Visible="False">Mark as crack</Button>
|
||||
<Button x:Name="btnToggleCrack" Click="OnBtnToggleCrackClicked" Visible="False">Mark as crack</Button>
|
||||
<Button x:Name="btnScanWithClamd" Click="OnBtnScanWithClamdClicked" Visible="False">Scan with clamd</Button>
|
||||
<Button x:Name="btnCheckInVirusTotal" Click="OnBtnCheckInVirusTotalClicked" Visible="False">Check with VirusTotal</Button>
|
||||
<Button x:Name="btnPopulateFiles" Click="OnBtnPopulateFilesClicked">Populate</Button>
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace osrepodbmgr.Eto
|
||||
Label lblProgressFiles2;
|
||||
ProgressBar prgProgressFiles2;
|
||||
Button btnStopFiles;
|
||||
Button btnMarkAsCrack;
|
||||
Button btnToggleCrack;
|
||||
Button btnScanWithClamd;
|
||||
Button btnCheckInVirusTotal;
|
||||
Button btnPopulateFiles;
|
||||
@@ -620,8 +620,19 @@ namespace osrepodbmgr.Eto
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnBtnMarkAsCrackClicked(object sender, EventArgs e)
|
||||
protected void OnBtnToggleCrackClicked(object sender, EventArgs e)
|
||||
{
|
||||
if(treeFiles.SelectedItem != null)
|
||||
{
|
||||
DBFile file = (DBFile)treeFiles.SelectedItem;
|
||||
bool crack = !file.Crack;
|
||||
|
||||
Workers.ToggleCrack(file.Sha256, crack);
|
||||
|
||||
lstFiles.Remove(file);
|
||||
file.Crack = crack;
|
||||
lstFiles.Add(file);
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnBtnScanWithClamdClicked(object sender, EventArgs e)
|
||||
@@ -635,7 +646,6 @@ namespace osrepodbmgr.Eto
|
||||
protected void OnBtnPopulateFilesClicked(object sender, EventArgs e)
|
||||
{
|
||||
// TODO: Implement
|
||||
btnMarkAsCrack.Enabled = false;
|
||||
btnScanWithClamd.Enabled = false;
|
||||
btnCheckInVirusTotal.Enabled = false;
|
||||
|
||||
@@ -739,7 +749,7 @@ namespace osrepodbmgr.Eto
|
||||
lblProgressFiles2.Visible = false;
|
||||
prgProgressFiles1.Visible = false;
|
||||
prgProgressFiles2.Visible = false;
|
||||
btnMarkAsCrack.Visible = true;
|
||||
btnToggleCrack.Visible = true;
|
||||
btnScanWithClamd.Visible = true;
|
||||
btnCheckInVirusTotal.Visible = true;
|
||||
btnStopFiles.Visible = false;
|
||||
@@ -749,5 +759,16 @@ namespace osrepodbmgr.Eto
|
||||
tabOSes.Enabled = true;
|
||||
});
|
||||
}
|
||||
|
||||
void treeFilesSelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(treeFiles.SelectedItem != null)
|
||||
{
|
||||
if(((DBFile)treeFiles.SelectedItem).Crack)
|
||||
btnToggleCrack.Text = "Mark as not crack";
|
||||
else
|
||||
btnToggleCrack.Text = "Mark as crack";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2017-05-18 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* dlgAdd.cs:
|
||||
* frmMain.cs:
|
||||
* gtk-gui/dlgAdd.cs:
|
||||
* gtk-gui/gui.stetic:
|
||||
* gtk-gui/generated.cs:
|
||||
* gtk-gui/osrepodbmgr.frmMain.cs:
|
||||
Added support for marking/unmarking/detecting cracks.
|
||||
|
||||
2017-05-18 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* dlgAdd.cs:
|
||||
|
||||
@@ -62,17 +62,20 @@ public partial class dlgAdd : Dialog
|
||||
Context.CheckUnar();
|
||||
|
||||
CellRendererText filenameCell = new CellRendererText();
|
||||
CellRendererToggle crackCell = new CellRendererToggle();
|
||||
CellRendererText hashCell = new CellRendererText();
|
||||
CellRendererToggle dbCell = new CellRendererToggle();
|
||||
|
||||
TreeViewColumn filenameColumn = new TreeViewColumn("Path", filenameCell, "text", 0, "background", 3, "foreground", 4);
|
||||
TreeViewColumn crackColumn = new TreeViewColumn("Crack?", crackCell, "active", 5);
|
||||
TreeViewColumn hashColumn = new TreeViewColumn("SHA256", hashCell, "text", 1, "background", 3, "foreground", 4);
|
||||
TreeViewColumn dbColumn = new TreeViewColumn("Known?", dbCell, "active", 2);
|
||||
|
||||
fileView = new ListStore(typeof(string), typeof(string), typeof(bool), typeof(string), typeof(string));
|
||||
fileView = new ListStore(typeof(string), typeof(string), typeof(bool), typeof(string), typeof(string), typeof(bool));
|
||||
|
||||
treeFiles.Model = fileView;
|
||||
treeFiles.AppendColumn(filenameColumn);
|
||||
treeFiles.AppendColumn(crackColumn);
|
||||
treeFiles.AppendColumn(hashColumn);
|
||||
treeFiles.AppendColumn(dbColumn);
|
||||
|
||||
@@ -129,6 +132,8 @@ public partial class dlgAdd : Dialog
|
||||
treeOSes.AppendColumn(filesColumn);
|
||||
treeOSes.AppendColumn(netinstallColumn);
|
||||
treeOSes.AppendColumn(pathColumn);
|
||||
|
||||
treeFiles.Selection.Changed += treeFilesSelectionChanged;
|
||||
}
|
||||
|
||||
void UnarChangeStatus()
|
||||
@@ -353,6 +358,7 @@ public partial class dlgAdd : Dialog
|
||||
btnPack.Visible = true;
|
||||
btnPack.Sensitive = true;
|
||||
btnRemoveFile.Visible = true;
|
||||
btnToggleCrack.Visible = true;
|
||||
|
||||
txtFormat.IsEditable = true;
|
||||
txtMachine.IsEditable = true;
|
||||
@@ -424,12 +430,12 @@ public partial class dlgAdd : Dialog
|
||||
});
|
||||
}
|
||||
|
||||
void AddFile(string filename, string hash, bool known)
|
||||
void AddFile(string filename, string hash, bool known, bool isCrack)
|
||||
{
|
||||
Application.Invoke(delegate
|
||||
{
|
||||
string color = known ? "green" : "red";
|
||||
fileView.AppendValues(filename, hash, known, color, "black");
|
||||
fileView.AppendValues(filename, hash, known, color, "black", isCrack);
|
||||
btnPack.Sensitive |= !known;
|
||||
});
|
||||
}
|
||||
@@ -465,6 +471,7 @@ public partial class dlgAdd : Dialog
|
||||
btnPack.Visible = false;
|
||||
btnClose.Visible = false;
|
||||
btnRemoveFile.Visible = false;
|
||||
btnToggleCrack.Visible = false;
|
||||
if(fileView != null)
|
||||
fileView.Clear();
|
||||
if(osView != null)
|
||||
@@ -732,6 +739,7 @@ public partial class dlgAdd : Dialog
|
||||
void AddToDatabase()
|
||||
{
|
||||
btnRemoveFile.Sensitive = false;
|
||||
btnToggleCrack.Sensitive = false;
|
||||
btnPack.Sensitive = false;
|
||||
btnClose.Sensitive = false;
|
||||
prgProgress.Visible = true;
|
||||
@@ -856,6 +864,7 @@ public partial class dlgAdd : Dialog
|
||||
protected void OnBtnPackClicked(object sender, EventArgs e)
|
||||
{
|
||||
btnRemoveFile.Sensitive = false;
|
||||
btnToggleCrack.Sensitive = false;
|
||||
btnPack.Sensitive = false;
|
||||
btnClose.Sensitive = false;
|
||||
prgProgress.Visible = true;
|
||||
@@ -948,6 +957,7 @@ public partial class dlgAdd : Dialog
|
||||
thdPulseProgress.Abort();
|
||||
|
||||
btnRemoveFile.Sensitive = true;
|
||||
btnToggleCrack.Sensitive = true;
|
||||
btnPack.Sensitive = true;
|
||||
btnClose.Sensitive = true;
|
||||
prgProgress.Visible = false;
|
||||
@@ -1250,4 +1260,38 @@ public partial class dlgAdd : Dialog
|
||||
fileView.Remove(ref fileIter);
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnBtnToggleCrackClicked(object sender, EventArgs e)
|
||||
{
|
||||
TreeIter fileIter;
|
||||
if(treeFiles.Selection.GetSelected(out fileIter))
|
||||
{
|
||||
string name = (string)fileView.GetValue(fileIter, 0);
|
||||
bool known = (bool)fileView.GetValue(fileIter, 2);
|
||||
string color = (string)fileView.GetValue(fileIter, 3);
|
||||
|
||||
DBOSFile osfile;
|
||||
|
||||
if(Context.hashes.TryGetValue(name, out osfile))
|
||||
{
|
||||
osfile.Crack = !osfile.Crack;
|
||||
Context.hashes.Remove(name);
|
||||
Context.hashes.Add(name, osfile);
|
||||
fileView.Remove(ref fileIter);
|
||||
fileView.AppendValues(name, osfile.Sha256, known, color, "black", osfile.Crack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void treeFilesSelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
TreeIter fileIter;
|
||||
if(treeFiles.Selection.GetSelected(out fileIter))
|
||||
{
|
||||
if((bool)fileView.GetValue(fileIter, 5))
|
||||
btnToggleCrack.Label = "Mark as not crack";
|
||||
else
|
||||
btnToggleCrack.Label = "Mark as crack";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,8 @@ namespace osrepodbmgr
|
||||
treeFiles.AppendColumn(vtottimeColumn);
|
||||
treeFiles.AppendColumn(virusColumn);
|
||||
|
||||
treeFiles.Selection.Mode = SelectionMode.Multiple;
|
||||
treeFiles.Selection.Mode = SelectionMode.Single;
|
||||
treeFiles.Selection.Changed += treeFilesSelectionChanged;
|
||||
|
||||
thdPulseProgress = new Thread(() =>
|
||||
{
|
||||
@@ -627,8 +628,26 @@ namespace osrepodbmgr
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnBtnMarkAsCrackClicked(object sender, EventArgs e)
|
||||
protected void OnBtnToggleCrackClicked(object sender, EventArgs e)
|
||||
{
|
||||
TreeIter fileIter;
|
||||
if(treeFiles.Selection.GetSelected(out fileIter))
|
||||
{
|
||||
string hash = (string)fileView.GetValue(fileIter, 0);
|
||||
long length = (long)fileView.GetValue(fileIter, 1);
|
||||
bool crack = !(bool)fileView.GetValue(fileIter, 2);
|
||||
bool hasvirus = (bool)fileView.GetValue(fileIter, 3);
|
||||
string clamtime = (string)fileView.GetValue(fileIter, 4);
|
||||
string vttime = (string)fileView.GetValue(fileIter, 5);
|
||||
string virus = (string)fileView.GetValue(fileIter, 6);
|
||||
string color = (string)fileView.GetValue(fileIter, 7);
|
||||
bool viruschecked = (bool)fileView.GetValue(fileIter, 9);
|
||||
|
||||
Workers.ToggleCrack(hash, crack);
|
||||
|
||||
fileView.Remove(ref fileIter);
|
||||
fileView.AppendValues(hash, length, crack, hasvirus, clamtime, vttime, virus, color, "black", viruschecked);
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnBtnScanWithClamdClicked(object sender, EventArgs e)
|
||||
@@ -642,7 +661,6 @@ namespace osrepodbmgr
|
||||
protected void OnBtnPopulateFilesClicked(object sender, EventArgs e)
|
||||
{
|
||||
// TODO: Implement
|
||||
btnMarkAsCrack.Sensitive = false;
|
||||
btnScanWithClamd.Sensitive = false;
|
||||
btnCheckInVirusTotal.Sensitive = false;
|
||||
|
||||
@@ -795,7 +813,7 @@ namespace osrepodbmgr
|
||||
lblProgressFiles2.Visible = false;
|
||||
prgProgressFiles1.Visible = false;
|
||||
prgProgressFiles2.Visible = false;
|
||||
btnMarkAsCrack.Visible = true;
|
||||
btnToggleCrack.Visible = true;
|
||||
btnScanWithClamd.Visible = true;
|
||||
btnCheckInVirusTotal.Visible = true;
|
||||
btnStopFiles.Visible = false;
|
||||
@@ -805,5 +823,17 @@ namespace osrepodbmgr
|
||||
notebook1.GetNthPage(0).Sensitive = true;
|
||||
});
|
||||
}
|
||||
|
||||
void treeFilesSelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
TreeIter fileIter;
|
||||
if(treeFiles.Selection.GetSelected(out fileIter))
|
||||
{
|
||||
if((bool)fileView.GetValue(fileIter, 2))
|
||||
btnToggleCrack.Label = "Mark as not crack";
|
||||
else
|
||||
btnToggleCrack.Label = "Mark as crack";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,6 +111,8 @@ public partial class dlgAdd
|
||||
|
||||
private global::Gtk.Button btnMetadata;
|
||||
|
||||
private global::Gtk.Button btnToggleCrack;
|
||||
|
||||
private global::Gtk.Button btnRemoveFile;
|
||||
|
||||
private global::Gtk.Button btnDialog;
|
||||
@@ -641,6 +643,18 @@ public partial class dlgAdd
|
||||
w57.Expand = false;
|
||||
w57.Fill = false;
|
||||
// Container child hbox1.Gtk.Box+BoxChild
|
||||
this.btnToggleCrack = new global::Gtk.Button();
|
||||
this.btnToggleCrack.CanFocus = true;
|
||||
this.btnToggleCrack.Name = "btnToggleCrack";
|
||||
this.btnToggleCrack.UseUnderline = true;
|
||||
this.btnToggleCrack.Label = global::Mono.Unix.Catalog.GetString("Mark as crack");
|
||||
this.hbox1.Add(this.btnToggleCrack);
|
||||
global::Gtk.Box.BoxChild w58 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnToggleCrack]));
|
||||
w58.PackType = ((global::Gtk.PackType)(1));
|
||||
w58.Position = 7;
|
||||
w58.Expand = false;
|
||||
w58.Fill = false;
|
||||
// Container child hbox1.Gtk.Box+BoxChild
|
||||
this.btnRemoveFile = new global::Gtk.Button();
|
||||
this.btnRemoveFile.CanFocus = true;
|
||||
this.btnRemoveFile.Name = "btnRemoveFile";
|
||||
@@ -648,19 +662,19 @@ public partial class dlgAdd
|
||||
this.btnRemoveFile.UseUnderline = true;
|
||||
this.btnRemoveFile.Label = "gtk-remove";
|
||||
this.hbox1.Add(this.btnRemoveFile);
|
||||
global::Gtk.Box.BoxChild w58 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnRemoveFile]));
|
||||
w58.PackType = ((global::Gtk.PackType)(1));
|
||||
w58.Position = 7;
|
||||
w58.Expand = false;
|
||||
w58.Fill = false;
|
||||
w1.Add(this.hbox1);
|
||||
global::Gtk.Box.BoxChild w59 = ((global::Gtk.Box.BoxChild)(w1[this.hbox1]));
|
||||
w59.Position = 12;
|
||||
global::Gtk.Box.BoxChild w59 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnRemoveFile]));
|
||||
w59.PackType = ((global::Gtk.PackType)(1));
|
||||
w59.Position = 8;
|
||||
w59.Expand = false;
|
||||
w59.Fill = false;
|
||||
w1.Add(this.hbox1);
|
||||
global::Gtk.Box.BoxChild w60 = ((global::Gtk.Box.BoxChild)(w1[this.hbox1]));
|
||||
w60.Position = 12;
|
||||
w60.Expand = false;
|
||||
w60.Fill = false;
|
||||
// Internal child dlgAdd.ActionArea
|
||||
global::Gtk.HButtonBox w60 = this.ActionArea;
|
||||
w60.Name = "__gtksharp_108_Stetic_TopLevelDialog_ActionArea";
|
||||
global::Gtk.HButtonBox w61 = this.ActionArea;
|
||||
w61.Name = "__gtksharp_108_Stetic_TopLevelDialog_ActionArea";
|
||||
// Container child __gtksharp_108_Stetic_TopLevelDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild
|
||||
this.btnDialog = new global::Gtk.Button();
|
||||
this.btnDialog.CanFocus = true;
|
||||
@@ -668,9 +682,9 @@ public partial class dlgAdd
|
||||
this.btnDialog.UseUnderline = true;
|
||||
this.btnDialog.Label = global::Mono.Unix.Catalog.GetString("GtkButton");
|
||||
this.AddActionWidget(this.btnDialog, 0);
|
||||
global::Gtk.ButtonBox.ButtonBoxChild w61 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w60[this.btnDialog]));
|
||||
w61.Expand = false;
|
||||
w61.Fill = false;
|
||||
global::Gtk.ButtonBox.ButtonBoxChild w62 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w61[this.btnDialog]));
|
||||
w62.Expand = false;
|
||||
w62.Fill = false;
|
||||
if((this.Child != null))
|
||||
{
|
||||
this.Child.ShowAll();
|
||||
@@ -685,11 +699,13 @@ public partial class dlgAdd
|
||||
this.btnPack.Hide();
|
||||
this.btnStop.Hide();
|
||||
this.btnMetadata.Hide();
|
||||
this.btnToggleCrack.Hide();
|
||||
this.btnRemoveFile.Hide();
|
||||
w60.Hide();
|
||||
w61.Hide();
|
||||
this.Show();
|
||||
this.DeleteEvent += new global::Gtk.DeleteEventHandler(this.OnDeleteEvent);
|
||||
this.btnRemoveFile.Clicked += new global::System.EventHandler(this.OnBtnRemoveFileClicked);
|
||||
this.btnToggleCrack.Clicked += new global::System.EventHandler(this.OnBtnToggleCrackClicked);
|
||||
this.btnMetadata.Clicked += new global::System.EventHandler(this.OnBtnMetadataClicked);
|
||||
this.btnStop.Clicked += new global::System.EventHandler(this.OnBtnStopClicked);
|
||||
this.btnFolder.Clicked += new global::System.EventHandler(this.OnBtnFolderClicked);
|
||||
|
||||
@@ -24,8 +24,7 @@ namespace Stetic
|
||||
{
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
int sz;
|
||||
int sy;
|
||||
global::Gtk.Icon.SizeLookup(size, out sz, out sy);
|
||||
@@ -39,8 +38,7 @@ namespace Stetic
|
||||
{
|
||||
return Stetic.IconLoader.LoadIcon(widget, "gtk-missing-image", size);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
Gdk.Pixmap pmap = new Gdk.Pixmap(Gdk.Screen.Default.RootWindow, sz, sz);
|
||||
Gdk.GC gc = new Gdk.GC(pmap);
|
||||
gc.RgbFgColor = new Gdk.Color(255, 255, 255);
|
||||
|
||||
@@ -704,6 +704,24 @@
|
||||
<property name="Fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="Gtk.Button" id="btnToggleCrack">
|
||||
<property name="MemberName" />
|
||||
<property name="Visible">False</property>
|
||||
<property name="CanFocus">True</property>
|
||||
<property name="Type">TextOnly</property>
|
||||
<property name="Label" translatable="yes">Mark as crack</property>
|
||||
<property name="UseUnderline">True</property>
|
||||
<signal name="Clicked" handler="OnBtnToggleCrackClicked" />
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="PackType">End</property>
|
||||
<property name="Position">7</property>
|
||||
<property name="AutoSize">True</property>
|
||||
<property name="Expand">False</property>
|
||||
<property name="Fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="Gtk.Button" id="btnRemoveFile">
|
||||
<property name="MemberName" />
|
||||
@@ -717,7 +735,7 @@
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="PackType">End</property>
|
||||
<property name="Position">7</property>
|
||||
<property name="Position">8</property>
|
||||
<property name="AutoSize">True</property>
|
||||
<property name="Expand">False</property>
|
||||
<property name="Fill">False</property>
|
||||
@@ -12768,14 +12786,14 @@ QNX/QNX/20090229/source.zip</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="Gtk.Button" id="btnMarkAsCrack">
|
||||
<widget class="Gtk.Button" id="btnToggleCrack">
|
||||
<property name="MemberName" />
|
||||
<property name="Visible">False</property>
|
||||
<property name="CanFocus">True</property>
|
||||
<property name="Type">TextOnly</property>
|
||||
<property name="Label" translatable="yes">Mark as crack</property>
|
||||
<property name="UseUnderline">True</property>
|
||||
<signal name="Clicked" handler="OnBtnMarkAsCrackClicked" />
|
||||
<signal name="Clicked" handler="OnBtnToggleCrackClicked" />
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="PackType">End</property>
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace osrepodbmgr
|
||||
|
||||
private global::Gtk.Button btnScanWithClamd;
|
||||
|
||||
private global::Gtk.Button btnMarkAsCrack;
|
||||
private global::Gtk.Button btnToggleCrack;
|
||||
|
||||
private global::Gtk.Button btnStopFiles;
|
||||
|
||||
@@ -389,13 +389,13 @@ namespace osrepodbmgr
|
||||
w32.Expand = false;
|
||||
w32.Fill = false;
|
||||
// Container child hbox6.Gtk.Box+BoxChild
|
||||
this.btnMarkAsCrack = new global::Gtk.Button();
|
||||
this.btnMarkAsCrack.CanFocus = true;
|
||||
this.btnMarkAsCrack.Name = "btnMarkAsCrack";
|
||||
this.btnMarkAsCrack.UseUnderline = true;
|
||||
this.btnMarkAsCrack.Label = global::Mono.Unix.Catalog.GetString("Mark as crack");
|
||||
this.hbox6.Add(this.btnMarkAsCrack);
|
||||
global::Gtk.Box.BoxChild w33 = ((global::Gtk.Box.BoxChild)(this.hbox6[this.btnMarkAsCrack]));
|
||||
this.btnToggleCrack = new global::Gtk.Button();
|
||||
this.btnToggleCrack.CanFocus = true;
|
||||
this.btnToggleCrack.Name = "btnToggleCrack";
|
||||
this.btnToggleCrack.UseUnderline = true;
|
||||
this.btnToggleCrack.Label = global::Mono.Unix.Catalog.GetString("Mark as crack");
|
||||
this.hbox6.Add(this.btnToggleCrack);
|
||||
global::Gtk.Box.BoxChild w33 = ((global::Gtk.Box.BoxChild)(this.hbox6[this.btnToggleCrack]));
|
||||
w33.PackType = ((global::Gtk.PackType)(1));
|
||||
w33.Position = 3;
|
||||
w33.Expand = false;
|
||||
@@ -451,7 +451,7 @@ namespace osrepodbmgr
|
||||
this.prgProgressFiles2.Hide();
|
||||
this.btnCheckInVirusTotal.Hide();
|
||||
this.btnScanWithClamd.Hide();
|
||||
this.btnMarkAsCrack.Hide();
|
||||
this.btnToggleCrack.Hide();
|
||||
this.btnStopFiles.Hide();
|
||||
this.Show();
|
||||
this.DeleteEvent += new global::Gtk.DeleteEventHandler(this.OnDeleteEvent);
|
||||
@@ -464,7 +464,7 @@ namespace osrepodbmgr
|
||||
this.btnSettings.Clicked += new global::System.EventHandler(this.OnBtnSettingsClicked);
|
||||
this.btnQuit.Clicked += new global::System.EventHandler(this.OnBtnQuitClicked);
|
||||
this.btnStopFiles.Clicked += new global::System.EventHandler(this.OnBtnStopFilesClicked);
|
||||
this.btnMarkAsCrack.Clicked += new global::System.EventHandler(this.OnBtnMarkAsCrackClicked);
|
||||
this.btnToggleCrack.Clicked += new global::System.EventHandler(this.OnBtnToggleCrackClicked);
|
||||
this.btnScanWithClamd.Clicked += new global::System.EventHandler(this.OnBtnScanWithClamdClicked);
|
||||
this.btnCheckInVirusTotal.Clicked += new global::System.EventHandler(this.OnBtnCheckInVirusTotalClicked);
|
||||
this.btnPopulateFiles.Clicked += new global::System.EventHandler(this.OnBtnPopulateFilesClicked);
|
||||
|
||||
Reference in New Issue
Block a user