public void UpdateInstallationInfo(InstallationInfo info, CancellationTokenSource cancellationToken) { CancellationTokenSource = cancellationToken; InstallationInfo = info; TxtName.Text = InstallationInfo.Name + " " + InstallationInfo.Version; }
public void TestInstallationInfoGuidResets() { using (ShimsContext.Create()) { // We shim the filesystem related methods. currentJson represents the current // state of what would be saved on disk string fakePath = "fake\\"; var currentJson = ""; ShimFile.ReadAllTextStringEncoding = (_, __) => { return(currentJson); }; ShimFile.ExistsString = (_) => !string.IsNullOrEmpty(currentJson); ShimFile.WriteAllTextStringStringEncoding = (_, json, __) => { currentJson = json; }; ShimDateTime.UtcNowGet = () => new DateTime(2015, 1, 1); InstallationInfo janInfo1 = InstallationInfo.LoadFromPath(fakePath); // The guid shouldn't reset if the month is the same InstallationInfo info2 = InstallationInfo.LoadFromPath(fakePath); Assert.AreEqual(janInfo1.InstallationGuid, info2.InstallationGuid); // A month has elapsed so the guid should reset DateTime februaryYearOne = new DateTime(2015, 2, 1); ShimDateTime.UtcNowGet = () => februaryYearOne; InstallationInfo febInfo = InstallationInfo.LoadFromPath(fakePath); Assert.AreNotEqual(janInfo1.InstallationGuid, febInfo.InstallationGuid); Assert.AreEqual(febInfo.LastReset, februaryYearOne); // although the old month (2) > current month(1), a year has elapsed // so the guid should reset DateTime januaryYearTwo = new DateTime(2016, 1, 1); ShimDateTime.UtcNowGet = () => januaryYearTwo; InstallationInfo janInfo2 = InstallationInfo.LoadFromPath(fakePath); Assert.AreNotEqual(febInfo.InstallationGuid, janInfo2.InstallationGuid); Assert.AreEqual(janInfo2.LastReset, januaryYearTwo); } }
/// <summary> /// Initializes a new instance of the <see cref="SystemInfo"/> class. /// </summary> public SystemInfo() { InProgressInstallations = new InstallationInfo[] { }; CompletedInstallations = new InstallationInfo[] { }; FailedPluginAssemblies = new string[] { }; }
public LicInfo(InstallationInfo info) { _installationInfo = info; if (info.Id > 0) { base.Key = new Key(info.Id); } }
public List <Dictionary <string, string> > GetKV(string query) { using (var stream = Get(query)) { if (stream == null) { return(null); } using (var streamReader = new StreamReader(stream)) return(InstallationInfo.ParseToDict(streamReader)); } }
private void InstallApplication() { if (!Page.IsValid) { return; } InstallationInfo inst = new InstallationInfo(); inst.PackageId = packageId; inst.ApplicationId = PanelRequest.ApplicationID; inst.WebSiteId = Utils.ParseInt(ddlWebSite.SelectedValue, 0); inst.VirtualDir = directoryName.Text; inst.DatabaseGroup = ddlDatabaseGroup.SelectedValue; inst.DatabaseId = Utils.ParseInt(ddlDatabase.SelectedValue, 0); inst.DatabaseName = databaseName.Text; inst.UserId = Utils.ParseInt(ddlUser.SelectedValue, 0); inst.Username = databaseUser.Text; inst.Password = databasePassword.Password; // get app settings try { if (settings != null) { settings.GetSettings(inst); } } catch (Exception ex) { ShowErrorMessage("APPINSTALLER_GET_SETTINGS", ex); } // install application try { int result = ES.Services.ApplicationsInstaller.InstallApplication(inst); if (result < 0) { ShowResultMessage(result); return; } } catch (Exception ex) { ShowErrorMessage("APPINSTALLER_INSTALL_APP", ex); return; } Response.Redirect(EditUrl("ApplicationID", PanelRequest.ApplicationID, "complete", PortalUtils.SPACE_ID_PARAM + "=" + PanelSecurity.PackageId.ToString())); }
public ConfigurationForm(String targetDirectory, IListener listener) { InitializeComponent(); this.installationInfo = null; this.listener = listener; String programFilesDir = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); txtTargetDirectory.Text = PathFormat.Adjust(programFilesDir) + "DataCount"; if (!String.IsNullOrEmpty(targetDirectory)) { txtTargetDirectory.Text = targetDirectory; } }
public void LoadFromPath_FileDoesNotExist_LastResetIsProvidedTime() { DateTime now = January2015; bool wasRefreshed = false; InstallationInfo.WriteToDiskOverride = (_, __) => wasRefreshed = true; InstallationInfo info = InstallationInfo.LoadFromPath(_testFolder, now); Assert.IsTrue(wasRefreshed); Assert.AreEqual(now, info.LastReset); Assert.AreNotEqual(InstallationGuid, info.InstallationGuid); }
public void LoadFromPath_FileIsCurrent_FileIsNotRefreshed() { DateTime now = January2015; bool wasRefreshed = false; InstallationInfo.WriteToDiskOverride = (_, __) => wasRefreshed = true; InstallationInfo.ReadFromDiskOverride = (_) => new InstallationInfo(InstallationGuid, now); InstallationInfo info = InstallationInfo.LoadFromPath(_testFolder, now); Assert.IsFalse(wasRefreshed); Assert.AreEqual(now, info.LastReset); Assert.AreEqual(InstallationGuid, info.InstallationGuid); }
private void __bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { Exception ex = e.Error; if (ex != null) { InstallationInfo.WriteException(ex); InstallationInfo.InstallationAborted = true; } WizardForm.LoadPage(Program.PageFFinished); }
private InstallationInfo GetInstallationInfoFromFoundInstallation(List <FileSystemPath> pluginFiles, Version newVersion) { var parentDirs = pluginFiles.Select(f => f.Directory).Distinct().ToList(); if (parentDirs.Count > 1) { myLogger.Warn("Plugin files detected in more than one directory."); return(InstallationInfo.FoundProblemWithExistingPlugins(pluginFiles)); } if (parentDirs.Count == 0) { myLogger.Warn("Plugin files do not have parent directory (?)."); return(InstallationInfo.FoundProblemWithExistingPlugins(pluginFiles)); } var pluginDir = parentDirs[0]; if (pluginFiles.Count == 1 && pluginFiles[0].Name == PluginPathsProvider.BasicPluginDllFile && pluginFiles[0].ExistsFile) { try { var existingVersion = new Version(FileVersionInfo.GetVersionInfo(pluginFiles[0].FullPath).FileVersion); // Always update to a debug version, even if the versions match if (IsDebugVersion(newVersion)) { return(InstallationInfo.ForceUpdateToDebugVersion(pluginDir, parentDirs, existingVersion)); } // If the versions are the same, don't update. Note that this means we will also DOWNGRADE if we // load the project in an older version of Rider. This is a good thing - always install the version // of the plugin that the version of Rider is expecting. "Update", not "upgrade" if (newVersion == existingVersion) { myLogger.Verbose($"Plugin v{existingVersion} already installed."); return(InstallationInfo.UpToDate(pluginFiles, existingVersion)); } return(InstallationInfo.ShouldUpdate(pluginDir, pluginFiles, existingVersion)); } catch (Exception) { // file may be in Solution-csproj, but doesn't exist on disk return(InstallationInfo.ForceUpdate(pluginDir, pluginFiles)); } } // update from Unity3dRider.cs to dll or both old and new plugins together return(InstallationInfo.ForceUpdate(pluginDir, pluginFiles)); }
public void Ctor_InstallationIdAndLastResetAreCorrectlySet() { DateTime[] dates = { January2015, February2015, January2016 }; Guid[] guids = { InstallationGuid, InstallationGuid2, InstallationGuid3 }; foreach (DateTime date in dates) { foreach (Guid guid in guids) { InstallationInfo info = new InstallationInfo(guid, date); Assert.AreEqual(date, info.LastReset); Assert.AreEqual(guid, info.InstallationGuid); } } }
public void LoadFromPath_FileIsFromDifferentMonth_FileIsRefreshedWithProvidedTime() { DateTime now = February2015; bool wasRefreshed = false; InstallationInfo.WriteToDiskOverride = (_, __) => wasRefreshed = true; InstallationInfo.ReadFromDiskOverride = (_) => new InstallationInfo(InstallationGuid, January2015); InstallationInfo info = InstallationInfo.LoadFromPath(_testFolder, now); Assert.IsTrue(wasRefreshed); Assert.AreEqual(now, info.LastReset); Assert.AreNotEqual(InstallationGuid, info.InstallationGuid); }
private bool TryFindInSolution(ICollection <IProject> unityProjects, [NotNull] out InstallationInfo result) { myLogger.Verbose("Looking for plugin in solution."); foreach (var project in unityProjects) { if (TryFindInProject(project, out result)) { return(true); } } result = ShouldNotInstall; return(false); }
private void InstallationOptionsPage_Load(object sender, EventArgs e) { String backupDir = @"%programfiles%\Anolis\Installer\Backup " + Miscellaneous.RemoveIllegalFileNameChars(PackageInfo.Package.Name, null) + "-" + DateTime.Now.ToString("yyyy-MM-dd hh-mm"); this.__backupPath.Text = PackageUtility.ResolvePath(backupDir); if (!PackageInfo.IgnoreCondition) { if (InstallationInfo.FailedCondition || !InstallationInfo.EvaluateInstallerCondition()) { __i386.Checked = true; __comp.Enabled = false; } } }
public virtual void Initialize() { string version = InstallationInfo.Version; if (InstallationInfo.Directory.StartsWith("/app", StringComparison.InvariantCulture)) { version += " (Flatpak)"; } Logger.LogInfo("Environment", "SparkleShare " + version); Logger.LogInfo("Environment", "Git LFS " + Sparkles.Git.GitCommand.GitLFSVersion); Logger.LogInfo("Environment", "Git " + Sparkles.Git.GitCommand.GitVersion); // TODO: Nice OS version names for Linux (Fedora 24, Ubuntu 16.04, etc.) if (InstallationInfo.OperatingSystem == OS.Mac) { Logger.LogInfo("Environment", InstallationInfo.MacOSVersion()); } else { Logger.LogInfo("Environment", InstallationInfo.OperatingSystem + " (" + Environment.OSVersion + ")"); } UserAuthenticationInfo = new SSHAuthenticationInfo(); SSHAuthenticationInfo.DefaultAuthenticationInfo = UserAuthenticationInfo; Preset.PresetsPath = PresetsPath; InstallProtocolHandler(); try { CreateSparkleShareFolder(); } catch (DirectoryNotFoundException) { this.lost_folders_path = true; } SetFolderIcon(); // Watch the SparkleShare folder this.watcher = new FileSystemWatcher() { Filter = "*", IncludeSubdirectories = false, Path = FoldersPath }; watcher.Created += OnFolderActivity; watcher.EnableRaisingEvents = true; }
private async void OnPluginInstalled(object sender, InstallationInfo e) { await CreateLogEntry(new ActivityLog( string.Format( CultureInfo.InvariantCulture, _localization.GetLocalizedString("PluginInstalledWithName"), e.Name), NotificationType.PluginInstalled.ToString(), Guid.Empty) { ShortOverview = string.Format( CultureInfo.InvariantCulture, _localization.GetLocalizedString("VersionNumber"), e.Version) }).ConfigureAwait(false); }
public void LoadFromPath_RoundTripThroughDisk_FileIsNotRefreshed() { // Note: Not strictly a unit test since it pushes data through the disk DateTime now = DateTime.UtcNow; Directory.CreateDirectory(_testFolder); InstallationInfo info1 = InstallationInfo.LoadFromPath(_testFolder, now); InstallationInfo info2 = InstallationInfo.LoadFromPath(_testFolder, now); Assert.AreEqual(now, info1.LastReset); Assert.AreEqual(info1.LastReset, info2.LastReset); Assert.AreNotEqual(InstallationGuid, info1.InstallationGuid); Assert.AreEqual(info1.InstallationGuid, info2.InstallationGuid); }
private bool TryFindOnDisk(FileSystemPath directory, [NotNull] out InstallationInfo result) { myLogger.Verbose("Looking for plugin on disk: '{0}'", directory); var pluginFiles = directory .GetChildFiles("*.cs") .Where(f => ourPluginFilesV180.Contains(f.Name) || f.Name == MergedPluginFile) .ToList(); if (pluginFiles.Count == 0) { result = ShouldNotInstall; return(false); } result = ExistingInstallation(pluginFiles); return(true); }
private static void ReplaceX86(InstallationInfo info) { String srcFilename = P.Combine(info.ExtractDirectory, GetUxFilename(info.Install)); String dstFilename = P.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), GetUxFilename(info.Install)); if (File.Exists(dstFilename)) { File.Delete(dstFilename); } File.Move(srcFilename, dstFilename); String finalName = P.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "UxTheme.dll"); PackageUtility.AddPfroEntry(dstFilename, finalName); }
private string GetManagerInstallationFolder(string gamePath) { List <InstallationInfo> savedInstallations = GetSavedInstallations(); InstallationInfo foundInstallation = savedInstallations.Find(x => x.Folder.Replace("\\", "/").Equals(gamePath.Replace("\\", "/"), StringComparison.InvariantCultureIgnoreCase)); if (foundInstallation == null) { int currentID = 1; while (savedInstallations.Exists(x => x.ID == currentID)) { currentID++; } foundInstallation = new InstallationInfo(gamePath, currentID); savedInstallations.Add(foundInstallation); SaveInstallations(savedInstallations); } return(Path.Combine(_managerFolderPath, "lol-manager", foundInstallation.ID.ToString())); }
private void Replace() { InstallationInfo info = GetInstallationInfo(); // extract the files ExtractFiles(Path, info.ExtractDirectory); if (info.Install == Install.NT522X64English) { ReplaceX64(info); } else { ReplaceX86(info); } Directory.Delete(info.ExtractDirectory, true); }
public void LoadFromPath_FileIsFromDifferentMonth_UnableToWrite_ReturnsRefreshedDataEachTime() { // Intentionally don't set WriteToDiskOverride so that we try to write to disk. // Since we haven't created a folder for _testFolder, the attempt to write to // disk will fail. This simulates the case where we're unable to update the // configuration file for whatever reason (file is locked, disk is full, etc.) DateTime now = February2015; InstallationInfo.ReadFromDiskOverride = (_) => new InstallationInfo(InstallationGuid, January2015); InstallationInfo info1 = InstallationInfo.LoadFromPath(_testFolder, now); InstallationInfo info2 = InstallationInfo.LoadFromPath(_testFolder, now); Assert.AreEqual(now, info1.LastReset); Assert.AreEqual(now, info2.LastReset); Assert.AreNotEqual(InstallationGuid, info1.InstallationGuid); Assert.AreNotEqual(InstallationGuid, info2.InstallationGuid); Assert.AreNotEqual(info1.InstallationGuid, info2.InstallationGuid); }
private bool TryFindInProject(IProject project, [NotNull] out InstallationInfo result) { if (!(project.ProjectFileLocation?.Directory.CombineWithShortName("Assets").ExistsDirectory).GetValueOrDefault()) { result = ShouldNotInstall; return(false); } var pluginFiles = project .GetAllProjectFiles(f => { var location = f.Location; if (location == null) { return(false); } var fileName = location.Name; return(ourPluginFilesV180.Contains(fileName) || fileName == MergedPluginFile); }) .Select(f => f.Location) .ToList(); var isMoved = pluginFiles.Any(f => !f.ExistsFile); if (isMoved) { myLogger.Verbose("Plugin was moved and solution was not updated. Will wait until user reopens updated solution."); result = ShouldNotInstall; return(true); } if (pluginFiles.Count == 0) { result = ShouldNotInstall; return(false); } result = ExistingInstallation(pluginFiles); return(true); }
public async Task does_not_update_when_new_installation_info_list_with_empty_objects() { // Arrange var newInstallationInfos = new List <InstallationInfo>(); foreach (short installationId in _installationIds) { var dbInstallationInfo = GetTestInstallationInfo( installationId, new DateTime()); _context.InstallationInfos.Add(dbInstallationInfo); } _context.SaveChanges(); for (int i = 0; i < _installationIds.Count + 1; i++) { var emptyInstallationInfo = new InstallationInfo(); newInstallationInfos.Add(emptyInstallationInfo); } var programController = new ProgramController( unitOfWork: _unitOfWork, installationIds: _installationIds, airlyInstallationDownloader: _downloaderMock.Object); // Act await programController.UpdateInstallationInfos(newInstallationInfos); var dbInstallationInfos = _context.InstallationInfos.OrderBy(i => i.InstallationId).ToList(); // Assert Assert.Equal(_installationIds.Count, dbInstallationInfos.Count); for (int i = 0; i < dbInstallationInfos.Count; i++) { Assert.Equal(_installationIds[i], dbInstallationInfos[i].InstallationId); } }
private void InstallIfNeeded(IVsShell shellService) { if (shellService == null) { ShellDialogs.Error(this, Resources.ErrorMessage_ShellServiceUnavailable); return; } ThreadHelper.ThrowIfNotOnUIThread(); shellService.GetProperty((int)__VSSPROPID2.VSSPROPID_VisualStudioDir, out object documentsDirObj); string documentsDir = documentsDirObj.ToString(); string targetPath = Path.Combine(documentsDir, "Visualizers"); InstallationInfo installedVersion = InstallationManager.GetInstallationInfo(targetPath); InstallationInfo availableVersion = InstallationManager.AvailableVersion; if (installedVersion.Installed && (installedVersion.Version == null || installedVersion.Version >= availableVersion.Version)) { return; } InstallationManager.Install(targetPath, out string error, out string warning); if (error != null) { ShellDialogs.Error(this, Res.ErrorMessageFailedToInstall(targetPath, error)); } else if (warning != null) { ShellDialogs.Warning(this, Res.WarningMessageInstallationFinishedWithWarning(targetPath, warning)); } else if (installedVersion.Installed && installedVersion.Version != null) { ShellDialogs.Info(this, Res.InfoMessageUpgradeFinished(installedVersion.Version, availableVersion.Version, targetPath)); } else { ShellDialogs.Info(this, Res.InfoMessageInstallationFinished(availableVersion.Version, targetPath)); } }
public void NotifyObject(Object obj) { if (obj is RegistrationInfo) { registrationInfo = (RegistrationInfo)obj; } if (obj is InstallationInfo) { installationInfo = (InstallationInfo)obj; } if (obj is ContentNotification) { content = ((ContentNotification)obj).content; } if (obj is DoNotRegisterNotification) { doNotRegister = true; // usuário optou por não ativar o produto (apenas instalar o papercut) } if (obj is Exception) { LogException((Exception)obj); } }
public override Dictionary <string, string> CreateInstallationInfo(string region) { using (StreamReader cdnsReader = new StreamReader(GetRoot($"/{client.GetProduct()}/cdns"))) { using (StreamReader versionReader = new StreamReader(GetRoot($"/{client.GetProduct()}/versions"))) { var cdns = InstallationInfo.ParseToDict(cdnsReader).FirstOrDefault(x => x["Name"] == region); var versions = InstallationInfo.ParseToDict(versionReader).FirstOrDefault(x => x["Region"] == region); var bi = new Dictionary <string, string> { { "Active", "1" }, { "InstallKey", "" }, { "IMSize", "" }, { "Tags", "Online NGDP" }, { "Armadillo", "" }, { "LastActivated", "0" }, { "BuildComplete", "1" } }; if (versions != null) { foreach (var pair in RenameMapVersions) { bi[pair.Value] = versions[pair.Key]; } } if (cdns != null) { foreach (var pair in RenameMapCDNs) { bi[pair.Value] = cdns[pair.Key]; } } return(bi); } } }
private bool TryFindOnDisk(FileSystemPath directory, [NotNull] out InstallationInfo result) { myLogger.Verbose("Looking for plugin on disk: '{0}'", directory); var oldPluginFiles = directory .GetChildFiles("*.cs") .Where(f => ourPluginCsFile.Contains(f.Name)) .ToList(); var pluginFiles = directory .GetChildFiles("*.dll") .Where(f => f.Name == PluginPathsProvider.BasicPluginDllFile) .ToList(); pluginFiles.AddRange(oldPluginFiles); if (pluginFiles.Count == 0) { result = ShouldNotInstall; return(false); } result = ExistingInstallation(pluginFiles); return(true); }
private void btnSubmit_Click(Object sender, EventArgs e) { // Verifica as informações fornecidas if (!CheckSubmitedInfo()) { return; } // Prepara o diretório de instalação if (!PrepareDirectory()) { return; } // Repassa as informações para o form principal installationInfo = new InstallationInfo(txtTargetDirectory.Text, txtLogDirectories.Text, copyLogDirectory); if (listener != null) { listener.NotifyObject(installationInfo); } // Fecha a janela this.Close(); }
private void Install(bool startMenuEntry, bool desktopShortcut, bool startAfterInstallation, bool installAllUsers, string installationFolder) { installInfo = new InstallationInfo(startMenuEntry, desktopShortcut, startAfterInstallation, installAllUsers, installationFolder); IsRunning = true; backgroundWorkerInstall.RunWorkerAsync(); }
protected bool Equals(InstallationInfo other) { return string.Equals(Version, other.Version) && UserSid == other.UserSid; }