コード例 #1
0
        protected void chkRestore_OnCheckedChanged(object sender, EventArgs e)
        {
            CheckBox checkbox = (CheckBox)sender;

            if (checkbox.Checked == true)
            {
                GridViewRow gridViewRow       = (GridViewRow)checkbox.Parent.Parent;
                string      fileName          = gridViewRow.Cells[5].Text;
                string      relativeDirectory = gridViewRow.Cells[3].Text;
                string      type       = gridViewRow.Cells[1].Text;
                string      container  = gridViewRow.Cells[2].Text;
                string      backupName = this.Target;

                if (relativeDirectory.Equals(" ", StringComparison.InvariantCultureIgnoreCase) == true)
                {
                    relativeDirectory = String.Empty;
                }


                if (_createBackupBeforeRestore == true)
                {
                    backupName = GetBackupNameFromPreviousAutoBackup(backupName);

                    AutoUpdateManager.CreateBackup("Auto Backup - Restoring from " + backupName);
                    _createBackupBeforeRestore = false;
                }

                AutoUpdateManager.RestoreFile(backupName, type, container, relativeDirectory, fileName);
            }

            _refreshRequired  = true;
            FilesWereRestored = true;
        }
コード例 #2
0
        protected void btnAddFile_Click(object sender, EventArgs e)
        {
            if (fuFileUpload.HasFile == true)
            {
                if (Path.GetExtension(fuFileUpload.FileName).ToLower() != ".zip")
                {
                    lblUploadStatus.Text = "Upload failed: please upload .zip files only! Use the File Manager to upload single files.";
                    return;
                }


                string tempFile = Path.GetTempFileName();
                fuFileUpload.SaveAs(tempFile);

                ICSharpCode.SharpZipLib.Zip.FastZip fastZip = new ICSharpCode.SharpZipLib.Zip.FastZip();

                string tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

                fastZip.ExtractZip(tempFile, tempDirectory, "");

                if (ValidateZipFileContainsOnlyOneLauncher(tempDirectory) == false)
                {
                    lblUploadStatus.Text = "Upload failed: upload package contains multiple launcher.exe files.";
                    return;
                }

                if (ValidateCombinedPackageAndZipFileContainOnlyOneLauncher(this.Target, tempDirectory) == false)
                {
                    lblUploadStatus.Text = "Upload failed: the package contains a launcher.exe that is in a different location in the zip file.";
                    return;
                }

                AutoUpdateManager.CreateBackup("AutoBackup - Uploading " + fuFileUpload.FileName + " to " + this.Target);

                AddUploadedFilesToPackage(this.Target, tempDirectory, tempDirectory);

                File.Delete(tempFile);
                Directory.Delete(tempDirectory, true);

                lblUploadStatus.Text = "Upload for " + fuFileUpload.FileName + " complete.";

                BindData();

                ucPackageContents.BindData();

                CheckPackageForUpdatedLauncher();
            }
        }
コード例 #3
0
ファイル: AutoUpdate.svc.cs プロジェクト: AllegianceZone/Auth
        public bool CreateBackup(string backupName)
        {
            CheckAccess();

            return(AutoUpdateManager.CreateBackup(backupName));
        }