private void BindData()
        {
            List <FileCollision>            fileCollisions     = new List <FileCollision>();
            Dictionary <string, UpdateItem> filesInPublication = new Dictionary <string, UpdateItem>();

            AutoUpdateManager.TryGetPublicationFiles(PublicationID, out filesInPublication, out fileCollisions);

            if (fileCollisions.Count > 0)
            {
                pFileCollisions.Visible   = true;
                pNoFileCollisions.Visible = false;

                pPublishMergedPublications.Visible  = DeployPublication;
                pDownloadMergedPublications.Visible = DeployPublication == false;

                gvCollisions.DataSource = fileCollisions;
                gvCollisions.DataBind();
            }
            else
            {
                pNoFileCollisions.Visible = false;
                pFileCollisions.Visible   = false;

                if (DeployPublication == true)
                {
                    btnDeployPublication_Click(this, EventArgs.Empty);
                }
                else
                {
                    pNoFileCollisions.Visible = true;
                }
            }

            PublicationDownloaderUrl = "PublicationDownloaderIframe.aspx?target=" + PublicationID;
        }
        private void BindData()
        {
            using (var db = new DataAccess.CSSDataContext())
            {
                DataAccess.Lobby lobby = db.Lobbies.FirstOrDefault(p => p.Id == PublicationID);

                txtBasePath.Text       = lobby.BasePath;
                txtHost.Text           = lobby.Host;
                txtLobbyName.Text      = lobby.Name;
                chkEnabled.Checked     = lobby.IsEnabled;
                chkRestrictive.Checked = lobby.IsRestrictive;
            }


            List <FileInfo> packageInfos = AutoUpdateManager.GetPackages();

            List <Data.EditablePublication> packages = new List <Data.EditablePublication>();

            foreach (FileInfo packageInfo in packageInfos)
            {
                packages.Add(new Data.EditablePublication()
                {
                    IsIncluded = AutoUpdateManager.IsPackageExcludedFromPublication(PublicationID, packageInfo.Name) == false,
                    Name       = packageInfo.Name
                });
            }

            gvPackages.DataSource = packages;
            gvPackages.DataBind();
        }
        public void BindData()
        {
            List <UpdateItem> updateItems = AutoUpdateManager.GetFilesInUpdatePackage(Target).OrderBy(p => p.RelativeDirectory).ThenBy(p => p.Name).ToList();

            foreach (UpdateItem updateItem in updateItems)
            {
                updateItem.RelativeDirectory = updateItem.RelativeDirectory.Replace("\\", "\\\\");
            }

            gvPackageFiles.Visible = updateItems.Count() > 0;

            if (ShowDelete == false)
            {
                foreach (DataControlField c in gvPackageFiles.Columns)
                {
                    if (c.HeaderText == "Delete")
                    {
                        c.Visible = false;
                    }
                }
            }

            gvPackageFiles.DataSource = updateItems;
            gvPackageFiles.DataBind();
        }
Example #4
0
        private void BindData()
        {
            txtPackageName.Text = Target;

            if (String.IsNullOrEmpty(Target) == false)
            {
                FileInfo packageInfo = AutoUpdateManager.GetPackageInfo(Target);
                txtCreateDate.Text         = Format.DateTime(packageInfo.CreationTime);
                txtLastModifiedDate.Text   = Format.DateTime(packageInfo.LastWriteTime);
                tblPackageContents.Visible = true;
            }
            else
            {
                tblPackageContents.Visible = false;
            }

            var packageGuid = AutoUpdateManager.GetPackageGuid(this.Target);

            List <Lobby> availablePublications = new List <Lobby>();

            foreach (Lobby lobby in AutoUpdateManager.GetPublications())
            {
                foreach (var includedPackageGuid in AutoUpdateManager.GetIncludedPackageGuids(lobby.Id))
                {
                    if (includedPackageGuid == packageGuid && availablePublications.Contains(lobby) == false)
                    {
                        availablePublications.Add(lobby);
                    }
                }
            }

            // Bind the availablePublications to the repeater.
            rptQuickDeploy.DataSource = availablePublications;
            rptQuickDeploy.DataBind();
        }
