Skip to content

Commit

Permalink
Support to appending QSample database
Browse files Browse the repository at this point in the history
  • Loading branch information
rolivella committed Dec 5, 2022
1 parent 28eb182 commit 5d21501
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
3 changes: 2 additions & 1 deletion MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="rawocop 1.0.0" Height="550.842" Width="754.613">
Title="rawocop 1.0.1" Height="550.842" Width="754.613">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="13*"/>
Expand Down Expand Up @@ -62,5 +62,6 @@
<!--<TextBlock x:Name="textBlock_Copy4" HorizontalAlignment="Left" Margin="382,23,0,0" TextWrapping="Wrap" Text="\" VerticalAlignment="Top" Width="18" Height="26" Grid.Row="4" Grid.RowSpan="4" Grid.Column="3" FontSize="30"/>-->
<CheckBox x:Name="cbDiscardQCloudFiles" Content="Discard QCloud files" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="70,3,0,0" Grid.Row="4" Grid.Column="5"/>
<Image Source="/robocop21.png" Grid.Column="5" Margin="470,315,57,0" Grid.Row="9" Height="60" VerticalAlignment="Top" />
<CheckBox x:Name="cbAppendDatabaseToQsample" Content="Append database to QSample" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="201,3,0,0" Grid.Row="4" Grid.Column="5"/>
</Grid>
</Window>
30 changes: 27 additions & 3 deletions MainWindow.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ Class MainWindow
Dim excludeQCloudFile As Boolean = False
Dim rawFileInstrumentSerial As String = ""
Dim rawFileInstrumentName As String = ""
Dim QsampleDatabase As String = ""
Dim firstMonitoredFolderCheck As Boolean = True
Dim AppendQSampleDBtoFilename As Boolean = False
Dim cleanFilesList As New ArrayList()

Public Sub New()
Expand Down Expand Up @@ -137,6 +139,14 @@ Class MainWindow
excludeQCloudFile = False
End Sub

Private Sub cbAppendDatabaseToQsample_Checked(sender As Object, e As RoutedEventArgs) Handles cbAppendDatabaseToQsample.Checked
AppendQSampleDBtoFilename = True
End Sub

Private Sub cbAppendDatabaseToQsample_Unchecked(sender As Object, e As RoutedEventArgs) Handles cbAppendDatabaseToQsample.Unchecked
AppendQSampleDBtoFilename = False
End Sub

Private Sub cbEnableBackupSubfolders_Checked(sender As Object, e As RoutedEventArgs) Handles cbEnableBackupSubfolders.Checked
If cbEnableBackupSubfolders.IsChecked Then
cbSubFolder1.IsEnabled = True
Expand Down Expand Up @@ -206,8 +216,11 @@ Class MainWindow
rawFile.SelectInstrument(instrumentType:=0, 1)
rawFileInstrumentSerial = rawFile.GetInstrumentData().SerialNumber
rawFileInstrumentName = rawFile.GetInstrumentData().Name.ToString.Replace(" ", "_").ToLower
If AppendQSampleDBtoFilename Then
QsampleDatabase = rawFile.SampleInformation.UserText.GetValue(4)
End If
CleanedListOfFiles.Add(file) 'If RAW file pass all filters, then is a valid file
Else
Else
lbLog.Items.Insert(0, getCurrentLogDate() & "[WARNING] File without MS data: " & file)
BlackListOfFiles.Add(Path.GetFileName(file))
End If
Expand Down Expand Up @@ -275,6 +288,10 @@ Class MainWindow
If (Not System.IO.Directory.Exists(targetOnlyfolder)) Then
System.IO.Directory.CreateDirectory(targetOnlyfolder)
End If
If AppendQSampleDBtoFilename Then
targetFullPath = targetFullPath & "." & QsampleDatabase

End If
If File.Exists(targetFullPath) Then
'File.Delete(targetFullPath)
lbLog.Items.Insert(0, getCurrentLogDate() & "[WARNING] Repeated file at destination folder! So it will not be moved.")
Expand Down Expand Up @@ -304,11 +321,17 @@ Class MainWindow

Dim uploadResultCodeStorage = uploadresultcode.Item(0)

Dim filename As String = Path.GetFileName(e.Result)
If AppendQSampleDBtoFilename Then
filename = filename & "." & QsampleDatabase

End If

If uploadResultCodeStorage Is "ST-OK" Then
lbLog.Items.Insert(0, getCurrentLogDate() & ":) File successfully moved to " & Path.GetDirectoryName(e.Result) & "\" & Path.GetFileName(e.Result))
lbLog.Items.Insert(0, getCurrentLogDate() & ":) File successfully moved to " & Path.GetDirectoryName(e.Result) & "\" & filename)
ElseIf uploadResultCodeStorage Is "ST-ERR" Then
BlackListOfFiles.Add(Path.GetFileName(e.Result))
lbLog.Items.Insert(0, getCurrentLogDate() & "[ERROR] Failed to move file " & Path.GetDirectoryName(e.Result) & "\" & Path.GetFileName(e.Result))
lbLog.Items.Insert(0, getCurrentLogDate() & "[ERROR] Failed to move file " & Path.GetDirectoryName(e.Result) & "\" & filename)
End If

End If
Expand Down Expand Up @@ -349,6 +372,7 @@ Class MainWindow
bOutputFolder.IsEnabled = False
cbEnableBackupSubfolders.IsEnabled = False
cbDiscardQCloudFiles.IsEnabled = False
cbAppendDatabaseToQsample.IsEnabled = False

' Starts timer
myTimer.Start()
Expand Down

0 comments on commit 5d21501

Please sign in to comment.