Exemplo n.º 1
0
 private void packageDownload_DownloadProgressUpdate(CDownloadFile sender)
 {
     if (this.DownloadProgressUpdate != null)
     {
         this.DownloadProgressUpdate(this, sender);
     }
 }
Exemplo n.º 2
0
 private void cdfDownloading_DownloadProgressUpdate(CDownloadFile cdfSender)
 {
     this.InvokeIfRequired(() => {
         this.toolStripDownloadProgress.Value = cdfSender.BytesDownloaded;
         this.toolStripDownloading.Text       = String.Format("{0} {1}", this.m_clocLanguage.GetLocalized("frmMain.toolStripDownloading", null), cdfSender.GetLabelProgress());
     });
 }
Exemplo n.º 3
0
        private void cdfPRoConUpdate_DownloadComplete(CDownloadFile cdfSender)
        {
            if (String.Compare(this.MD5Data(cdfSender.CompleteFileData), (string)cdfSender.AdditionalData, true) == 0) {

                string strUpdatesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this.m_updatesDirectoryName);

                try {
                    if (Directory.Exists(strUpdatesFolder) == false) {
                        Directory.CreateDirectory(strUpdatesFolder);
                    }

                    using (ZipFile zip = ZipFile.Read(cdfSender.CompleteFileData)) {
                        zip.ExtractAll(strUpdatesFolder, ExtractExistingFileAction.OverwriteSilently);
                    }

                    if (this.DownloadUnzipComplete != null) {
                        FrostbiteConnection.RaiseEvent(this.DownloadUnzipComplete.GetInvocationList());
                    }
                }
                catch (Exception e) {
                    if (this.CustomDownloadError != null) {
                        FrostbiteConnection.RaiseEvent(this.CustomDownloadError.GetInvocationList(), e.Message);
                    }

                    //this.Invoke(new DownloadErrorDelegate(DownloadError_Callback), e.Message);
                }
            }
            else {
                if (this.CustomDownloadError != null) {
                    FrostbiteConnection.RaiseEvent(this.CustomDownloadError.GetInvocationList(), "Downloaded file failed checksum, please try again or download direct from http://phogue.net");
                }

                //this.Invoke(new DownloadErrorDelegate(DownloadError_Callback), "Downloaded file failed checksum, please try again or download direct from http://phogue.net");
            }
        }
Exemplo n.º 4
0
        private void cdfPRoConUpdate_DownloadComplete(CDownloadFile sender) {
            if (String.Compare(MD5Data(sender.CompleteFileData), (string) sender.AdditionalData, StringComparison.OrdinalIgnoreCase) == 0) {
                string updatesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, UpdatesDirectoryName);

                try {
                    if (Directory.Exists(updatesFolder) == false) {
                        Directory.CreateDirectory(updatesFolder);
                    }

                    using (ZipFile zip = ZipFile.Read(sender.CompleteFileData)) {
                        zip.ExtractAll(updatesFolder, ExtractExistingFileAction.OverwriteSilently);
                    }

                    if (DownloadUnzipComplete != null) {
                        FrostbiteConnection.RaiseEvent(DownloadUnzipComplete.GetInvocationList());
                    }
                }
                catch (Exception e) {
                    if (CustomDownloadError != null) {
                        FrostbiteConnection.RaiseEvent(CustomDownloadError.GetInvocationList(), e.Message);
                    }
                }
            }
            else {
                if (CustomDownloadError != null) {
                    FrostbiteConnection.RaiseEvent(CustomDownloadError.GetInvocationList(), "Downloaded file failed checksum, please try again or download direct from https://myrcon.com");
                }
            }
        }
