Beispiel #1
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)
                    {
                        FrostbiteConnection.RaiseEvent(CustomDownloadError.GetInvocationList(), e.Message);
                    }

                    //this.Invoke(new DownloadErrorDelegate(DownloadError_Callback), e.Message);
                }
            }
            else
            {
                if (CustomDownloadError != null)
                {
                    FrostbiteConnection.RaiseEvent(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");
            }
        }
Beispiel #2
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");
                }
            }
        }