Example #1
0
        private bool getlogin()
        {
            string text = datasize.linpath + "\\login.jpg";
            bool   result;

            try
            {
                if (File.Exists(text))
                {
                    if (File.GetCreationTime(text).AddDays(1.0) < DateTime.Now)
                    {
                        result = false;
                    }
                    else
                    {
                        this.bitmap = new Bitmap(text);
                        result      = true;
                    }
                }
                else
                {
                    result = false;
                }
            }
            catch
            {
                Kuozhan.delfile(text);
                result = false;
            }
            return(result);
        }
Example #2
0
        private void Downloadfile()
        {
            int i = 0;

            while (i <= this.chongshi)
            {
                try
                {
                    WebClient webClient = new WebClient();
                    if (this.downok)
                    {
                        this.downok = false;
                    }
                    if (this.error != "")
                    {
                        this.error = "";
                    }
                    if (!Kuozhan.delfile(this.temppath))
                    {
                        this.error = "file error" + this.temppath;
                        break;
                    }
                    this.comsr = new StreamWriter(this.temppath);
                    this.file1 = webClient.OpenRead(this.url);
                    byte[] array = new byte[65536];
                    this.filelenth = 0;
                    int j = 1;
                    while (j > 0)
                    {
                        j = this.file1.Read(array, 0, array.Length);
                        this.comsr.BaseStream.Write(array, 0, j);
                        this.filelenth += j;
                    }
                    this.comsr.Close();
                    this.comsr.Dispose();
                    this.file1.Close();
                    this.file1.Dispose();
                    if (!Kuozhan.delfile(this.filepath))
                    {
                        this.error = "file error" + this.temppath;
                        break;
                    }
                    File.Move(this.temppath, this.filepath);
                    this.downok = true;
                    break;
                }
                catch (Exception ex)
                {
                    this.closeziyuan();
                    i++;
                    if (i > this.chongshi)
                    {
                        this.error = ex.Message + "\r\n";
                    }
                }
            }
        }
Example #3
0
        public void DownStar()
        {
            int num = 0;

            this.temppath = datasize.linpath + "\\downtemp.temp";
            while (!Kuozhan.delfile(this.temppath))
            {
                this.temppath += num;
                num++;
            }
            this.uu = new Thread(new ThreadStart(this.Downloadfile));
            this.uu.Start();
        }
Example #4
0
 private void timer2_Tick(object sender, EventArgs e)
 {
     this.timer2.Enabled = false;
     try
     {
         string path = datasize.linpath + "\\login.jpg";
         datasize.loginjpgurl = null;
         Win32.gethmiver(2500, 5000, 0, 5000, false, false, false, 1);
         while (!datasize.findendstate)
         {
             Application.DoEvents();
         }
         this.bitmap.Dispose();
         if (File.Exists(path))
         {
             Kuozhan.delfile(path);
         }
         base.Close();
     }
     catch (Exception ex)
     {
         MessageOpen.Show(ex.Message);
     }
 }