Exemplo n.º 5
0
        private void m_cdfUpdatedGameConfig_DownloadComplete(CDownloadFile cdfSender)
        {
            string strGameConfigFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs");

            try
            {
                if (Directory.Exists(strGameConfigFolder) == false)
                {
                    Directory.CreateDirectory(strGameConfigFolder);
                }

                using (ZipFile zip = ZipFile.Read(cdfSender.CompleteFileData))
                {
                    zip.ExtractAll(strGameConfigFolder, ExtractExistingFileAction.OverwriteSilently);
                }

                // GameConfigs require Procon restart
                if (GameConfigHint == false)
                {
                    GameConfigInfo();
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 6
0
 private void packageDownload_DownloadError(CDownloadFile sender)
 {
     if (this.DownloadError != null)
     {
         this.Error = sender.Error;
         this.DownloadError(this, sender);
     }
 }
Exemplo n.º 7
0
 private void m_paProcon_UpdateDownloading(CDownloadFile cdfDownloading)
 {
     this.InvokeIfRequired(() => {
         cdfDownloading.DownloadProgressUpdate     += new CDownloadFile.DownloadFileEventDelegate(cdfDownloading_DownloadProgressUpdate);
         cdfDownloading.DownloadError              += new CDownloadFile.DownloadFileEventDelegate(cdfDownloading_DownloadError);
         cdfDownloading.DownloadDiscoveredFileSize += new CDownloadFile.DownloadFileEventDelegate(cdfDownloading_DownloadDiscoveredFileSize);
     });
 }
Exemplo n.º 8
0
        private void cdfDownloading_DownloadError(CDownloadFile cdfSender)
        {
            this.toolStripDownloadProgress.Visible = false;

            this.toolStripDownloading.ForeColor = Color.Maroon;
            this.toolStripDownloading.Image     = null;
            this.toolStripDownloading.Text      = this.m_clocLanguage.GetLocalized("frmMain.toolStripDownloading.Error", cdfSender.Error);
        }
Exemplo n.º 9
0
        private void cdfDownloading_DownloadDiscoveredFileSize(CDownloadFile cdfSender)
        {
            this.toolStripDownloading.ForeColor    = SystemColors.WindowText;
            this.toolStripDownloading.Image        = picAjaxStyleLoading.Image;
            this.toolStripDownloadProgress.Visible = true;

            this.toolStripDownloadProgress.Maximum = cdfSender.FileSize;
        }
Exemplo n.º 10
0
        public AutoUpdater(PRoConApplication praApplication, string[] args) {
            AutoUpdater.m_strArgs = args;
            this.m_praApplication = praApplication;

            this.VersionChecker = new CDownloadFile("http://www.phogue.net/procon/version3.php");
            this.VersionChecker.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(VersionChecker_DownloadComplete);
            this.m_lstDownloadingLocalizations = new List<CDownloadFile>();
            this.m_lstDownloadingGameConfigs = new List<CDownloadFile>();
        }
Exemplo n.º 11
0
        private void DownloadLocalizationFile(string strDownloadSource, string strLocalizationFilename) {
            lock (DownloadingLocalizationsLock) {
                var cdfUpdatedLocalization = new CDownloadFile(strDownloadSource, strLocalizationFilename);
                cdfUpdatedLocalization.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(m_cdfUpdatedLocalization_DownloadComplete);
                DownloadingLocalizations.Add(cdfUpdatedLocalization);

                cdfUpdatedLocalization.BeginDownload();
            }
        }
Exemplo n.º 12
0
        //private void focus_DownloadProgressUpdate(Package sender, CDownloadFile file) {
        //    this.UnregisterEvents(sender);
        //}

        private void focus_DownloadComplete(Package sender, CDownloadFile file)
        {
            //this.UnregisterEvents(sender);

            if (this.PackageDownloaded != null)
            {
                FrostbiteConnection.RaiseEvent(this.PackageDownloaded.GetInvocationList(), this, sender);
            }
        }
Exemplo n.º 13
0
        private void focus_DownloadError(Package sender, CDownloadFile file)
        {
            this.UnregisterEvents(sender);

            if (this.PackageDownloadFail != null)
            {
                FrostbiteConnection.RaiseEvent(this.PackageDownloadFail.GetInvocationList(), this, sender);
            }
        }
Exemplo n.º 14
0
        public AutoUpdater(PRoConApplication praApplication, string[] args) {
            Arguments = args;
            Application = praApplication;

            VersionChecker = new CDownloadFile("https://repo.myrcon.com/procon1/version3.php");
            VersionChecker.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(VersionChecker_DownloadComplete);
            DownloadingLocalizations = new List<CDownloadFile>();
            DownloadingGameConfigs = new List<CDownloadFile>();
        }
Exemplo n.º 15
0
        private void DownloadLocalizationFile(string strDownloadSource, string strLocalizationFilename)
        {
            lock (this.m_objDownloadingLocalizations) {
                CDownloadFile cdfUpdatedLocalization = new CDownloadFile(strDownloadSource, strLocalizationFilename);
                cdfUpdatedLocalization.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(m_cdfUpdatedLocalization_DownloadComplete);
                this.m_lstDownloadingLocalizations.Add(cdfUpdatedLocalization);

                cdfUpdatedLocalization.BeginDownload();
            }
        }
 private void DownloadBannerURL(string strUrl)
 {
     if (strUrl != null)
     {
         this.m_cdfBanner = new CDownloadFile(strUrl);
         this.m_cdfBanner.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(cdfBanner_DownloadComplete);
         this.m_cdfBanner.DownloadError    += new CDownloadFile.DownloadFileEventDelegate(cdfBanner_DownloadError);
         this.m_cdfBanner.BeginDownload();
     }
 }
Exemplo n.º 17
0
        private void portTest_DownloadError(CDownloadFile cdfSender)
        {
            this.picHttpServerForwardedTestStatus.Image = this.m_frmParent.picPortCheckerClosed.Image;

            this.lblHttpServerForwardedTestStatus.Text      = this.m_praApplication.CurrentLanguage.GetLocalized("frmOptions.lblHttpServerForwardedTestStatus.Closed", this.txtHttpServerStartPort.Text);
            this.lblHttpServerForwardedTestStatus.ForeColor = Color.Maroon;

            this.lnkHttpServerForwardedTest.Enabled = true;
            this.lnkHttpServerExampleLink.Visible   = false;
        }
Exemplo n.º 18
0
        private void DownloadLocalizationFile(string strDownloadSource, string strLocalizationFilename)
        {
            lock (DownloadingLocalizationsLock) {
                var cdfUpdatedLocalization = new CDownloadFile(strDownloadSource, strLocalizationFilename);
                cdfUpdatedLocalization.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(m_cdfUpdatedLocalization_DownloadComplete);
                DownloadingLocalizations.Add(cdfUpdatedLocalization);

                cdfUpdatedLocalization.BeginDownload();
            }
        }
Exemplo n.º 19
0
        public AutoUpdater(PRoConApplication praApplication, string[] args)
        {
            AutoUpdater.m_strArgs = args;
            this.m_praApplication = praApplication;

            this.VersionChecker = new CDownloadFile("http://www.phogue.net/procon/version3.php");
            this.VersionChecker.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(VersionChecker_DownloadComplete);
            this.m_lstDownloadingLocalizations    = new List <CDownloadFile>();
            this.m_lstDownloadingGameConfigs      = new List <CDownloadFile>();
        }
Exemplo n.º 20
0
        void VersionChecker_DownloadError(CDownloadFile cdfSender)
        {
            this.InvokeIfRequired(() => {
                this.toolStripDownloadProgress.Visible = false;

                this.toolStripDownloading.ForeColor = Color.Maroon;
                this.toolStripDownloading.Image     = null;
                this.toolStripDownloading.Text      = this.m_clocLanguage.GetLocalized("frmMain.toolStripDownloading.Error", cdfSender.Error);
            });
        }
Exemplo n.º 21
0
        public AutoUpdater(PRoConApplication praApplication, string[] args)
        {
            Arguments   = args;
            Application = praApplication;

            VersionChecker = new CDownloadFile("https://repo.myrcon.com/procon1/version3.php");
            VersionChecker.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(VersionChecker_DownloadComplete);
            DownloadingLocalizations         = new List <CDownloadFile>();
            DownloadingGameConfigs           = new List <CDownloadFile>();
        }
Exemplo n.º 22
0
        private void DownloadGameConfigFile(string strDownloadSource, string strGameConfigFilename)
        {
            lock (DownloadingGameConfigsLock) {
                var cdfUpdatedGameConfig = new CDownloadFile(strDownloadSource, strGameConfigFilename);
                cdfUpdatedGameConfig.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(m_cdfUpdatedGameConfig_DownloadComplete);
                DownloadingGameConfigs.Add(cdfUpdatedGameConfig);

                cdfUpdatedGameConfig.BeginDownload();
            }
        }
Exemplo n.º 23
0
        private void DownloadGameConfigFile(string strDownloadSource, string strGameConfigFilename)
        {
            lock (this.m_objDownloadingGameConfigs)
            {
                CDownloadFile cdfUpdatedGameConfig = new CDownloadFile(strDownloadSource, strGameConfigFilename);
                cdfUpdatedGameConfig.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(m_cdfUpdatedGameConfig_DownloadComplete);
                this.m_lstDownloadingGameConfigs.Add(cdfUpdatedGameConfig);

                cdfUpdatedGameConfig.BeginDownload();
            }
        }
Exemplo n.º 24
0
        public void DownloadPackage(string extractPath)
        {
            CDownloadFile packageDownload = null;

            if (this.Uid.Length > 0 && this.Md5.Length > 0 && this.Version != null)
            {
                packageDownload = new CDownloadFile(String.Format("http://phogue.net/procon/packages/download.php?uid={0}&version={1}", this.Uid, this.Version), extractPath);

                packageDownload.DownloadComplete       += new CDownloadFile.DownloadFileEventDelegate(packageDownload_DownloadComplete);
                packageDownload.DownloadError          += new CDownloadFile.DownloadFileEventDelegate(packageDownload_DownloadError);
                packageDownload.DownloadProgressUpdate += new CDownloadFile.DownloadFileEventDelegate(packageDownload_DownloadProgressUpdate);

                packageDownload.BeginDownload();
            }
        }
Exemplo n.º 25
0
        private void VersionChecker_DownloadComplete(CDownloadFile sender) {
            string[] versionData = Encoding.UTF8.GetString(sender.CompleteFileData).Split('\n');

            if (versionData.Length >= 4 && (ProconUpdate == null || ProconUpdate.FileDownloading == false)) {
                // Download file, alert or auto apply once complete with release notes.
                ProconUpdate = new CDownloadFile(versionData[2], versionData[3]);
                ProconUpdate.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(cdfPRoConUpdate_DownloadComplete);

                if (UpdateDownloading != null) {
                    FrostbiteConnection.RaiseEvent(UpdateDownloading.GetInvocationList(), ProconUpdate);
                }

                ProconUpdate.BeginDownload();
            }
        }
Exemplo n.º 26
0
        private void lnkHttpServerForwardedTest_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            CDownloadFile portTest = new CDownloadFile("http://www.phogue.net/procon/testport.php?port=" + this.txtHttpServerStartPort.Text);

            portTest.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(portTest_DownloadComplete);
            portTest.DownloadError    += new CDownloadFile.DownloadFileEventDelegate(portTest_DownloadError);

            this.picHttpServerForwardedTestStatus.Image = this.m_frmParent.picAjaxStyleLoading.Image;
            //this.tmrPortCheckTester.Enabled = true;
            this.lnkHttpServerForwardedTest.Enabled         = false;
            this.lblHttpServerForwardedTestStatus.Text      = this.m_praApplication.CurrentLanguage.GetLocalized("frmOptions.lblHttpServerForwardedTestStatus.Running", this.txtHttpServerStartPort.Text);
            this.lblHttpServerForwardedTestStatus.ForeColor = Color.Black;

            portTest.BeginDownload();
        }
Exemplo n.º 27
0
        private void packageDownload_DownloadComplete(CDownloadFile sender)
        {
            if (this.DownloadComplete != null)
            {
                this.DownloadComplete(this, sender);
            }

            if (String.Compare(this.MD5Data(sender.CompleteFileData), this.Md5, true) == 0)
            {
                string strUpdatesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, (string)sender.AdditionalData);

                try {
                    if (Directory.Exists(strUpdatesFolder) == false)
                    {
                        Directory.CreateDirectory(strUpdatesFolder);
                    }

                    if (this.PackageBeginUnzip != null)
                    {
                        this.PackageBeginUnzip(this);
                    }

                    using (ZipFile zip = ZipFile.Read(sender.CompleteFileData)) {
                        zip.ExtractAll(strUpdatesFolder, ExtractExistingFileAction.OverwriteSilently);
                    }

                    if (this.PackageEndUnzip != null)
                    {
                        this.PackageEndUnzip(this);
                    }
                }
                catch (Exception e) {
                    if (this.PackageCustomDownloadError != null)
                    {
                        this.Error = e.Message;
                        this.PackageCustomDownloadError(this, e.Message);
                    }
                }
            }
            else
            {
                this.Error = "Downloaded file failed checksum, please try again or download direct from http://phogue.net";
                if (this.PackageCustomDownloadError != null)
                {
                    this.PackageCustomDownloadError(this, "Downloaded file failed checksum, please try again or download direct from http://phogue.net");
                }
            }
        }
        private void cdfBanner_DownloadComplete(CDownloadFile cdfSender)
        {
            this.lblSettingsDownloadedBannerURLError.Visible = false;

            if (cdfSender != null)
            {
                MemoryStream msImage      = new MemoryStream(cdfSender.CompleteFileData);
                Image        imgCompleted = Image.FromStream(msImage);

                this.picSettingsDownloadedBannerURL.Image = imgCompleted;
            }
            else
            {
                this.picSettingsDownloadedBannerURL.Image = null;
            }
        }
Exemplo n.º 29
0
        private void VersionChecker_DownloadComplete(CDownloadFile cdfSender) {
 
            string[] a_strVersionData = System.Text.Encoding.UTF8.GetString(cdfSender.CompleteFileData).Split('\n');

            if (a_strVersionData.Length >= 4 && (this.m_cdfPRoConUpdate == null || this.m_cdfPRoConUpdate.FileDownloading == false)) {

                // Download file, alert or auto apply once complete with release notes.
                this.m_cdfPRoConUpdate = new CDownloadFile(a_strVersionData[2], a_strVersionData[3]);
                this.m_cdfPRoConUpdate.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(cdfPRoConUpdate_DownloadComplete);

                if (this.UpdateDownloading != null) {
                    FrostbiteConnection.RaiseEvent(this.UpdateDownloading.GetInvocationList(), this.m_cdfPRoConUpdate);
                }

                this.m_cdfPRoConUpdate.BeginDownload();
            }
        }
Exemplo n.º 30
0
        private void VersionChecker_DownloadComplete(CDownloadFile sender)
        {
            string[] versionData = Encoding.UTF8.GetString(sender.CompleteFileData).Split('\n');

            if (versionData.Length >= 4 && (ProconUpdate == null || ProconUpdate.FileDownloading == false))
            {
                // Download file, alert or auto apply once complete with release notes.
                ProconUpdate = new CDownloadFile(versionData[2], versionData[3]);
                ProconUpdate.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(cdfPRoConUpdate_DownloadComplete);

                if (UpdateDownloading != null)
                {
                    FrostbiteConnection.RaiseEvent(UpdateDownloading.GetInvocationList(), ProconUpdate);
                }

                ProconUpdate.BeginDownload();
            }
        }
Exemplo n.º 31
0
        private void VersionChecker_DownloadComplete(CDownloadFile cdfSender)
        {
            string[] a_strVersionData = System.Text.Encoding.UTF8.GetString(cdfSender.CompleteFileData).Split('\n');

            if (a_strVersionData.Length >= 4 && (this.m_cdfPRoConUpdate == null || this.m_cdfPRoConUpdate.FileDownloading == false))
            {
                // Download file, alert or auto apply once complete with release notes.
                this.m_cdfPRoConUpdate = new CDownloadFile(a_strVersionData[2], a_strVersionData[3]);
                this.m_cdfPRoConUpdate.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(cdfPRoConUpdate_DownloadComplete);

                if (this.UpdateDownloading != null)
                {
                    FrostbiteConnection.RaiseEvent(this.UpdateDownloading.GetInvocationList(), this.m_cdfPRoConUpdate);
                }

                this.m_cdfPRoConUpdate.BeginDownload();
            }
        }
Exemplo n.º 32
0
        private void m_cdfUpdatedLocalization_DownloadComplete(CDownloadFile cdfSender)
        {
            string strLocalizationFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Localization");

            try {
                if (Directory.Exists(strLocalizationFolder) == false)
                {
                    Directory.CreateDirectory(strLocalizationFolder);
                }

                using (ZipFile zip = ZipFile.Read(cdfSender.CompleteFileData)) {
                    zip.ExtractAll(strLocalizationFolder, ExtractExistingFileAction.OverwriteSilently);
                }

                Application.LoadLocalizationFiles();
            }
            catch (Exception) {
            }
        }
Exemplo n.º 33
0
        private void cdfPRoConUpdate_DownloadComplete(CDownloadFile cdfSender)
        {
            if (System.String.Compare(MD5Data(cdfSender.CompleteFileData), (string)cdfSender.AdditionalData, System.StringComparison.OrdinalIgnoreCase) == 0)
            {
                string strUpdatesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates");

                try
                {
                    if (Directory.Exists(strUpdatesFolder) == false)
                    {
                        Directory.CreateDirectory(strUpdatesFolder);
                    }

                    using (ZipFile zip = ZipFile.Read(cdfSender.CompleteFileData))
                    {
                        zip.ExtractAll(strUpdatesFolder, ExtractExistingFileAction.OverwriteSilently);
                    }

                    DownloadedUnzippedComplete();
                }
                catch (Exception e)
                {
                    if (CustomDownloadError != null)
                    {
                        this.CustomDownloadError(e.Message);
                    }

                    //this.Invoke(new DownloadErrorDelegate(DownloadError_Callback), e.Message);
                }
            }
            else
            {
                if (CustomDownloadError != null)
                {
                    this.CustomDownloadError("Downloaded file failed checksum, please try again or download direct from https://myrcon.net");
                }

                //this.Invoke(new DownloadErrorDelegate(DownloadError_Callback), "Downloaded file failed checksum, please try again or download direct from https://myrcon.com");
            }
        }
Exemplo n.º 34
0
        private void cdfPRoConUpdate_DownloadComplete(CDownloadFile cdfSender)
        {
            if (String.Compare(this.MD5Data(cdfSender.CompleteFileData), (string)cdfSender.AdditionalData, true) == 0)
            {
                string strUpdatesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this.m_updatesDirectoryName);

                try {
                    if (Directory.Exists(strUpdatesFolder) == false)
                    {
                        Directory.CreateDirectory(strUpdatesFolder);
                    }

                    using (ZipFile zip = ZipFile.Read(cdfSender.CompleteFileData)) {
                        zip.ExtractAll(strUpdatesFolder, ExtractExistingFileAction.OverwriteSilently);
                    }

                    if (this.DownloadUnzipComplete != null)
                    {
                        FrostbiteConnection.RaiseEvent(this.DownloadUnzipComplete.GetInvocationList());
                    }
                }
                catch (Exception e) {
                    if (this.CustomDownloadError != null)
                    {
                        FrostbiteConnection.RaiseEvent(this.CustomDownloadError.GetInvocationList(), e.Message);
                    }

                    //this.Invoke(new DownloadErrorDelegate(DownloadError_Callback), e.Message);
                }
            }
            else
            {
                if (this.CustomDownloadError != null)
                {
                    FrostbiteConnection.RaiseEvent(this.CustomDownloadError.GetInvocationList(), "Downloaded file failed checksum, please try again or download direct from http://phogue.net");
                }

                //this.Invoke(new DownloadErrorDelegate(DownloadError_Callback), "Downloaded file failed checksum, please try again or download direct from http://phogue.net");
            }
        }
