@@ -1048,7 +1048,21 @@ private void backgroundWorker_FileImportDoWork(object sender, DoWorkEventArgs e)
ThreadName = " Main" ;
}
private void UpdateListViewStatus (string hashish , string StatusStr , string MessageStr )
{
ListViewItem listViewItem1 = listView1 .FindItemWithText (hashish );
try
{
WDBTraceLogObj .WriteToLog (ThreadName , ObjectName , GetCurrentMethod (), listViewItem1 .SubItems [1 ].Text + " ==== " + listViewItem1 .SubItems .Count );
listViewItem1 .SubItems [7 ].Text = StatusStr ;
listViewItem1 .SubItems [8 ].Text = MessageStr ;
}
catch (Exception e )
{
WDBTraceLogObj .WriteToLog (ThreadName , ObjectName , GetCurrentMethod (), " Exception: " + e .Message );
}
}
//
// Progress Changed Functions
@@ -1092,19 +1106,41 @@ private void backgroundWorker_ImportProgressChanged(object sender, ProgressChang
{
WDBTraceLogObj .WriteToLog (ThreadName , ObjectName , GetCurrentMethod (), split [0 ]);
WDBTraceLogObj .WriteToLog (ThreadName , ObjectName , GetCurrentMethod (), " HHmmmm...... e.UserState: " + e .UserState .ToString ());
string [] SplitData = items_err [1 ].Split (stringSep1 , StringSplitOptions .None );
// string[] SplitData1 = SplitData[0].Split(stringSep3, StringSplitOptions.None);
FilePath = SplitData [0 ];
byte [] hashBytes ;
string hashish ;
using (var inputFileStream = File .Open (FilePath , FileMode .Open ))
{
var md5 = MD5 .Create ();
hashBytes = md5 .ComputeHash (inputFileStream );
hashish = BitConverter .ToString (hashBytes ).Replace (" -" , String .Empty );
WDBTraceLogObj .WriteToLog (ThreadName , ObjectName , GetCurrentMethod (), " Import File Hash: " + hashish );
}
FileSizeString = new FileInfo (FilePath ).Length .ToString ();
StatusStr = " Error" ;
MessageStr = split [1 ];
UpdateListViewStatus (hashish , StatusStr , MessageStr );
}
else
{
if ( items_err [0 ] == " Already Local Imported." )
if ( items_err [0 ] == " Already Local Imported." )
{
WDBTraceLogObj .WriteToLog (ThreadName , ObjectName , GetCurrentMethod (), " Skip That Shit! : " + items_err [0 ]);
}
else
else if ( items_err [ 0 ] == " Already Imported. " )
{
string [] SplitData = items_err [1 ].Split (stringSep1 , StringSplitOptions .None );
string [] SplitData1 = SplitData [0 ].Split (stringSep3 , StringSplitOptions .None );
// string[] SplitData1 = SplitData[0].Split(stringSep3, StringSplitOptions.None);
FilePath = SplitData [1 ];
FilePath = SplitData [0 ];
byte [] hashBytes ;
string hashish ;
@@ -1122,23 +1158,32 @@ private void backgroundWorker_ImportProgressChanged(object sender, ProgressChang
StatusStr = " Error" ;
MessageStr = split [1 ];
WDBTraceLogObj .WriteToLog (ThreadName , ObjectName , GetCurrentMethod (), " split[0]: " + split [0 ]);
WDBTraceLogObj .WriteToLog (ThreadName , ObjectName , GetCurrentMethod (), " items_err[0]: " + items_err [0 ]);
WDBTraceLogObj .WriteToLog (ThreadName , ObjectName , GetCurrentMethod (), " SplitData[0]: " + SplitData [0 ]); // FilePath
// WDBTraceLogObj.WriteToLog(ThreadName, ObjectName, GetCurrentMethod(), "SplitData[1]: " + SplitData1[0]); //FileHash
UpdateListViewStatus (hashish , StatusStr , MessageStr );
}
else
{
string [] SplitData = items_err [1 ].Split (stringSep1 , StringSplitOptions .None );
string [] SplitData1 = SplitData [0 ].Split (stringSep3 , StringSplitOptions .None );
ListViewItem listViewItem1 = listView1 . FindItemWithText ( hashish ) ;
FilePath = SplitData [ 1 ] ;
try
byte [] hashBytes ;
string hashish ;
using (var inputFileStream = File .Open (FilePath , FileMode .Open ))
{
WDBTraceLogObj .WriteToLog (ThreadName , ObjectName , GetCurrentMethod (), listViewItem1 .SubItems [1 ].Text + " ==== " + listViewItem1 .SubItems .Count );
listViewItem1 .SubItems [7 ].Text = StatusStr ;
listViewItem1 .SubItems [8 ].Text = MessageStr ;
var md5 = MD5 .Create ();
hashBytes = md5 .ComputeHash (inputFileStream );
hashish = BitConverter .ToString (hashBytes ).Replace (" -" , String .Empty );
WDBTraceLogObj .WriteToLog (ThreadName , ObjectName , GetCurrentMethod (), " Import File Hash: " + hashish );
}
catch
{
}
// FileHash = SplitData1[1].ToUpper();
FileSizeString = new FileInfo (FilePath ).Length .ToString ();
StatusStr = " Error" ;
MessageStr = split [1 ];
UpdateListViewStatus (hashish , StatusStr , MessageStr );
}
// InsertNewListViewRow(split, "Error");
}