Example #5
0
        private void BindData()
        {
            List <Data.BackupItem> backupItems = new List <Allegiance.CommunitySecuritySystem.Management.Content.AutoUpdate.Data.BackupItem>();

            List <FileInfo> backupInfos = AutoUpdateManager.GetAvailableBackups();

            foreach (FileInfo backupInfo in backupInfos)
            {
                backupItems.Add(new Data.BackupItem()
                {
                    Name         = Path.GetFileName(backupInfo.Name),
                    DateCreated  = Format.DateTime(backupInfo.CreationTime),
                    LastModified = Format.DateTime(backupInfo.LastWriteTime)
                });
            }

            if (backupItems.Count > 0)
            {
                gvBackups.DataSource = backupItems;
                gvBackups.DataBind();
            }
            else
            {
                lblNoBackups.Visible = true;
                gvBackups.Visible    = false;
            }
        }
        private async void UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            statusTextBlock.Text = "Getting the latest update information...";

            var path = "http://localhost:5000/install/SampleApp.appinstaller";
            var info = await AutoUpdateManager.CheckForUpdatesAsync(path);

            if (!info.Succeeded)
            {
                statusTextBlock.Text = info.ErrorMessage;
                return;
            }

            if (!info.ShouldUpdate)
            {
                statusTextBlock.Text = "This app is already up-to-date :)";
                return;
            }

            // You can use info.MainBundleVersion to get the update version
            statusTextBlock.Text = $"New version: {info.MainBundleVersion}";

            var result = await AutoUpdateManager.TryToUpdateAsync(info);

            if (!result.Succeeded)
            {
                statusTextBlock.Text = result.ErrorMessage;
                return;
            }

            statusTextBlock.Text = $"Success! The app will be restarted soon, see you later!";
        }
 protected void btnDeployPublication_Click(object sender, EventArgs e)
 {
     if (AutoUpdateManager.DeployPublication(PublicationID) == true)
     {
         if (String.IsNullOrEmpty(PackageName) == true)
         {
             Response.Redirect("EditPublication.aspx?target=" + PublicationID + "&publicationDeployed=1", true);
         }
         else
         {
             Response.Redirect("EditPackage.aspx?target=" + PackageName + "&publicationDeployed=1", true);
         }
     }
     else
     {
         if (String.IsNullOrEmpty(PackageName) == true)
         {
             Response.Redirect("EditPublication.aspx?target=" + PublicationID + "&publicationDeployFailed=1", true);
         }
         else
         {
             Response.Redirect("EditPackage.aspx?target=" + PackageName + "&publicationDeployFailed=1", true);
         }
     }
 }
        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("&nbsp;", 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;
        }