Exemplo n.º 35
0
        private void CdfPRoConUpdate_DownloadComplete(CDownloadFile sender)
        {
            if (String.Compare(MD5Data(sender.CompleteFileData), (string)sender.AdditionalData, StringComparison.OrdinalIgnoreCase) == 0)
            {
                string updatesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, UpdatesDirectoryName);

                try
                {
                    if (Directory.Exists(updatesFolder) == false)
                    {
                        Directory.CreateDirectory(updatesFolder);
                    }

                    using (ZipFile zip = ZipFile.Read(sender.CompleteFileData))
                    {
                        zip.ExtractAll(updatesFolder, ExtractExistingFileAction.OverwriteSilently);
                    }

                    if (DownloadUnzipComplete != null)
                    {
                        this.DownloadUnzipComplete();
                    }
                }
                catch (Exception e)
                {
                    if (CustomDownloadError != null)
                    {
                        this.CustomDownloadError(e.Message);
                    }
                }
            }
            else
            {
                if (CustomDownloadError != null)
                {
                    this.CustomDownloadError("Downloaded file failed checksum, please try again or download direct from https://myrcon.net");
                }
            }
        }
Exemplo n.º 36
0
        private void portTest_DownloadComplete(CDownloadFile cdfSender)
        {
            // Do not environment this \n.  It's from the php script and will always be just \n
            string[] a_strResponses = Encoding.UTF8.GetString(cdfSender.CompleteFileData).Split('\n');

            if (a_strResponses.Length >= 1)
            {
                if (a_strResponses[0].CompareTo("open") == 0)
                {
                    this.picHttpServerForwardedTestStatus.Image = this.m_frmParent.picPortCheckerOpen.Image;

                    if (a_strResponses.Length >= 2)
                    {
                        this.lblHttpServerForwardedTestStatus.Text = this.m_praApplication.CurrentLanguage.GetLocalized("frmOptions.lblHttpServerForwardedTestStatus.Open", this.txtHttpServerStartPort.Text, a_strResponses[1]);

                        this.lnkHttpServerExampleLink.Text    = String.Format("http://{0}:{1}/connections", a_strResponses[1], this.txtHttpServerStartPort.Text);
                        this.lnkHttpServerExampleLink.Visible = true;
                    }
                    else
                    {
                        this.lblHttpServerForwardedTestStatus.Text = this.m_praApplication.CurrentLanguage.GetLocalized("frmOptions.lblHttpServerForwardedTestStatus.Open", this.txtHttpServerStartPort.Text, "");
                    }
                    this.lblHttpServerForwardedTestStatus.ForeColor = Color.ForestGreen;

                    this.lnkHttpServerForwardedTest.Enabled = true;
                }
                else if (a_strResponses[0].CompareTo("closed") == 0 || a_strResponses[0].CompareTo("error") == 0 || a_strResponses[0].CompareTo("denied") == 0)
                {
                    this.picHttpServerForwardedTestStatus.Image = this.m_frmParent.picPortCheckerClosed.Image;

                    this.lblHttpServerForwardedTestStatus.Text      = this.m_praApplication.CurrentLanguage.GetLocalized("frmOptions.lblHttpServerForwardedTestStatus.Closed", this.txtHttpServerStartPort.Text);
                    this.lblHttpServerForwardedTestStatus.ForeColor = Color.Maroon;

                    this.lnkHttpServerForwardedTest.Enabled = true;
                    this.lnkHttpServerExampleLink.Visible   = false;
                }
            }
        }
