예제 #1
0
        //[TestMethod], takes to long...
        public void ProcessDropFolderThreadTest()
        {
            // Lets create some test files
            CreateTestFile("Lost.s01e01.avi");

            MetaDataFinder mdf = createMDF();

            mdf.ForceRefresh  = true;
            mdf.SaveBannerArt = true;
            mdf.ExtractImage  = true;
            mdf.ThreadCount   = 4;
            mdf.ProcessDropFolder();

            DateTime startTime = System.DateTime.Now;

            mdf.ThreadCount = 1;
            mdf.ProcessShows();
            TimeSpan ts = System.DateTime.Now - startTime;


            startTime       = System.DateTime.Now;
            mdf.ThreadCount = 4;
            mdf.ProcessShows();
            var ts2 = System.DateTime.Now - startTime;

            System.Diagnostics.Trace.WriteLine(string.Format("T1 {0}", ts.TotalSeconds));
            System.Diagnostics.Trace.WriteLine(string.Format("T16 {0}", ts2.TotalSeconds));
        }
예제 #2
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                threadIds.Clear();
                string method = (string)e.Argument;

                if (this.InvokeRequired)
                {
                    this.Invoke((Action) delegate()
                    {
                        pnlStatus.Visible            = true;
                        this.prgStatus.Visible       = true;
                        this.btnStart.Enabled        = false;
                        this.button2.Enabled         = false;
                        this.btnGetDirectory.Enabled = false;
                        this.experimentsToolStripMenuItem.Enabled = false;
                        this.button1.Enabled = false;
                        this.button3.Enabled = false;
                    });
                }

                setupMDF();


                if (method.Equals("shows"))
                {
                    //                StartProcess(this.txtGetDirectory.Text, string.Empty, -1, -1);
                    mdf.ProcessShows();
                }
                if (method.Equals("drop"))
                {
                    //processDropFolder(this.txtDropFolder.Text);
                    mdf.ProcessDropFolder();
                }
                if (method.Equals("newshows"))
                {
                    setupMDF();
                    ns.ShowFolder = mdf.ShowFolder;

                    ns.FindNewShows();
                }
            }
            catch
            {
                this.Invoke((Action) delegate()
                {
                    this.btnStart.Enabled = true;
                    button2.Enabled       = true;
                });
            }
        }