// XXX: Move this elsewhere. private ILocalDirectoryItem GetFromLocalPath(string localPath) { LoggingService.LogDebug("GET FROM LOCAL !!! " + localPath); return(core.FileSystem.UseConnection <ILocalDirectoryItem>(delegate(IDbConnection connection) { var cmd = connection.CreateCommand(); cmd.CommandText = "SELECT * FROM directoryitems WHERE local_path = @local_path"; core.FileSystem.AddParameter(cmd, "@local_path", localPath); var ds = core.FileSystem.ExecuteDataSet(cmd); if (ds.Tables[0].Rows.Count > 0) { var type = ds.Tables[0].Rows[0]["type"].ToString(); if (type == "F") { return LocalFile.FromDataRow(core.FileSystem, ds.Tables[0].Rows[0]); } return LocalDirectory.FromDataRow(core.FileSystem, ds.Tables[0].Rows[0]); } return null; })); }