Example #9
0
        protected void btnSavePackageDetails_Click(object sender, EventArgs e)
        {
            if (txtPackageName.Text.Equals(Target, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                bool packageNameUpdated;

                if (String.IsNullOrEmpty(Target) == true)
                {
                    packageNameUpdated = AutoUpdateManager.CreatePackage(txtPackageName.Text);
                }
                else
                {
                    packageNameUpdated = AutoUpdateManager.RenamePackage(Target, txtPackageName.Text);
                }

                if (packageNameUpdated == true)
                {
                    Response.Redirect("EditPackage.aspx?target=" + Server.UrlEncode(txtPackageName.Text));
                }
                else
                {
                    cvPackageExists.IsValid = false;
                }
            }
        }
Example #10
0
 public MatchesController(Context context, IMapper mapper, ApiFootballDataClient client)
 {
     _context        = context;
     _matchDAO       = new MatchManager(context, mapper);
     _autoUpdate     = new AutoUpdateManager(context, client);
     _rankingManager = new RankingManager(context);
     _mapper         = mapper;
 }
Example #11
0
 protected void cvPackageExists_ServerValidate(object source, ServerValidateEventArgs args)
 {
     if (txtPackageName.Text.Equals(Target, StringComparison.InvariantCultureIgnoreCase) == false)
     {
         args.IsValid = (AutoUpdateManager.DoesPackageExist(txtPackageName.Text) == false);
     }
     else
     {
         args.IsValid = true;
     }
 }
Example #12
0
        /// <summary>
        /// 服务端消息接收事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void WebSocket4Net_MessageReceived(object sender, MessageReceivedEventArgs e)
        {
            AutoUpdateManager autoUpdateManager = new AutoUpdateManager();
            FileVersionInfo   fv = FileVersionInfo.GetVersionInfo(Path.Combine(Application.StartupPath, autoUpdateManager.exeName));

            if (fv.FileVersion.Equals(e.Message))
            {
                string updateFileUri = ConfigurationManager.AppSettings["UpdateFileUri"];
                autoUpdateManager.SilenceUpdate(updateFileUri);
            }
        }
        protected void chkIncluded_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox checkbox = (CheckBox)sender;

            GridViewRow gridViewRow = (GridViewRow)checkbox.Parent.Parent;
            string      fileName    = gridViewRow.Cells[0].Text;

            AutoUpdateManager.SetPackageInclusionForPublication(PublicationID, fileName, checkbox.Checked);

            BindData();
        }
Example #14
0
        private void CleanUpPackageDirectories(List <UpdateItem> updateItems, string rootDirectory, string sourceDirectory)
        {
            string relativeDirectory = sourceDirectory.Substring(rootDirectory.Length).TrimStart(new char[] { '\\' });

            foreach (UpdateItem updateItem in updateItems)
            {
                if (Directory.Exists(Path.Combine(rootDirectory, updateItem.RelativeDirectory)) == false)
                {
                    AutoUpdateManager.DeleteFolderFromPackage(this.Target, updateItem.RelativeDirectory);
                }
            }
        }
Example #15
0
        private void CommitItems(List <UpdateItem> updateItems, string rootDirectory, string sourceDirectory)
        {
            string relativeDirectory = sourceDirectory.Substring(rootDirectory.Length).TrimStart(new char [] { '\\' });

            foreach (string directory in Directory.GetDirectories(sourceDirectory))
            {
                CommitItems(updateItems, rootDirectory, directory);
            }

            foreach (string filename in Directory.GetFiles(sourceDirectory))
            {
                bool foundExistingItem = false;
                foreach (UpdateItem updateItem in updateItems)
                {
                    if (updateItem.RelativeDirectory == relativeDirectory && updateItem.Name == Path.GetFileName(filename))
                    {
                        AutoUpdateManager.DeleteFileFromPackage(this.Target, updateItem.RelativeDirectory, updateItem.Name);
                        AutoUpdateManager.AddFileToPackage(this.Target, relativeDirectory, filename);

                        if (updateItem.IsProtected == true)
                        {
                            AutoUpdateManager.SetFileProtectionForPackage(this.Target, relativeDirectory, Path.GetFileName(filename), updateItem.IsProtected);
                        }

                        if (updateItem.IsIncluded == false)
                        {
                            AutoUpdateManager.SetFileInclusionForPackage(this.Target, relativeDirectory, Path.GetFileName(filename), updateItem.IsIncluded);
                        }

                        foundExistingItem = true;
                        break;
                    }
                }

                if (foundExistingItem == false)
                {
                    AutoUpdateManager.AddFileToPackage(this.Target, relativeDirectory, filename);
                }
            }

            // Clean up files that are no longer in the package.
            foreach (UpdateItem updateItem in updateItems)
            {
                if (updateItem.RelativeDirectory == relativeDirectory)
                {
                    if (File.Exists(Path.Combine(sourceDirectory, updateItem.Name)) == false)
                    {
                        AutoUpdateManager.DeleteFileFromPackage(this.Target, updateItem.RelativeDirectory, updateItem.Name);
                    }
                }
            }
        }
        protected void txtFileToDelete_ValueChanged(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtFileToDelete.Value) == true)
            {
                return;
            }

            AutoUpdateManager.DeleteFileFromPackage(Target, txtFileToDeleteRelativeDirectory.Value, txtFileToDelete.Value);

            txtFileToDelete.Value = "";

            BindData();
        }