Exemplo n.º 37
0
 private void cdfBanner_DownloadError(CDownloadFile cdfSender) {
     this.lblSettingsDownloadedBannerURLError.Visible = true;
     this.picSettingsDownloadedBannerURL.Image = null;
 }
Exemplo n.º 38
0
        private void DownloadGameConfigFile(string strDownloadSource, string strGameConfigFilename)
        {
            lock (this.m_objDownloadingGameConfigs)
            {
                CDownloadFile cdfUpdatedGameConfig = new CDownloadFile(strDownloadSource, strGameConfigFilename);
                cdfUpdatedGameConfig.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(m_cdfUpdatedGameConfig_DownloadComplete);
                this.m_lstDownloadingGameConfigs.Add(cdfUpdatedGameConfig);

                cdfUpdatedGameConfig.BeginDownload();
            }
        }
Exemplo n.º 39
0
        private void cdfBanner_DownloadComplete(CDownloadFile cdfSender) {
            this.lblSettingsDownloadedBannerURLError.Visible = false;

            if (cdfSender != null) {
                MemoryStream msImage = new MemoryStream(cdfSender.CompleteFileData);
                Image imgCompleted = Image.FromStream(msImage);

                this.picSettingsDownloadedBannerURL.Image = imgCompleted;
            }
            else {
                this.picSettingsDownloadedBannerURL.Image = null;
            }
        }
