예제 #1
0
        private void buttonTagList_Click(object sender, EventArgs e)
        {
            ArrayList taglist = new ArrayList();

            FileInfo[] files = { };
            ImageInfo  ii    = new ImageInfo();

            try
            {
                DirectoryInfo dir = new DirectoryInfo(sf.FolderPath);

                string   lookfor    = "*.jpg;*.jpeg;*.gif;*.png;*.tif;*.tiff;*.bmp";
                string[] extensions = lookfor.Split(new char[] { ';' });

                ArrayList myfileinfos = new ArrayList();
                foreach (string ext in extensions)
                {
                    myfileinfos.AddRange(dir.GetFiles(ext));
                }

                files = (FileInfo[])myfileinfos.ToArray(typeof(FileInfo));
            }
            catch (Exception ex)
            {
                FlickrSync.Error("Error accessing path: " + sf.FolderPath, ex, FlickrSync.ErrorType.Normal);
            }

            this.Cursor = Cursors.WaitCursor;

            foreach (FileInfo fi in files)
            {
                try
                {
                    ii.Load(fi.FullName, ImageInfo.FileTypes.FileTypeUnknown);
                }
                catch (Exception ex)
                {
                    this.Cursor = Cursors.Default;
                    FlickrSync.Error("Error loading image information: " + fi.FullName, ex, FlickrSync.ErrorType.Normal);
                    return;
                }

                foreach (string tag in ii.GetTagsArray())
                {
                    bool exists = false;
                    foreach (string tagexist in taglist)
                    {
                        if (tag == tagexist)
                        {
                            exists = true;
                            break;
                        }
                    }

                    if (!exists)
                    {
                        taglist.Add(tag);
                    }
                }
            }

            this.Cursor = Cursors.Default;

            SelectFromList listForm = new SelectFromList(taglist);

            listForm.ShowDialog();

            if (textBoxTags.Text == "")
            {
                textBoxTags.Text = listForm.Selected;
            }
            else
            {
                textBoxTags.Text += "; " + listForm.Selected;
            }
        }
예제 #2
0
        private void buttonTagList_Click(object sender, EventArgs e)
        {
            ArrayList taglist = new ArrayList();
            FileInfo[] files ={ };
            ImageInfo ii = new ImageInfo();

            try
            {
                DirectoryInfo dir = new DirectoryInfo(sf.FolderPath);

                string lookfor = "*.jpg;*.jpeg;*.gif;*.png;*.tif;*.tiff;*.bmp";
                string[] extensions = lookfor.Split(new char[] { ';' });

                ArrayList myfileinfos = new ArrayList();
                foreach (string ext in extensions)
                    myfileinfos.AddRange(dir.GetFiles(ext));

                files = (FileInfo[]) myfileinfos.ToArray(typeof(FileInfo));
            }
            catch (Exception ex)
            {
                FlickrSync.Error("Error accessing path: " + sf.FolderPath, ex, FlickrSync.ErrorType.Normal);
            }

            this.Cursor = Cursors.WaitCursor;

            foreach (FileInfo fi in files)
            {
                try
                {
                    ii.Load(fi.FullName, ImageInfo.FileTypes.FileTypeUnknown);
                }
                catch (Exception ex)
                {
                    this.Cursor = Cursors.Default;
                    FlickrSync.Error("Error loading image information: " + fi.FullName, ex, FlickrSync.ErrorType.Normal);
                    return;
                }

                foreach (string tag in ii.GetTagsArray())
                {
                    bool exists = false;
                    foreach (string tagexist in taglist)
                        if (tag == tagexist)
                        {
                            exists = true;
                            break;
                        }

                    if (!exists)
                        taglist.Add(tag);
                }
            }

            this.Cursor = Cursors.Default;

            SelectFromList listForm = new SelectFromList(taglist);
            listForm.ShowDialog();

            if (textBoxTags.Text == "")
                textBoxTags.Text = listForm.Selected;
            else
                textBoxTags.Text += "; " + listForm.Selected;
        }