Example #17
0
        public void SetUp()
        {
            _achievementServiceMock = new DynamicMock(typeof(IAchievementService));
            _userServiceMock        = new DynamicMock(typeof(IUserService));
            _loggerMock             = new DynamicMock(typeof(IAutoUpdateLogger));
            _publisherMock          = new DynamicMock(typeof(IFacebookPublisher));

            IAchievementService achievementService = (IAchievementService)_achievementServiceMock.MockInstance;
            IUserService        userService        = (IUserService)_userServiceMock.MockInstance;
            IAutoUpdateLogger   logger             = (IAutoUpdateLogger)_loggerMock.MockInstance;
            IFacebookPublisher  publisher          = (IFacebookPublisher)_publisherMock.MockInstance;

            _manager = new AutoUpdateManager(achievementService, userService, publisher, logger);
        }
Example #18
0
        private void AddUploadedFilesToPackage(string packageName, string rootDirectory, string currentDirectory)
        {
            foreach (string directory in Directory.GetDirectories(currentDirectory))
            {
                AddUploadedFilesToPackage(packageName, rootDirectory, directory);
            }

            string relativeDirectory = currentDirectory.Substring(rootDirectory.Length).TrimStart(new char[] { '\\' });

            foreach (string filename in Directory.GetFiles(currentDirectory))
            {
                AutoUpdateManager.AddFileToPackage(packageName, relativeDirectory, filename);
            }
        }
Example #19
0
        private void BindData()
        {
            StringBuilder allCheckboxesToSelect = new StringBuilder();


            BackupItems backupItems = AutoUpdateManager.GetFilesInBackup(this.Target);

            BackupCreationDate = Format.DateTime(AutoUpdateManager.GetBackupInfo(this.Target).CreationTime);

            List <Data.RestorableFile> restorableFiles = new List <ACSSAuth.Management.Content.AutoUpdate.Data.RestorableFile>();

            foreach (UpdateItem packageFile in backupItems.PackageFiles)
            {
                string includedImage;
                string protectedImage;

                if (packageFile.IsIncluded == false)
                {
                    includedImage = Page.ResolveUrl("~/Images/dg_excluded.png");
                }
                else
                {
                    includedImage = Page.ResolveUrl("~/Images/dg_included.png");
                }

                if (packageFile.IsProtected == true)
                {
                    protectedImage = Page.ResolveUrl("~/Images/dg_protected.png");
                }
                else
                {
                    protectedImage = Page.ResolveUrl("~/Images/dg_unprotected.png");
                }

                restorableFiles.Add(new ACSSAuth.Management.Content.AutoUpdate.Data.RestorableFile()
                {
                    Container         = packageFile.PackageName,
                    DateCreated       = Format.DateTime(packageFile.FileInfo.CreationTime),
                    LastModified      = Format.DateTime(packageFile.FileInfo.LastWriteTime),
                    Name              = packageFile.Name,
                    Type              = "Packages",
                    IncludedImage     = includedImage,
                    ProtectedImage    = protectedImage,
                    RelativeDirectory = packageFile.RelativeDirectory                     //.Substring(packageFile.PackageName.Length).TrimStart(new char [] {'\\'})
                });
            }

            gvBackupFiles.DataSource = restorableFiles;
            gvBackupFiles.DataBind();
        }
        public void SetUp()
        {
            _achievementServiceMock = new Mock <IAchievementService>();
            _userServiceMock        = new Mock <IUserService>();
            _loggerMock             = new Mock <IAutoUpdateLogger>();
            _publisherMock          = new Mock <IFacebookPublisher>();

            IAchievementService achievementService = _achievementServiceMock.Object;
            IUserService        userService        = _userServiceMock.Object;
            IAutoUpdateLogger   logger             = _loggerMock.Object;
            IFacebookPublisher  publisher          = _publisherMock.Object;

            _manager = new AutoUpdateManager(achievementService, userService, publisher, logger);
        }