Exemplo n.º 40
0
        private void portTest_DownloadComplete(CDownloadFile cdfSender) {

            // Do not environment this \n.  It's from the php script and will always be just \n
            string[] a_strResponses = Encoding.UTF8.GetString(cdfSender.CompleteFileData).Split('\n');

            if (a_strResponses.Length >= 1) {
                if (a_strResponses[0].CompareTo("open") == 0) {
                    
                    this.picHttpServerForwardedTestStatus.Image = this.m_frmParent.picPortCheckerOpen.Image;

                    if (a_strResponses.Length >= 2) {
                        this.lblHttpServerForwardedTestStatus.Text = this.m_praApplication.CurrentLanguage.GetLocalized("frmOptions.lblHttpServerForwardedTestStatus.Open", this.txtHttpServerStartPort.Text, a_strResponses[1]);

                        this.lnkHttpServerExampleLink.Text = String.Format("http://{0}:{1}/connections", a_strResponses[1], this.txtHttpServerStartPort.Text);
                        this.lnkHttpServerExampleLink.Visible = true;
                    }
                    else {
                        this.lblHttpServerForwardedTestStatus.Text = this.m_praApplication.CurrentLanguage.GetLocalized("frmOptions.lblHttpServerForwardedTestStatus.Open", this.txtHttpServerStartPort.Text, "");
                    }
                    this.lblHttpServerForwardedTestStatus.ForeColor = Color.ForestGreen;

                    this.lnkHttpServerForwardedTest.Enabled = true;
                }
                else if (a_strResponses[0].CompareTo("closed") == 0 || a_strResponses[0].CompareTo("error") == 0 || a_strResponses[0].CompareTo("denied") == 0) {
                    this.picHttpServerForwardedTestStatus.Image = this.m_frmParent.picPortCheckerClosed.Image;

                    this.lblHttpServerForwardedTestStatus.Text = this.m_praApplication.CurrentLanguage.GetLocalized("frmOptions.lblHttpServerForwardedTestStatus.Closed", this.txtHttpServerStartPort.Text);
                    this.lblHttpServerForwardedTestStatus.ForeColor = Color.Maroon;

                    this.lnkHttpServerForwardedTest.Enabled = true;
                    this.lnkHttpServerExampleLink.Visible = false;
                }
            }
        }
