コード例 #1
0
 public static void OnOpenJpeg(string[] files)
 {
     if (files != null && files.Length > 0)
     {
         CallAndCatchExceptions.Call(delegate(object o)
         {
             new BookmarkBucket().TopOpenWebpagesAssociatedWithJpegs((string[])o);
         }, files);
     }
 }
コード例 #2
0
 private void btn1_Click(object sender, EventArgs e)
 {
     if ((ModifierKeys & Keys.Shift) == Keys.Shift)
     {
         CallAndCatchExceptions.Call(delegate(object o) { new BookmarkBucket().TopRunUnitTests(); }, null);
     }
     else
     {
         createFromURLShortcutsToolStripMenuItem_Click(null, null);
     }
 }
コード例 #3
0
        private void createFromURLShortcutsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string sDir = InputBoxForm.GetStrInput("All URL shortcuts from this directory:", "c:\\example");

            if (sDir == null || !Directory.Exists(sDir))
            {
                MessageBox.Show("Not a valid directory."); return;
            }

            // create bg thread.
            g_busy = true; this.btn1.Enabled = false;
            Thread oThread = new Thread(delegate()
            {
                CallAndCatchExceptions.Call(delegate(object param)
                {
                    new BookmarkBucket().TopUrlShortcutsToJpegs((string)param);
                }, sDir);
                g_busy = false; g_status = "";
            });

            oThread.Start();
        }
コード例 #4
0
 private void Form1_DragDrop(object sender, DragEventArgs e)
 {
     string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
     if ((ModifierKeys & Keys.Shift) == Keys.Shift)
     {
         if (files.Length > 1)
         {
             MessageBox.Show("Warning: only processing first one");
         }
         CallAndCatchExceptions.Call(delegate(object o)
         {
             new BookmarkBucket().TopCreateManualShortcut((string)o);
         },
                                     files[0]);
     }
     else
     {
         CallAndCatchExceptions.Call(delegate(object o)
         {
             new BookmarkBucket().TopOpenWebpagesAssociatedWithJpegs((string[])o);
         },
                                     files);
     }
 }
コード例 #5
0
        public void TopRunUnitTests()
        {
            //string sTestDir = @"C:\Users\diamond\Desktop\-frommain\delldev\bookmarkbuckets\bookmarkbuckets_cs\bookmarkbucket\bookmarkbucket_console\bookmarkbucket_ui\test";
            //string s1 = BookmarkBucketCore.GetExifDataSoftware(sTestDir + "\\k.jpeg");
            //string s2 = BookmarkBucketCore.GetExifDataTitle(sTestDir + "\\k.jpeg");
            //string s3 = BookmarkBucketCore.GetExifDataUrl(sTestDir + "\\k.jpeg");
            //MessageBox.Show(String.Format("{0}\n{1}\n{2}\n", s1,s2,s3));

            // convert from old to new.
            //bool b = ThreadPool.SetMaxThreads(4, 4);
            //System.Diagnostics.Debug.Assert(b);

            DialogResult dr = MessageBox.Show("Create new jpgs?", "bb", MessageBoxButtons.YesNo);

            if (dr == DialogResult.No)
            {
                ConvertOldToNewWithoutRedownloading(); return;
            }

            string sDir = InputBoxForm.GetStrInput("All from this directory:", "c:\\example");

            if (sDir == null || !Directory.Exists(sDir))
            {
                MessageBox.Show("Not a valid directory."); return;
            }

            DirectoryInfo di = new DirectoryInfo(sDir);

            FileInfo[] rgFiles = di.GetFiles("*.jpg");
            foreach (FileInfo fi in rgFiles)
            {
                string sNewname = Path.GetFileNameWithoutExtension(fi.Name.Replace("555 ", "")) + ".png";
                if (File.Exists(sDir + "\\" + sNewname))
                {
                    throw new BookmarkBucketException("exists png" + fi.Name);
                }
                File.Move(sDir + "\\" + fi.Name, sDir + "\\" + sNewname);
            }

            // make a Model
            BookmarkBucketObjectModel model = new BookmarkBucketObjectModel();

            FileInfo[] rgFilesPng = di.GetFiles("*.png");
            foreach (FileInfo fi in rgFilesPng)
            {
                string sOldUrl = BookmarkBucketCore.GetExifData(fi.FullName, "Comment");
                if (!BookmarkBucketCore.looksLikeAUrl(sOldUrl))
                {
                    throw new BookmarkBucketException("couldnot read url" + fi.Name);
                }

                model.list.Add(new BookmarkBucketItem {
                    sFile = Path.GetFileNameWithoutExtension(fi.Name), sUrl = sOldUrl
                });
            }

            Form1.g_busy = true;
            Thread oThread = new Thread(delegate()
            {
                CallAndCatchExceptions.Call(delegate(object o)
                {
                    this.ModelToJpegs(model, sDir);
                    Form1.g_busy = false; Form1.g_status = "";
                }, null);
            });

            oThread.Start();
        }
コード例 #6
0
 private void exportToURLShortcutsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CallAndCatchExceptions.Call(delegate(object o) { new BookmarkBucket().TopJpegsToUrlShortcuts(); }, null);
 }
コード例 #7
0
 private void createFromXmlFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CallAndCatchExceptions.Call(delegate(object o) { new BookmarkBucket().TopXmlFileToUrlShortcuts(); }, null);
 }
コード例 #8
0
 private void jpegIntoShortcutToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CallAndCatchExceptions.Call(delegate(object o) { new BookmarkBucket().TopCreateOneShortcut(true); }, null);
 }