Пример #1
0
        //****
        //*****
        private void DownModul()
        {
            this.What="downppc";
            this.labelInfo.Text="Lade Modul ...";
            this.labelInfo.Refresh();
            FileStream fileStream=null;
            try
            {

                string TargetFile=this.DataDirectory+@"\"+Path.GetFileName(GetModulURL());
                this.LatestModul=TargetFile;
                fileStream = new FileStream(TargetFile,FileMode.Create,FileAccess.Write);

            }
            catch(Exception ex)
            {

                MessageBox.Show(ex.Message,"Zefania PPC");
                // FileStream schließen
                try
                {
                    fileStream.Close();

                }
                catch{}

                return;

            }
            // Datei asynchron herunterladen
            try
            {

                WebDownload ModulList=new WebDownload();

                ModulList.DownloadSync(this.GetModulURL(),fileStream,4096,
                    new WebDownload.DownloadProgress(this.DownloadProgressHandler),
                    new WebDownload.DownloadEnd(this.DownloadEndHandler),
                    new WebDownload.DownloadError(this.DownloadErrorHandler));

            }
            catch(Exception ex)
            {

                MessageBox.Show(ex.Message,"Zefania PPC");
            }
        }
Пример #2
0
        private void menuItemModulliste_Click(object sender, System.EventArgs e)
        {
            this.What="modppc";
            this.labelInfo.Text="Lade Modulliste ...";
            this.labelInfo.Refresh();
            FileStream fileStream=null;
            try
            {
                string TargetFile=this.DataDirectory+@"\zefmodsppc.xml";
                fileStream = new FileStream(TargetFile,FileMode.Create,FileAccess.Write);

            }
            catch(Exception ex)
            {

                MessageBox.Show(ex.Message,"Zefania PPC");
                // FileStream schließen
                try
                {
                    fileStream.Close();

                }
                catch{}

                return;

            }
            // Datei asynchron herunterladen
            try
            {

                WebDownload ModulList=new WebDownload();
                string TargetURL=@"http://zefania-sharp.sourceforge.net/zefmodppc.xml";
                ModulList.DownloadSync(TargetURL,fileStream,1024,
                    new WebDownload.DownloadProgress(this.DownloadProgressHandler),
                    new WebDownload.DownloadEnd(this.DownloadEndHandler),
                    new WebDownload.DownloadError(this.DownloadErrorHandler));

            }
            catch(Exception ex)
            {

                MessageBox.Show(ex.Message,"Zefania PPC");
            }
        }
Пример #3
0
        //*****
        //*****
        private void DownMirrorPage()
        {
            this.What="mirror";
            FileStream fileStream=null;
            try
            {
                string TargetFile=this.DataDirectory+@"\mirrorpage.html";
                fileStream = new FileStream(TargetFile,FileMode.Create,FileAccess.Write);

            }
            catch(Exception ex)
            {

                MessageBox.Show(ex.Message,"Zefania PPC");
                // FileStream schließen
                try
                {
                    fileStream.Close();

                }
                catch{}

                return;

            }
            // Datei asynchron herunterladen
            try
            {

                WebDownload ModulList=new WebDownload();

                ModulList.DownloadSync(DownURL,fileStream,1024,
                    new WebDownload.DownloadProgress(this.DownloadProgressHandler),
                    new WebDownload.DownloadEnd(this.DownloadEndHandler),
                    new WebDownload.DownloadError(this.DownloadErrorHandler));

            }
            catch(Exception ex)
            {

                MessageBox.Show(ex.Message,"Zefania PPC");
            }
        }