Example #21
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();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            List <FileCollision>            fileCollisions     = new List <FileCollision>();
            Dictionary <string, UpdateItem> filesInPublication = new Dictionary <string, UpdateItem>();

            AutoUpdateManager.TryGetPublicationFiles(PublicationID, out filesInPublication, out fileCollisions);

            string publicationName = AutoUpdateManager.GetPublicationName(PublicationID);

            string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            Directory.CreateDirectory(tempPath);

            foreach (string filename in filesInPublication.Keys)
            {
                string targetFile = Path.Combine(tempPath, filename);

                if (Directory.Exists(Path.GetDirectoryName(targetFile)) == false)
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(targetFile));
                }


                File.Copy(filesInPublication[filename].FileInfo.FullName, targetFile, true);
            }

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

            string zipFilename = Path.GetTempFileName();

            fastZip.CreateZip(zipFilename, tempPath, true, String.Empty);

            byte[] outputBytes = File.ReadAllBytes(zipFilename);

            Directory.Delete(tempPath, true);

            File.Delete(zipFilename);


            Response.ContentType = "application/zip";
            Response.AddHeader("Content-Disposition", "attachment; filename=" + publicationName + ".zip");
            Response.AddHeader("ContentLength", outputBytes.Length.ToString());


            Response.BinaryWrite(outputBytes);
        }
Example #23
0
        protected bool CommitChanges()
        {
            List <UpdateItem> updateItems = AutoUpdateManager.GetFilesInUpdatePackage(this.Target);

            string workingDirectory = Server.MapPath("~/TempFiles/" + this.Target);

            if (FindAllLauncherInstancesForDirectory(workingDirectory) > 1)
            {
                lblErrorMessage.Text = "Multiple launcher.exe instances found. Only one launcher.exe may be specified.";
                return(false);
            }

            CommitItems(updateItems, workingDirectory, workingDirectory);

            CleanUpPackageDirectories(updateItems, workingDirectory, workingDirectory);

            return(true);
        }
Example #24
0
        private void BindData()
        {
            List <FileInfo>             packageInfos = AutoUpdateManager.GetPackages();
            List <Data.EditablePackage> packages     = new List <Data.EditablePackage>();

            foreach (FileInfo packageInfo in packageInfos)
            {
                packages.Add(new Data.EditablePackage()
                {
                    DateCreated  = Format.DateTime(packageInfo.CreationTime),
                    LastModified = Format.DateTime(packageInfo.LastWriteTime),
                    Name         = packageInfo.Name
                });
            }

            gvPackages.DataSource = packages;
            gvPackages.DataBind();
        }
Example #25
0
        protected void wcFileManager_SelectedItemsAction(object sender, IZ.WebFileManager.SelectedItemsActionCancelEventArgs e)
        {
            //string relativePath = e.DestinationDirectory.FileManagerPath.Replace('/', '\\').TrimStart(new char[] { '\\' });
            string destinationRelativePath = TrimPackageNameFromVirtualPathAndMakeRelative(this.Target, e.DestinationDirectory.FileManagerPath);

            switch (e.Action)
            {
            case IZ.WebFileManager.SelectedItemsAction.Copy:
                foreach (var selectedItem in e.SelectedItems)
                {
                    string sourceFile = TrimPackageNameFromVirtualPathAndMakeRelative(this.Target, selectedItem.FileManagerPath);
                    AutoUpdateManager.CopyFileInPackage(this.Target, Path.GetDirectoryName(sourceFile), Path.GetFileName(sourceFile), destinationRelativePath);
                }
                break;

            case IZ.WebFileManager.SelectedItemsAction.Delete:
                foreach (var selectedItem in e.SelectedItems)
                {
                    if ((File.GetAttributes(selectedItem.PhysicalPath) & FileAttributes.Directory) == FileAttributes.Directory)
                    {
                        AutoUpdateManager.DeleteFolderFromPackage(this.Target, destinationRelativePath);
                    }
                    else
                    {
                        AutoUpdateManager.DeleteFileFromPackage(this.Target, destinationRelativePath, Path.GetFileName(selectedItem.PhysicalPath));
                    }
                }
                break;

            case IZ.WebFileManager.SelectedItemsAction.Move:
                foreach (var selectedItem in e.SelectedItems)
                {
                    if ((File.GetAttributes(selectedItem.PhysicalPath) & FileAttributes.Directory) == FileAttributes.Directory)
                    {
                        AutoUpdateManager.MoveFolderInPackage(this.Target, TrimPackageNameFromVirtualPathAndMakeRelative(this.Target, selectedItem.FileManagerPath), destinationRelativePath);
                    }
                    else
                    {
                        AutoUpdateManager.MoveFileInPackage(this.Target, TrimPackageNameFromVirtualPathAndMakeRelative(this.Target, selectedItem.FileManagerPath), Path.GetFileName(selectedItem.PhysicalPath), destinationRelativePath, Path.GetFileName(selectedItem.PhysicalPath));
                    }
                }
                break;
            }
        }
