Renamed FireLance library to GSMParser
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
public static class QueryBuilder
|
||||
{
|
||||
private static string NewQueryFromCommand(string select, string from, string where, string query, bool modalRecord, bool exactMatch)
|
||||
{
|
||||
string _query = string.Empty;
|
||||
|
||||
_query += ($"SELECT \"{select}\"");
|
||||
|
||||
if (modalRecord == true)
|
||||
{
|
||||
_query += ",* ";
|
||||
}
|
||||
else
|
||||
{
|
||||
_query += " ";
|
||||
}
|
||||
|
||||
_query += ($"FROM \"main\".\"{from}\"" +
|
||||
$"WHERE \"{where}\" ");
|
||||
|
||||
if (exactMatch == true)
|
||||
{
|
||||
_query += ($"LIKE '{query}'");
|
||||
}
|
||||
else
|
||||
{
|
||||
_query += ($"LIKE '%{query}%'");
|
||||
}
|
||||
|
||||
return _query;
|
||||
}
|
||||
|
||||
public static string GameByName(string name)
|
||||
{
|
||||
return NewQueryFromCommand("GameName", "GameEntry", "GameName", name, true, false);
|
||||
}
|
||||
|
||||
public static string GameById(string id)
|
||||
{
|
||||
return NewQueryFromCommand("GameName", "GameEntry", "id", id, true, true);
|
||||
}
|
||||
|
||||
public static string DirectoryById(string id)
|
||||
{
|
||||
return NewQueryFromCommand("Path", "Directories", "GameID", id, true, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user