Exemplo n.º 41
0
        private void m_cdfUpdatedGameConfig_DownloadComplete(CDownloadFile cdfSender)
        {

            string strGameConfigFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs");

            try
            {
                if (Directory.Exists(strGameConfigFolder) == false)
                {
                    Directory.CreateDirectory(strGameConfigFolder);
                }

                using (ZipFile zip = ZipFile.Read(cdfSender.CompleteFileData))
                {
                    zip.ExtractAll(strGameConfigFolder, ExtractExistingFileAction.OverwriteSilently);
                }

                // GameConfigs require Procon restart
                if (this.m_blGameConfigHint == false)
                {
                    this.GameConfigInfo();
                }
            }
            catch (Exception) { }
        }
Exemplo n.º 42
0
 private void DownloadBannerURL(string strUrl) {
     if (strUrl != null) {
         this.m_cdfBanner = new CDownloadFile(strUrl);
         this.m_cdfBanner.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(cdfBanner_DownloadComplete);
         this.m_cdfBanner.DownloadError += new CDownloadFile.DownloadFileEventDelegate(cdfBanner_DownloadError);
         this.m_cdfBanner.BeginDownload();
     }
 }
Exemplo n.º 43
0
        private void focus_DownloadError(Package sender, CDownloadFile file) {
            this.UnregisterEvents(sender);

            if (this.PackageDownloadFail != null) {
                FrostbiteConnection.RaiseEvent(this.PackageDownloadFail.GetInvocationList(), this, sender);
            }
        }
Exemplo n.º 44
0
 private void packageDownload_DownloadError(CDownloadFile sender) {
     if (this.DownloadError != null) {
         this.Error = sender.Error;
         this.DownloadError(this, sender);
     }
 }
Exemplo n.º 45
0
        public void DownloadPackage(string extractPath) {
            CDownloadFile packageDownload = null;

            if (this.Uid.Length > 0 && this.Md5.Length > 0 && this.Version != null) {
                packageDownload = new CDownloadFile(String.Format("http://phogue.net/procon/packages/download.php?uid={0}&version={1}", this.Uid, this.Version), extractPath);

                packageDownload.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(packageDownload_DownloadComplete);
                packageDownload.DownloadError += new CDownloadFile.DownloadFileEventDelegate(packageDownload_DownloadError);
                packageDownload.DownloadProgressUpdate += new CDownloadFile.DownloadFileEventDelegate(packageDownload_DownloadProgressUpdate);

                packageDownload.BeginDownload();
            }
        }
Exemplo n.º 46
0
 public UpdateDownloader(string updatesDirectoryName) {
     UpdatesDirectoryName = updatesDirectoryName;
     VersionChecker = new CDownloadFile("https://repo.myrcon.com/procon1/version3.php");
     VersionChecker.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(VersionChecker_DownloadComplete);
 }
Exemplo n.º 47
0
 private void m_paProcon_UpdateDownloading(CDownloadFile cdfDownloading) {
     this.InvokeIfRequired(() => {
         cdfDownloading.DownloadProgressUpdate += new CDownloadFile.DownloadFileEventDelegate(cdfDownloading_DownloadProgressUpdate);
         cdfDownloading.DownloadError += new CDownloadFile.DownloadFileEventDelegate(cdfDownloading_DownloadError);
         cdfDownloading.DownloadDiscoveredFileSize += new CDownloadFile.DownloadFileEventDelegate(cdfDownloading_DownloadDiscoveredFileSize);
     });
 }