Example #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.PageHeader = "CSS - File Manager";

            if (this.IsPostBack == false)
            {
                List <UpdateItem> updateItems = AutoUpdateManager.GetFilesInUpdatePackage(this.Target);

                string workingDirectory = Server.MapPath("~/TempFiles/" + this.Target);

                if (Directory.Exists(workingDirectory) == true)
                {
                    Directory.Delete(workingDirectory, true);
                }

                Directory.CreateDirectory(workingDirectory);

                foreach (UpdateItem updateItem in updateItems)
                {
                    string targetDirectory = Path.Combine(workingDirectory, updateItem.RelativeDirectory);
                    if (Directory.Exists(targetDirectory) == false)
                    {
                        Directory.CreateDirectory(targetDirectory);
                    }

                    string destinationFile = Path.Combine(targetDirectory, updateItem.Name);
                    File.Copy(updateItem.FileInfo.FullName, destinationFile, true);
                }

                //FileInfo packageInfo = AutoUpdateManager.GetPackageInfo(this.Target);
                //CopyItemsToTempDirectory(packageInfo.FullName, workingDirectory);

                wcFileManager.RootDirectories.Add(new IZ.WebFileManager.RootDirectory()
                {
                    DirectoryPath = "~/TempFiles/" + this.Target,
                    Text          = this.Target,
                    ShowRootIndex = false
                });
            }
        }
Example #27
0
        private async Task <bool> DoApplicationUpdateIfRequired()
        {
            if (!ApplicationUpdateInformation.ShouldUpdate)
            {
                System.Diagnostics.Debug.WriteLine("DoApplicationUpdateIfRequired() was called, but there is no update for the app!");
                return(true);
            }

            var result = await AutoUpdateManager.TryToUpdateAsync(ApplicationUpdateInformation);

            if (!result.Succeeded)
            {
                UpdateLauncherButton.IsEnabled = true;
                await new ROR2ModManager.GenericDialogs.UpdateFailedDialog("Error Message: " + result.ErrorMessage).ShowAsync();
                Analytics.TrackEvent(AnalyticsEventNames.DwrandazUpdateManager, new Dictionary <string, string> {
                    { "event", "UpdateFailed" }, { "message", result.ErrorMessage }
                });
                System.Diagnostics.Debug.WriteLine("AutoUpdateManager The update failed");
                return(false);
            }
            return(true);
        }
