Beispiel #1
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            this.ctdb.UploadHelper.onProgress += UploadProgress;
            if (resp == null)
            {
#if DEBUG
                string server = "hq.cuetools.net";
#else
                string server = null;
#endif
                this.ctdb.ContactDB(server, this.agent, this.drivename, true, true, CTDBMetadataSearch.None);
                this.ctdb.DoVerify();
                resp = this.ctdb.Submit(this.confidence, this.quality, this.artist, this.title, null);
            }
            else
            {
                var url = resp.updateurl;
                resp = null;
                var  temp = Path.GetTempPath() + Path.GetFileName(url.Substring(url.LastIndexOf('/') + 1));
                bool ok   = false;
                using (var stream = new FileStream(temp, FileMode.Create))
                    ok = this.ctdb.FetchFile(url, stream);
                if (ok)
                {
                    System.Diagnostics.Process.Start(temp);
                }
            }
            this.ctdb.UploadHelper.onProgress -= UploadProgress;
        }
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            this.ctdb.UploadHelper.onProgress += UploadProgress;
            if (resp == null)
            {
#if DEBUG
                string server = "hq.cuetools.net";
#else
                string server = null;
#endif
                this.ctdb.ContactDB(server, this.agent, this.drivename, true, true, CTDBMetadataSearch.None);
                this.ctdb.DoVerify();
                resp = this.ctdb.Submit(this.confidence, this.quality, this.artist, this.title, null);
            } else
            {
                var url = resp.updateurl;
                resp = null;
                var temp = Path.GetTempPath() + Path.GetFileName(url.Substring(url.LastIndexOf('/') + 1));
                bool ok = false;
                using (var stream = new FileStream(temp, FileMode.Create))
                    ok = this.ctdb.FetchFile(url, stream);
                if (ok)
                    System.Diagnostics.Process.Start(temp);
            }
            this.ctdb.UploadHelper.onProgress -= UploadProgress;
        }