Exemplo n.º 48
0
        private void cdfDownloading_DownloadError(CDownloadFile cdfSender) {
            this.InvokeIfRequired(() => {
                this.toolStripDownloadProgress.Visible = false;

                this.toolStripDownloading.ForeColor = Color.Maroon;
                this.toolStripDownloading.Image = null;
                this.toolStripDownloading.Text = this.m_clocLanguage.GetLocalized("frmMain.toolStripDownloading.Error", cdfSender.Error);
            });
        }
 private void cdfBanner_DownloadError(CDownloadFile cdfSender)
 {
     this.lblSettingsDownloadedBannerURLError.Visible = true;
     this.picSettingsDownloadedBannerURL.Image        = null;
 }
Exemplo n.º 50
0
        private void portTest_DownloadError(CDownloadFile cdfSender) {
            this.picHttpServerForwardedTestStatus.Image = this.m_frmParent.picPortCheckerClosed.Image;

            this.lblHttpServerForwardedTestStatus.Text = this.m_praApplication.CurrentLanguage.GetLocalized("frmOptions.lblHttpServerForwardedTestStatus.Closed", this.txtHttpServerStartPort.Text);
            this.lblHttpServerForwardedTestStatus.ForeColor = Color.Maroon;

            this.lnkHttpServerForwardedTest.Enabled = true;
            this.lnkHttpServerExampleLink.Visible = false;
        }
