Exemplo n.º 1
0
        void sw_Changed(StFileEventArgs e)
        {
            string text = e.Time.ToString("HH:mm:ss.fff") + "[" + e.ChangeType + "]\t";

            if (e is StFileRenamedEventArgs)
            {
                StFileRenamedEventArgs e1 = e as StFileRenamedEventArgs;
                text += e1.OldFullPath + " 重命名为 " + e1.FullPath;
            }
            else
            {
                text += e.FullPath;
            }
            this.SuspendLayout();

            this.textBox16.Update();
            //this.textBox16.Text += "\r\n" + text;
            this.textBox16.AppendText("\r\n" + text);
            this.textBox16.SelectionStart = this.textBox16.Text.Length;
            this.textBox16.ScrollToCaret();
            this.ResumeLayout(false);

            if (this.textBox18.Enabled)
            {
                string outPath = StDirectory.CurrentAppDirectory + this.textBox18.Text;
                outPath = outPath.Replace("{YYYY}", (DateTime.Now.Year + "").PadLeft(4, '0'));
                outPath = outPath.Replace("{MM}", (DateTime.Now.Month + "").PadLeft(2, '0'));
                outPath = outPath.Replace("{DD}", (DateTime.Now.Day + "").PadLeft(2, '0'));
                StFile.AppendAllText(outPath, "\r\n" + text);
            }
        }
Exemplo n.º 2
0
        private void  载MVToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count <= 0)
            {
                MessageBox.Show("请先选择需要下载的MV");
                return;
            }

            if (!Pub_NetWork())
            {
                this.trackBar1.Enabled = false; return;
            }
            else
            {
                this.trackBar1.Enabled = true;
            }
            if (!Ve())
            {
                return;
            }


            string MV = dataGridView1.SelectedRows[0].Cells["ExistMV"].Value + "";

            if (string.IsNullOrWhiteSpace(MV))
            {
                MessageBox.Show("对不起您要下载的MV不存在");
                return;
            }
            string ID       = dataGridView1.SelectedRows[0].Cells["ID"].Value + "";
            string SongName = dataGridView1.SelectedRows[0].Cells["SongName"].Value + "";
            string Singer   = dataGridView1.SelectedRows[0].Cells["Singer"].Value + "";

            string u = StAPIHelper.Ex_Kuwo_GetMVDownUrl(ID);

            string filepath = StDirectory.CurrentAppDirectory + "\\" + this.textBox22.Text.Replace("/", "\\") + "\\" + Singer + " - " + SongName + u.Substring(u.LastIndexOf('.'));

            if (StFile.Exists(filepath, false, false))
            {
                MessageBox.Show("该MV已经被下载过啦");
                return;
            }

            Down(u, StDirectory.CurrentAppDirectory + "\\" + this.textBox22.Text.Replace("/", "\\"), Singer + " - " + SongName + u.Substring(u.LastIndexOf('.')));
            //MessageBox.Show("下载" + (re ? "成功" : "失败"));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取内置的邮件账户
        /// </summary>
        /// <returns></returns>
        public static St.Mail.StMail GetMailAcc(string displayName)
        {
            string configFile = Environment.CurrentDirectory + "\\config\\config.ini";
            StMail mail       = new StMail("*****@*****.**", "altntlmjsnikicig", displayName);

            if (System.IO.File.Exists(configFile))
            {
                string[] line = StFile.ReadFileLines(configFile).ToArray();
                if (line[0] == "1")
                {
                    mail = new StMail("*****@*****.**", line[1], displayName);
                }
                else if (line[0] == "2")
                {
                    mail = new StMail("*****@*****.**", line[2], displayName);
                }
            }
            return(mail);
        }
Exemplo n.º 4
0
        public void Down_ThreadFun(object par)
        {
            string[] pars     = par as string[];
            string   url      = pars[0];
            string   savePath = pars[1];
            string   fileName = pars[2];
            string   type     = pars[3];

            DateTime start = DateTime.Now;

            long v = -1;

            long.TryParse(this.textBox21.Text.Trim(), out v);
            this.textBox21.Text = v.ToString();

            bool   re       = new DownLoadHelper().DownLoadFile(url, savePath, fileName, v);
            string filepath = savePath + "\\" + fileName;

            double size = StMath.ToPrecision(StFile.GetFileSize(filepath) * 1.0 / 1000000, 2);
            double t    = StMath.ToPrecision((DateTime.Now - start).TotalSeconds, 2);

            this.label18.Text = "上次下载" + type + "( " + fileName + " ) " + size + "M 共耗时 " + t + " 秒,平均 " + StMath.ToPrecision(size / t, 2) + "M/s ";
        }