public static string GeneratePathFor(Request request) { var config = new ConfigLoader().LoadConfig(); var fullPath = config.FilesFolder + $"{request.BatchId}/{request.Id}.png"; var folder = Path.GetDirectoryName(fullPath); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } return(fullPath); }
public SqliteConnection GetConnection() { var path = new ConfigLoader().LoadConfig().DatabasePath; var fullPath = Path.GetFullPath(path); if (!File.Exists(fullPath)) { throw new Exception("File not found at " + fullPath); } var connectionString = $"Filename={path}; Mode=ReadWrite;"; var connection = new SqliteConnection(connectionString); connection.Open(); return(connection); }