Example #28
0
        private void Properties_OnChanged(TaskbarProperties.ChangedFields changes)
        {
            DisplayClock();

            var taskbarLocation = this.TaskbarLocation;

            SetPosition(changes.HasFlag(TaskbarProperties.ChangedFields.AutoHide), taskbarLocation);

            if (changes.HasFlag(TaskbarProperties.ChangedFields.MirrorButtons))
            {
                if (TaskbarPropertiesManager.Instance.Properties.MirrorButtons)
                {
                    WindowManager.Instance.MoveProgramsToPrimary();
                    WindowManager.Instance.MoveProgramsToTaskbars();
                }
                else
                {
                    flowPanel.Reset();
                    WindowManager.Instance.MoveProgramsToTaskbars();
                }
            }

            pnlNotificationArea.Visible = TaskbarPropertiesManager.Instance.Properties.ShowNotificationArea;

            if (TaskbarPropertiesManager.Instance.Properties.AutoHide)
            {
                this.Autohide(true);
            }
            else
            {
                this.Autohide(false);
            }

            AutoUpdateManager.Run(this);

            ABSetPos(changes.HasFlag(TaskbarProperties.ChangedFields.AutoHide));
        }
Example #29
0
        private bool ValidateCombinedPackageAndZipFileContainOnlyOneLauncher(string targetPackage, string tempDirectory)
        {
            List <string>     launcherInstancesInZipFile    = GetLauncherInstancesInDirectory(tempDirectory);
            List <string>     launcherIntancesInPackageFile = new List <string>();
            List <UpdateItem> updateItems = AutoUpdateManager.GetFilesInUpdatePackage(targetPackage);

            //string packagePath = Path.Combine(AutoUpdateManager.PackageRoot, targetPackage);

            int matchedItemCounter = 0;

            foreach (UpdateItem updateItem in updateItems)
            {
                if (updateItem.Name.Equals("launcher.exe", StringComparison.InvariantCultureIgnoreCase) == true)
                {
                    string updateItemRelativeFilename = Path.Combine(updateItem.RelativeDirectory, updateItem.Name);
                    launcherIntancesInPackageFile.Add(updateItemRelativeFilename);

                    foreach (string zipFileLauncherInstance in launcherInstancesInZipFile)
                    {
                        string relativePath = zipFileLauncherInstance.Substring(tempDirectory.Length + 1);

                        if (relativePath.Equals(updateItemRelativeFilename, StringComparison.InvariantCultureIgnoreCase) == true)
                        {
                            matchedItemCounter++;
                            break;
                        }
                    }
                }
            }

            if (launcherInstancesInZipFile.Count + launcherIntancesInPackageFile.Count - matchedItemCounter > 1)
            {
                return(false);
            }

            return(true);
        }
Example #30
0
        private void CheckPackageForUpdatedLauncher()
        {
            List <UpdateItem> filesInPackage = AutoUpdateManager.GetFilesInUpdatePackage(txtPackageName.Text);

            UpdateItem launcherInstance = filesInPackage.FirstOrDefault(p => p.Name.ToLower() == "launcher.exe");

            if (launcherInstance != null)
            {
                // Create new launcher hash.
                using (SHA256Managed sha = new SHA256Managed())
                    using (FileStream fs = File.Open(launcherInstance.FileInfo.FullName, FileMode.Open, FileAccess.Read))
                    {
                        byte[] hash;

                        if (Settings.Default.UseDebugBlackBox == true)
                        {
                            hash = new byte[] { 0x37, 0x61, 0xA7, 0x4B, 0x7E, 0x31, 0xC8, 0x5E, 0xD1, 0xC0, 0xF7, 0xB3,
                                                0x95, 0xD4, 0x7E, 0x64, 0xB9, 0xC3, 0x22, 0xED, 0x2F, 0x6F, 0xF8, 0xEB,
                                                0x4D, 0xA1, 0x00, 0x9A, 0x35, 0xE5, 0x10, 0x19 };
                        }
                        else
                        {
                            hash = sha.ComputeHash(fs);
                        }

                        File.WriteAllBytes(Settings.Default.KnownHashLocation, hash);
                    }

                // Invalidate all existing blackboxes to force regeneration of key tokens.
                using (CSSDataContext db = new CSSDataContext())
                {
                    // TODO: Is there a LINQ native way to do this?
                    db.ExecuteCommand("UPDATE ActiveKey SET IsValid = 0");
                    db.SubmitChanges();
                }
            }
        }