Ejemplo n.º 1
0
        private void ShowSingleFileTags(DataGridView dgv, string filename)
        {
            TaggedFile file = new TaggedFile(filename);

            currentFile = file;
            ShowSingleFileTags(dgv, file);
        }
Ejemplo n.º 2
0
        private void ShowSingleFileTags(DataGridView dgv, TaggedFile file)
        {
            dgv.Rows.Clear();


            foreach (var delTagKey in file.DeletedTags.Keys)
            {
                foreach (var value in file.GetTag(delTagKey))
                {
                    List <string> newRow = new List <string>();

                    newRow.Add(delTagKey);
                    newRow.Add(value);
                    newRow.Add(value);
                    dgv.Rows.Add(newRow.ToArray());
                }
            }
            foreach (var updTagKey in file.ChangedTags.Keys)
            {
                foreach (var value in file.GetTag(updTagKey))
                {
                    List <string> newRow = new List <string>();

                    newRow.Add(updTagKey);
                    newRow.Add(value);
                    newRow.Add(value);
                    dgv.Rows.Add(newRow.ToArray());
                }
            }

            foreach (var addedTagKey in file.AddedTags.Keys)
            {
                foreach (var value in file.GetTag(addedTagKey))
                {
                    List <string> newRow = new List <string>();

                    newRow.Add(addedTagKey);
                    newRow.Add(value);
                    newRow.Add(value);
                    dgv.Rows.Add(newRow.ToArray());
                }
            }

            foreach (var tag in file.AllTags.Keys)
            {
                if (file.ChangedTags.ContainsKey(tag) || file.AddedTags.ContainsKey(tag) || file.DeletedTags.ContainsKey(tag))
                {
                    continue;
                }
                foreach (var value in file.GetTag(tag))
                {
                    List <string> newRow = new List <string>();

                    newRow.Add(tag);
                    newRow.Add(value);
                    newRow.Add(value);
                    dgv.Rows.Add(newRow.ToArray());
                }
            }
        }
Ejemplo n.º 3
0
        private void RefreshTags(TaggedFile file)
        {
            string        lastKey  = "";
            List <string> currList = new List <string>();

            foreach (DataGridViewRow row in dgvTags.Rows)
            {
                string tagName  = row.Cells[0].Value.ToString();
                string newValue = "";
                if (row.Cells[2].Value is null)
                {
                    newValue = "";
                }
                else
                {
                    newValue = row.Cells[2].Value.ToString();
                }
                if (tagName != lastKey)
                {
                    if (lastKey.Length > 0)
                    {
                        file.SetTag(lastKey, currList);
                    }
                    currList = new List <string>();
                }
                currList.Add(newValue);
                lastKey = tagName;
                //create a dictionary by tag name
            }
            if (lastKey.Length > 0)
            {
                file.SetTag(lastKey, currList);
            }

            ShowSingleFileTags(dgvTags, currentFile);
        }