Updated the FileViewer form to populate the listing of files and performs pattern matching based on the folder group's pattern regex.

This commit is contained in:
Admin
2020-11-10 23:20:41 -06:00
parent 8abded6731
commit cb0737954a
5 changed files with 176 additions and 5 deletions
+41
View File
@@ -306,6 +306,47 @@ namespace DataOrganizer
return conventions;
}
public string GetNamingPatternById(int id)
{
if (id == 0) return string.Empty;
var query = @"SELECT regex FROM main.naming_pattern WHERE pattern_id = @ID";
using (var connection = new SqliteConnection(ConnectionString))
{
using (var command = new SqliteCommand(query, connection))
{
command.Parameters.AddWithValue("ID", id);
connection.Open();
var reader = command.ExecuteReader();
reader.Read();
return reader["regex"].ToString();
}
}
}
public bool UpdateNamingPatterById(int id, string newPattern)
{
var query = @"UPDATE main.naming_pattern SET regex = @pattern WHERE pattern_id = @ID";
using (var connection = new SqliteConnection(ConnectionString))
{
using (var command = new SqliteCommand(query, connection))
{
command.Parameters.AddWithValue("pattern", newPattern);
command.Parameters.AddWithValue("ID", id);
connection.Open();
command.ExecuteNonQuery();
}
}
return true;
}
public struct Profile
{
public string Name;