Exemplo n.º 1
0
        public void UpdateTagStringForCurrentDevicePath(string path, string tagString)
        {
            MultiMap<String, String> pathToTags =
                new MultiMap<string, string>();

            pathToTags.PutCommaStringValues(path, tagString);

            try
            {
                using (var conn =
                    new SQLiteConnection(@"Data Source=" +
                        Configuration.GetSqliteDbPath(GetDbName())))
                {
                    conn.Open();

                    using (var cmd = new SQLiteCommand(conn))
                    {
                        using (var transaction = conn.BeginTransaction())
                        {

                            DeleteFileTagsForCurrentDevicePath(path, cmd);

                            LinkTagsToCurrentDevicePaths(pathToTags, cmd);

                            transaction.Commit();
                        }
                    }

                    conn.Close();
                }
            }
            catch (Exception)
            {
                //do nothing
            }
        }