Exemplo n.º 51
0
        private void VersionChecker_DownloadComplete(CDownloadFile cdfSender) {
 
            string[] a_strVersionData = System.Text.Encoding.UTF8.GetString(cdfSender.CompleteFileData).Split('\n');
            this.m_blGameConfigHint = false;

            if (a_strVersionData.Length >= 4 && (this.m_cdfPRoConUpdate == null || this.m_cdfPRoConUpdate.FileDownloading == false)) {

                bool blContinueFileDownload = true;

                try {
                    if (Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates")) == true) {
                        AssemblyName proconAssemblyName = AssemblyName.GetAssemblyName(Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates"), "PRoCon.exe"));

                        // If an update has already been downloaded but not installed..
                        if (new Version(a_strVersionData[0]).CompareTo(proconAssemblyName.Version) >= 0) {
                            blContinueFileDownload = false;
                        }
                    }
                }
                catch (Exception e) { }

                if (blContinueFileDownload == true) {

                    if (new Version(a_strVersionData[0]).CompareTo(Assembly.GetExecutingAssembly().GetName().Version) > 0) {
                        // Download file, alert or auto apply once complete with release notes.
                        this.m_cdfPRoConUpdate = new CDownloadFile(a_strVersionData[2], a_strVersionData[3]);
                        this.m_cdfPRoConUpdate.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(cdfPRoConUpdate_DownloadComplete);

                        if (this.UpdateDownloading != null) {
                            FrostbiteConnection.RaiseEvent(this.UpdateDownloading.GetInvocationList(), this.m_cdfPRoConUpdate);
                        }

                        this.m_cdfPRoConUpdate.BeginDownload();
                    }
                    else {

                        if (this.NoVersionAvailable != null) {
                            FrostbiteConnection.RaiseEvent(this.NoVersionAvailable.GetInvocationList());
                        }

                        lock (this.m_objDownloadingLocalizations) {
                            foreach (CDownloadFile cdfFile in this.m_lstDownloadingLocalizations) {
                                cdfFile.EndDownload();
                            }

                            this.m_lstDownloadingLocalizations.Clear();
                        }

                        lock (this.m_objDownloadingGameConfigs) {
                            foreach (CDownloadFile cdfFile in this.m_lstDownloadingGameConfigs) {
                                cdfFile.EndDownload();
                            }

                            this.m_lstDownloadingGameConfigs.Clear();
                        }

                        //ProConClient prcAnyClient = null;
                        //if (this.Connections.Count > 0) {
                        //    prcAnyClient = this.Connections[0];
                        //}


                        for (int i = 4; i < a_strVersionData.Length; i++) {
                            //string[] a_strVersionMd5s = a_strVersionData[i].Split(new char[] { ' ' });
                            List<string> lstExtensibilityVersion = Packet.Wordify(a_strVersionData[i]);

                            if (lstExtensibilityVersion.Count >= 4 && String.Compare(lstExtensibilityVersion[0], "localization", true) == 0) {

                                try {
                                    if (File.Exists(Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Localization"), lstExtensibilityVersion[2])) == true) {
                                        if (String.Compare(lstExtensibilityVersion[1], this.MD5File(Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Localization"), lstExtensibilityVersion[2])), true) != 0) {
                                            // Download new localization file and tell options to reload it once completed.
                                            this.DownloadLocalizationFile(lstExtensibilityVersion[3], lstExtensibilityVersion[2]);
                                            Thread.Sleep(100); // I don't know how many languages there may be later so sleep on it to prevent spam.
                                        }
                                    }
                                    else {
                                        // Download new localization file and tell options to load it once completed.
                                        this.DownloadLocalizationFile(lstExtensibilityVersion[3], lstExtensibilityVersion[2]);
                                        Thread.Sleep(100);
                                    }
                                }
                                catch (Exception) { }
                            }

                            // GameConfigs
                            if (lstExtensibilityVersion.Count >= 4 && String.Compare(lstExtensibilityVersion[0], "gameconfig", true) == 0 &&
                                this.m_praApplication.OptionsSettings.AutoCheckGameConfigsForUpdates == true)
                            {
                                try {
                                    if (File.Exists(Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs"), lstExtensibilityVersion[2])) == true)
                                    {
                                        if (String.Compare(lstExtensibilityVersion[1], this.MD5File(Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs"), lstExtensibilityVersion[2])), true) != 0)
                                        {
                                            // Download new GameConfig file 
                                            this.DownloadGameConfigFile(lstExtensibilityVersion[3], lstExtensibilityVersion[2]);
                                            Thread.Sleep(100); // we don't know how many will come.
                                        }
                                    } else {
                                        // Download new GameConfig file
                                        this.DownloadGameConfigFile(lstExtensibilityVersion[3], lstExtensibilityVersion[2]);
                                        Thread.Sleep(100);
                                    }
                                }
                                catch (Exception) { }
                            }
                        }
                    }
                }
                else {
                    this.DownloadedUnzippedComplete();
                }
            }
        }
Exemplo n.º 52
0
        //private void focus_DownloadProgressUpdate(Package sender, CDownloadFile file) {
        //    this.UnregisterEvents(sender);
        //}

        private void focus_DownloadComplete(Package sender, CDownloadFile file) {
            //this.UnregisterEvents(sender);

            if (this.PackageDownloaded != null) {
                FrostbiteConnection.RaiseEvent(this.PackageDownloaded.GetInvocationList(), this, sender);
            }
        }
Exemplo n.º 53
0
 private void packageDownload_DownloadProgressUpdate(CDownloadFile sender) {
     if (this.DownloadProgressUpdate != null) {
         this.DownloadProgressUpdate(this, sender);
     }
 }
Exemplo n.º 54
0
        private void lnkHttpServerForwardedTest_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {

            CDownloadFile portTest = new CDownloadFile("http://www.phogue.net/procon/testport.php?port=" + this.txtHttpServerStartPort.Text);
            portTest.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(portTest_DownloadComplete);
            portTest.DownloadError += new CDownloadFile.DownloadFileEventDelegate(portTest_DownloadError);

            this.picHttpServerForwardedTestStatus.Image = this.m_frmParent.picAjaxStyleLoading.Image;
            //this.tmrPortCheckTester.Enabled = true;
            this.lnkHttpServerForwardedTest.Enabled = false;
            this.lblHttpServerForwardedTestStatus.Text = this.m_praApplication.CurrentLanguage.GetLocalized("frmOptions.lblHttpServerForwardedTestStatus.Running", this.txtHttpServerStartPort.Text);
            this.lblHttpServerForwardedTestStatus.ForeColor = Color.Black;

            portTest.BeginDownload();
        }
Exemplo n.º 55
0
        private void packageDownload_DownloadComplete(CDownloadFile sender) {
            if (this.DownloadComplete != null) {
                this.DownloadComplete(this, sender);
            }

            if (String.Compare(this.MD5Data(sender.CompleteFileData), this.Md5, true) == 0) {

                string strUpdatesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, (string)sender.AdditionalData);

                try {
                    if (Directory.Exists(strUpdatesFolder) == false) {
                        Directory.CreateDirectory(strUpdatesFolder);
                    }

                    if (this.PackageBeginUnzip != null) {
                        this.PackageBeginUnzip(this);
                    }

                    using (ZipFile zip = ZipFile.Read(sender.CompleteFileData)) {
                        zip.ExtractAll(strUpdatesFolder, ExtractExistingFileAction.OverwriteSilently);
                    }

                    if (this.PackageEndUnzip != null) {
                        this.PackageEndUnzip(this);
                    }
                }
                catch (Exception e) {
                    if (this.PackageCustomDownloadError != null) {
                        this.Error = e.Message;
                        this.PackageCustomDownloadError(this, e.Message);
                    }
                }
            }
            else {
                this.Error = "Downloaded file failed checksum, please try again or download direct from http://phogue.net";
                if (this.PackageCustomDownloadError != null) {
                    this.PackageCustomDownloadError(this, "Downloaded file failed checksum, please try again or download direct from http://phogue.net");
                }
            }
        }
Exemplo n.º 56
0
        private void DownloadLocalizationFile(string strDownloadSource, string strLocalizationFilename) {
            lock (this.m_objDownloadingLocalizations) {
                CDownloadFile cdfUpdatedLocalization = new CDownloadFile(strDownloadSource, strLocalizationFilename);
                cdfUpdatedLocalization.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(m_cdfUpdatedLocalization_DownloadComplete);
                this.m_lstDownloadingLocalizations.Add(cdfUpdatedLocalization);

                cdfUpdatedLocalization.BeginDownload();
            }
        }
Exemplo n.º 57
0
        private void cdfDownloading_DownloadDiscoveredFileSize(CDownloadFile cdfSender) {
            this.InvokeIfRequired(() => {
                this.toolStripDownloading.ForeColor = SystemColors.WindowText;
                this.toolStripDownloading.Image = picAjaxStyleLoading.Image;
                this.toolStripDownloadProgress.Visible = true;

                this.toolStripDownloadProgress.Maximum = cdfSender.FileSize;
            });
        }
Exemplo n.º 58
0
        void VersionChecker_DownloadError(CDownloadFile cdfSender)
        {
            this.toolStripDownloadProgress.Visible = false;

            this.toolStripDownloading.ForeColor = Color.Maroon;
            this.toolStripDownloading.Image = null;
            this.toolStripDownloading.Text = this.m_clocLanguage.GetLocalized("frmMain.toolStripDownloading.Error", cdfSender.Error);
        }
Exemplo n.º 59
0
 private void cdfDownloading_DownloadProgressUpdate(CDownloadFile cdfSender) {
     this.InvokeIfRequired(() => {
         this.toolStripDownloadProgress.Value = cdfSender.BytesDownloaded;
         this.toolStripDownloading.Text = String.Format("{0} {1}", this.m_clocLanguage.GetLocalized("frmMain.toolStripDownloading", null), cdfSender.GetLabelProgress());
     });
 }
Exemplo n.º 60
0
 public UpdateDownloader(string updatesDirectoryName) {
     this.m_updatesDirectoryName = updatesDirectoryName;
     this.VersionChecker = new CDownloadFile("http://www.phogue.net/procon/version3.php");
     this.VersionChecker.DownloadComplete += new CDownloadFile.DownloadFileEventDelegate(VersionChecker_DownloadComplete);
 }