Пример #1
0
        // Actions to perform when the source list is modified
        private void OnSourcesModified()
        {
            CurrentImages.Clear();
            foreach (ImageSource source in CurrentSources)
            {
                if (!source.IsActive)
                {
                    continue;
                }

                if (source.IsLocal)
                {
                    AddFilesFromDir(source.Path, source.IncludeSubfolders);
                }
                else
                {
                    string[] parts       = source.Path.Split('"');
                    string   sourceName  = parts[0];
                    string   searchQuery = parts[1];
                    if (sourceName == "[e621]:")
                    {
                        CurrentImages.AddRange(WebAPIs.E6GetImages(DB, searchQuery, ItemsPerPage));
                    }
                    //else if (sourceName == "...")
                    // TODO: Handle other types of web sources as well
                }
            }

            // TODO: Sort image list

            RedrawGallery();
        }
Пример #2
0
 public void ImportTags(string imageHash)
 {
     try
     {
         List <string> tagList = WebAPIs.E6GetTags(imageHash);
         foreach (string origTag in tagList)
         {
             string tagPath = SubstituteTag(origTag);
             if (!string.IsNullOrWhiteSpace(tagPath))
             {
                 AssignTag(imageHash, tagPath, ImageTagTypes.Regular);
             }
         }
     }
     catch (Exception)
     {
         // TODO: Display error message
     }
 }