public void Execute(object parameter) { bool isEnum = parameter is InstallType; if (!isEnum) { throw new ArgumentException("Command parameter must be of InstallType."); } InstallType type = (InstallType)parameter; bool success = LaunchInstallUtil(type); string message; switch (type) { case InstallType.Install: message = success ? "Service installed." : "Service installation failed"; break; case InstallType.Uninstall: message = success ? "Service uninstalled." : "Service uninstallation failed"; break; default: throw new InvalidOperationException("Switch default case in Execute"); } programSettings.MainWindow.StatusBarText = message; }
/// <summary> /// Checks if the stored install mode is still valid /// </summary> public void CheckInstallMode() { // Collect the version information string installedVersion = Installer.GetInstalledVersionNumber(); float installedVersionNumber = float.Parse(installedVersion); float currentVersionNumber = versionNumber; // Process the version information if (installedVersionNumber == -1f) { // No version is installed installType = InstallType.Install; } else if (installedVersionNumber < currentVersionNumber) { // The installed version is older installType = InstallType.Upgrade; } else if (installedVersionNumber > currentVersionNumber) { // The installed version is newer installType = InstallType.Downgrade; } else { // The installed version is up-to-date installType = InstallType.Uninstall; } }
public bool CanExecute(object parameter) { bool isEnum = parameter is InstallType; if (!isEnum) { throw new ArgumentException("Command parameter must be of InstallType."); } if (programSettings.IsInRegisterTransitState) { return(false); } InstallType type = (InstallType)parameter; bool serviceInstalled = ServiceController.GetServices() .Any(service => service.ServiceName == DiskAPMService.DiskAPMService.DiskAPMServiceName); switch (type) { case InstallType.Install: return(!serviceInstalled); case InstallType.Uninstall: return(serviceInstalled); default: throw new InvalidOperationException("Switch default case in CanExecute"); } }
public InstallerContext(InstallType manual, string name, string sourceLocation, bool @override, AppType appType) { Manual = manual; Name = name; SourceLocation = sourceLocation; Override = @override; AppType = appType; }
private void InstallTypeShouldBe(InstallType expectedInstallType) { if ((Constants.InstallType & expectedInstallType) == 0) { throw new ApplicationException(string.Format("{0} of '{1}' cannot be called in {2}", new StackTrace().GetFrame(2).GetMethod().Name, ProductKey, Constants.InstallType)); } }
/// <summary> /// Initializes a new instance of the <see cref="Feature" />class. /// Missing parameters a set to default values /// </summary> /// <param name="name">The name of the feature.</param> /// <param name="instVersion">The installed version of the feature.</param> /// <param name="availVersion">The available version of the feature.</param> /// <param name="isGroup">Inidcate whether the feature is a node or a leafe.</param> /// <param name="index">The index in the container feature collection.</param> /// <param name="instAction">The install action to be performed on the feature.</param> public Feature(string name, string instVersion, string availVersion, bool isGroup, int index, InstallType instAction) : this(name, instVersion, availVersion, isGroup, index, instAction, 0, false) { }
public ProgramManager(InstallType installType = InstallType.AutoDetect) { _installType = installType; CreateAppDataDirectory(); _settingsManager = new SettingsManager(); _settingsManager.SetFullInstall(_ssmCachedFullInstall); CacheVariables(); }
/** * Always install the latest. */ private static void ImportPack(InstallType i) { string[] packs = GetProBuilderPacks(i == InstallType.Release ? "-unity" : "-source"); int tmp; int high = GetHighestVersion(packs, out tmp); LoadPack(packs[high]); //foundPacks[selectedPack]); /* nuke this installer and any other stuff */ PostInstallCleanup(); }
public bool ValidateUser(string username, string password, InstallType installType) { switch (installType) { case InstallType.Dls: return ssProxy.ValidateSubsidiary(username, password); case InstallType.Uls: return hqProxy.ValidateHeadQuarter(username, password); default: throw new NotSupportedException(); } }
/// <summary> /// Instantiates a new <see cref="InstallationSettings"/>. /// </summary> /// <param name="installType">The type of installation to perform.</param> /// <param name="cleanInstall">If <b>true</b> the installer will attempt to delete the target path before installing; otherwise, if <b>false</b> it will leave it.</param> /// <param name="enablePackageUpdates">If <b>true</b> the installer will update installed packages to mirror the packages in the package provider.</param> /// <param name="removeOrphanedPackages">If <b>true</b> the installer will remove orphaned packages after installation is complete.</param> /// <param name="updatePackagesBeforeInstalling">If <b>True</b> the installer will attempt to update packages before installing them. <b>False</b> will leave packages as is.</param> public InstallationSettings(InstallType installType, bool cleanInstall, bool enablePackageUpdates, bool removeOrphanedPackages, bool updatePackagesBeforeInstalling) : this() { InstallType = installType; CleanInstall = cleanInstall; EnablePackageUpdates = enablePackageUpdates; RemoveOrphanedPackages = removeOrphanedPackages; UpdatePackagesBeforeInstalling = updatePackagesBeforeInstalling; }
/// <summary> /// Propagate current feature's InstallAction to it's children so they can set their InstallAction /// </summary> /// <param name="action">The InstallAction to be propageated to all children.</param> public void PropagateDown(InstallType action) { if (this.Children != null) { foreach (Feature child in this.Children) { child.IsPropagated = true; child.InstallAction = action; child.IsInstallActionModified = child.IsGroup ? true : (child.InstallAction != child.PreviousAction); child.IsPropagated = false; child.PropagateDown(action); } } }
/// <summary> /// Get Action of selected ContextMenuItem /// </summary> private InstallType GetMenuButtonAction(string label) { InstallType type = InstallType.eSkip; foreach (ContextMenuItemContent item in CmItemList) { if (item.Label == label) { type = (InstallType)item.Index; break; } } return(type); }
/// <summary> /// Updates the js configuration. /// </summary> /// <param name="type">The installation type.</param> public void UpdateJsConfig(InstallType type) { if (type == InstallType.Api || this.installOptions.RootSite == null) { return; } List<string> configFiles = this.FindJsConfigFiles(); foreach (string path in configFiles) { File.WriteAllText(path, Regex.Replace(File.ReadAllText(path), @"(configuration\.subSite\s+=\s+')(.{0}|.+)(';)", string.Format("$1/{0}$3", this.installOptions.WebsiteName))); File.WriteAllText(path, Regex.Replace(File.ReadAllText(path), @"(a\.subSite="")(.{0}|.+)("",a\.web)", string.Format("$1/{0}$3", this.installOptions.WebsiteName))); } }
/// <summary> /// Check whether a feature has children having InstallAction different from "action" /// </summary> /// <param name="feature">The feature to be checked.</param> /// <param name="action">The InstallAction to be checked.</param> /// <returns>True if the children have different InstallAction, otherwise false.</returns> private bool HasChildrenWithDifferentAction(Feature feature, InstallType action) { bool different = false; foreach (Feature child in feature.Children) { if (child.InstallAction != action) { different = true; break; } } return(different); }
private void CreateAppDataDirectory() { switch (_installType) { case InstallType.AutoDetect: { if (File.Exists(Path.Combine(GetPotentialConfigPath(_portablePath), SettingsManager._programSettingsFileName))) { _installType = InstallType.PortableInstall; CreateAppDataDirectory(); break; } else if (File.Exists(Path.Combine(GetPotentialConfigPath(_fullInstallPath), SettingsManager._programSettingsFileName))) { _installType = InstallType.FullInstall; CreateAppDataDirectory(); break; } else { _installType = InstallType.PortableInstall; CreateAppDataDirectory(); break; } } case InstallType.PortableInstall: { _ssmCachedFullInstall = false; _appDataPath = _portablePath; CreateDirectory(GetConfigPath()); break; } case InstallType.FullInstall: { _ssmCachedFullInstall = true; _appDataPath = _fullInstallPath; foreach (string subDir in _currentSubDirsAppData) { CreateDirectory(Path.Combine(_appDataPath, subDir)); } break; } } }
internal static AndroidBinding.MParticle.InstallType ConvertToMpInstallType(InstallType installType) { switch (installType) { case InstallType.AutoDetect: return(AndroidBinding.MParticle.InstallType.AutoDetect); case InstallType.KnownInstall: return(AndroidBinding.MParticle.InstallType.KnownInstall); case InstallType.KnownUpgrade: return(AndroidBinding.MParticle.InstallType.KnownUpgrade); default: return(AndroidBinding.MParticle.InstallType.AutoDetect); } }
internal static iOSBinding.MPInstallationType ConvertToMpInstallType(InstallType installType) { switch (installType) { case InstallType.AutoDetect: return(iOSBinding.MPInstallationType.Autodetect); case InstallType.KnownInstall: return(iOSBinding.MPInstallationType.KnownInstall); case InstallType.KnownUpgrade: return(iOSBinding.MPInstallationType.KnownInstall); default: return(iOSBinding.MPInstallationType.Autodetect); } }
///////////////////////////////////////// public void RegisterFiles(InstallType mode) { P.Load(); InitID(); MakeRoot(); if (mode == InstallType.通常) { LoadDefault(); } else { AddUnityPackages(); } //m_registerItems = m_registerItems.Distinct( x => x.name ).ToList(); ReloadAndSorting(); }
/// <summary> /// Propagate current feature's InstallAction to it's parents so they can set their InstallAction icon /// </summary> /// <param name="action">The InstallAction to be propageated to all parents.</param> public void PropagateUp(InstallType action) { Feature parent = this.Parent; if (parent != null) { if (parent.Children != null) { bool different = HasChildrenWithDifferentAction(parent, action); parent.IsInstallActionModified = HasChildrenWithModifiedAction(parent); parent.IsPropagated = true; parent.InstallAction = different ? InstallType.eIndeterminate : action; parent.IsPropagated = false; parent.PropagateUp(action); } } }
protected bool LaunchInstallUtil(InstallType installType) { string utilPath = Path.Combine(netPath, instUtilName); string configAppPath = Assembly.GetExecutingAssembly().Location; var serviceAssemblyFolder = new FileInfo(configAppPath).Directory; string serviceAppPath = Path.Combine(serviceAssemblyFolder.FullName, serviceAppName); if (!File.Exists(serviceAppPath)) { MessageBox.Show($"Error. {serviceAppName} not found"); return(false); } if (!File.Exists(utilPath)) { MessageBox.Show($"Error. {instUtilName} not found"); return(false); } using (Process installProc = new Process()) { string args = serviceAppPath; if (installType == InstallType.Uninstall) { args = "/u " + args; } ProcessStartInfo startInfo = new ProcessStartInfo(utilPath, args) { UseShellExecute = false }; installProc.StartInfo = startInfo; installProc.Start(); installProc.WaitForExit(); CanExecuteChanged?.Invoke(this, EventArgs.Empty); return(installProc.ExitCode == 0); } }
/// <summary> /// Creates the context menu from CmItemList /// </summary> private void CreateContextMenu() { ContextMenu contextMenu = new ContextMenu(); this.ContextMenu = contextMenu; this.ContextMenu.PlacementTarget = this; this.ContextMenu.Placement = Placement; this.ContextMenu.SetValue(AutomationProperties.AutomationIdProperty, (string)this.GetValue(AutomationProperties.AutomationIdProperty) + ".ContextMenu"); this.ContextMenu.Opened += ((sender, routedEventArgs) => IsContextMenuOpen = true); this.ContextMenu.Closed += ((sender, routedEventArgs) => IsContextMenuOpen = false); // Replace the context menu labels by the localised labels if (LocalisedMenuLabels.Count > 0) { for (int i = 0; i < CmItemList.Count; i++) { CmItemList[i].Label = LocalisedMenuLabels[i].Text; } } foreach (ContextMenuItemContent item in CmItemList) { if (item.Label != "Indeterminate") { InstallType type = (InstallType)item.Index; string instVersion = InstalledVersion; string availVersion = AvailableVersion; bool canMigrate = CanMigrate; bool isEnabled = GetContextMenuEnableState(type, instVersion, availVersion, canMigrate); var menuItem = new MenuItem(); menuItem.Header = item.Label; menuItem.VerticalAlignment = VerticalAlignment.Center; menuItem.Icon = isEnabled ? item.Icon : item.IconDisabled; menuItem.IsEnabled = isEnabled; menuItem.SetValue(AutomationProperties.AutomationIdProperty, "SelectionTreeControl.MenuButton.ContextMenu." + type.ToString()); menuItem.Click += new RoutedEventHandler(OnContextMenuItem_Clicked); contextMenu.Items.Add(menuItem); } } }
/// <summary> /// Called when the InstallAction property of the feature has changed. /// </summary> /// <param name="sender">The sender.</param> /// <param name="DependencyPropertyChangedEventArgs">The <see cref="DependencyPropertyChangedEventArgs" /> instance containing the event data.</param> private static void OnInstallActionChanged(object sender, DependencyPropertyChangedEventArgs e) { Feature changedFeature = (Feature)sender; if (changedFeature.IsPropagated) { return; } //InstallType oldAction = (InstallType)e.OldValue; InstallType newAction = (InstallType)e.NewValue; changedFeature.IsPropagated = true; changedFeature.InstallAction = newAction; changedFeature.IsInstallActionModified = changedFeature.IsGroup ? true : (changedFeature.InstallAction != changedFeature.PreviousAction); changedFeature.IsPropagated = false; // Propagate new action to children and parent changedFeature.PropagateDown(newAction); changedFeature.PropagateUp(newAction); }
///////////////////////////////////////// void DrawRightPane() { HGUIToolbar.Begin(); if (HGUIToolbar.Toggle(m_installType == InstallType.通常, S._Installablepackages)) { m_installType = InstallType.通常; m_treeViewR.RegisterFiles(m_installType); } if (HGUIToolbar.Toggle(m_installType == InstallType.データベースに直インストール, S._Unitypackage)) { m_installType = InstallType.データベースに直インストール; m_treeViewR.RegisterFiles(m_installType); } HGUIToolbar.End(); GUILayout.Box("", HEditorStyles.treeViweArea, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); var dropRc = GUILayoutUtility.GetLastRect(); m_treeViewR.OnGUI(dropRc.AlignR(dropRc.width - 1)); }
public void OnNavigateInstallView(string versionID, InstallType type) { switch (type) { case InstallType.Version: this.ActivateItem(_gameInstallVM); return; case InstallType.Forge: _forgeInstallVM.GameVersion = versionID; this.ActivateItem(_forgeInstallVM); return; case InstallType.Fabric: _fabricInstallVM.GameVersion = versionID; this.ActivateItem(_fabricInstallVM); return; default: return; } }
/// <summary> /// Installs the web sites & services in IIS and makes any required /// system configuration changes to leave them operational. /// </summary> /// <param name="type">The type of web installation.</param> public void InstallWeb(InstallType type) { string json; if (this.installOptions.RootSite != null) { json = AssemblyResourceReader.ReadAsString(string.Format("Resources.IIS.{0}.Subsite.json", type)) .Replace("{websiteName}", HttpUtility.JavaScriptStringEncode(this.installOptions.WebsiteName)) .Replace("{rootSiteName}", HttpUtility.JavaScriptStringEncode(this.installOptions.RootSite.Name)) .Replace("{rootSiteHostName}", HttpUtility.JavaScriptStringEncode(this.installOptions.HostName)) .Replace("{basePath}", HttpUtility.JavaScriptStringEncode(this.installVariables.SourcePath)); } else { json = AssemblyResourceReader.ReadAsString(string.Format("Resources.IIS.{0}.json", type)) .Replace("{websiteName}", HttpUtility.JavaScriptStringEncode(this.installOptions.WebsiteName)) .Replace("{basePath}", HttpUtility.JavaScriptStringEncode(this.installVariables.SourcePath)); } WebSpecification configuration = JsonConvert.DeserializeObject<WebSpecification>(json); foreach (ApplicationPoolSpecification appPoolSpec in configuration.AppPools) { this.AddAppPool(appPoolSpec); } using (ServerManager serverManager = new ServerManager()) { foreach (SiteSpecification siteSpec in configuration.Websites) { this.AddWebsite(serverManager, siteSpec); } serverManager.CommitChanges(); } foreach (SiteSpecification siteSpec in configuration.Websites) { this.AddMimeTypes(siteSpec); } }
/// <summary> /// Checks automatically how to perform the install /// </summary> /// <param name="installType">The type of install registered</param> public static void PerformInstall(InstallType installType) { switch (installType) { case InstallType.Install: Installer.AskUserForInstall(); break; case InstallType.Upgrade: Installer.Uninstall(); Installer.Install(); break; case InstallType.Uninstall: Installer.AskUserForUninstall(); break; case InstallType.Downgrade: Installer.Uninstall(); Installer.Install(); break; } }
/// <summary> /// Initializes a new instance of the <see cref="Feature" />class. /// </summary> /// <param name="name">The name of the feature.</param> /// <param name="instVersion">The installed version of the feature.</param> /// <param name="availVersion">The available version of the feature.</param> /// <param name="isGroup">Inidcate whether the feature is a node or a leafe.</param> /// <param name="index">The index in the container feature collection.</param> /// <param name="instAction">The install action to be performed on the feature.</param> /// <param name="size">The size of the feature.</param> /// <param name="isMigration">Indicates whether the feature is to be migratetd.</param> public Feature(string name, string instVersion, string availVersion, bool isGroup, int index, InstallType instAction, double size, bool isMigration) { this.ProductName = name; this.InstalledVersion = instVersion; this.AvailableVersion = availVersion; this.IsGroup = isGroup; this.IsInstallActionModified = false; this.BoListIndex = index; this.IsPropagated = false; // PreviousAction MUST be set before InstallAction in order to make OnInstallActionChanged callback work correctly this.PreviousAction = instAction; this.InstallAction = instAction; this.IsMigration = isMigration; this.Size = size; this.Children = new FeatureCollection(); }
/// <summary> /// For each product listed by the patch package as eligible to receive the patch, ApplyPatch invokes /// an installation and sets the PATCH property to the path of the patch package. /// </summary> /// <param name="patchPackage">path to the patch package</param> /// <param name="installPackage">path to the product to be patched, if installType /// is set to <see cref="InstallType.NetworkImage"/></param> /// <param name="installType">type of installation to patch</param> /// <param name="commandLine">optional command line property settings</param> /// <exception cref="InstallerException">There was an error applying the patch</exception> /// <remarks><p> /// The <see cref="RebootRequired"/> and <see cref="RebootInitiated"/> properties should be /// tested after calling this method. /// </p><p> /// Win32 MSI API: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msiapplypatch.asp">MsiApplyPatch</a> /// </p></remarks> public static void ApplyPatch(string patchPackage, string installPackage, InstallType installType, string commandLine) { uint ret = NativeMethods.MsiApplyPatch(patchPackage, installPackage, (int) installType, commandLine); Installer.CheckInstallResult(ret); }
/// <summary> /// Removes the web sites & services in IIS and removes any /// system configuration changes that were made as part of the /// installation process. /// </summary> /// <param name="type">The type of web uninstallation.</param> public void UninstallWeb(InstallType type) { string json; bool isSubsiteInstallation = this.installOptions.RootSite != null; if (isSubsiteInstallation) { json = AssemblyResourceReader.ReadAsString(string.Format("Resources.IIS.{0}.Subsite.json", type)) .Replace("{websiteName}", HttpUtility.JavaScriptStringEncode(this.installOptions.WebsiteName)) .Replace("{rootSiteName}", HttpUtility.JavaScriptStringEncode(this.installOptions.RootSite.Name)) .Replace("{rootSiteHostName}", HttpUtility.JavaScriptStringEncode(this.installOptions.HostName)) .Replace("{basePath}", HttpUtility.JavaScriptStringEncode(this.installVariables.SourcePath)); } else { json = AssemblyResourceReader.ReadAsString(string.Format("Resources.IIS.{0}.json", type)) .Replace("{websiteName}", HttpUtility.JavaScriptStringEncode(this.installOptions.WebsiteName)) .Replace("{basePath}", HttpUtility.JavaScriptStringEncode(this.installVariables.SourcePath)); } WebSpecification configuration = JsonConvert.DeserializeObject<WebSpecification>(json); using (ServerManager serverManager = new ServerManager()) { foreach (SiteSpecification siteSpec in configuration.Websites) { if (isSubsiteInstallation) { this.RemoveSubsite(siteSpec); } else { this.RemoveWebsite(siteSpec); } foreach (ApplicationSpecification appSpec in siteSpec.SubApplications) { this.CleanUp(appSpec); } foreach (VirtualDirectorySpecification vitualDirSpec in siteSpec.VirtualDirectories) { this.CleanUp(vitualDirSpec, siteSpec.AppPoolName); } } serverManager.CommitChanges(); } foreach (ApplicationPoolSpecification appPool in configuration.AppPools) { this.RemoveAppPool(appPool.Name, appPool.AccessibleFiles); } }
private void OnGUI() { Color oldBGC = GUI.backgroundColor; if(EditorGUIUtility.isProSkin) headerStyle.normal.textColor = new Color(1f, 1f, 1f, .8f); else headerStyle.normal.textColor = Color.black; headerStyle.alignment = TextAnchor.MiddleCenter; headerStyle.fontSize = 14; headerStyle.fontStyle = FontStyle.Bold; GUILayout.Label(PACKNAME + " Install Tool", headerStyle); GUILayout.Space(10); GUI.color = Color.white; GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Label("Current Install: " + ((currentRevision > 0) ? currentRevision.ToString() : PACKNAME + " Not Found" )); GUILayout.Label("Newest Available: r" + packNo); GUILayout.EndVertical(); GUILayout.BeginVertical(); GUI.backgroundColor = Color.green; if(GUILayout.Button("Install", GUILayout.MinHeight(28))) { if(EditorUtility.DisplayDialog("Install " + PACKNAME + " Update", "Install " + Path.GetFileNameWithoutExtension(foundPacks[selectedPack]) + "\n\nWarning! Back up your project!", "Run Update or Install", "Cancel")) { LoadPack(foundPacks[selectedPack]); this.Close(); } } GUI.backgroundColor = Color.white; GUILayout.EndVertical(); GUILayout.EndHorizontal(); TextAnchor ta = GUI.skin.box.alignment; GUI.skin.box.alignment = TextAnchor.MiddleLeft; Color oldBoxTC = GUI.skin.box.normal.textColor; if(EditorGUIUtility.isProSkin) GUI.skin.box.normal.textColor = new Color(1f, 1f, 1f, .65f); GUILayout.Space(4); switch(install) { case InstallType.Release: GUILayout.Box("Release is the standard installation type. It provides pre-compiled " + PACKNAME + " libraries instead of source code, meaning Unity doesn't need to compile extra files.\n\n*Note that all " + PACKNAME + " `Actions` and example scene files are still provided as source code."); break; #if !PROTOTYPE case InstallType.Source: GUILayout.Box(PACKNAME + " will be installed with full source code. Note that you will need to remove any previous "+ PACKNAME + " \"Release\" installations prior to installing a Source version. This is not recommended for users upgrading from a prior installation, as you *will* lose all prior-built " + PACKNAME + " objects."); break; #endif } GUILayout.Space(4); GUI.skin.box.alignment = ta; GUI.skin.box.normal.textColor = oldBoxTC; EditorGUI.BeginChangeCheck(); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Install Type"); install = (InstallType)EditorGUILayout.EnumPopup(install); GUILayout.EndHorizontal(); if( EditorGUI.EndChangeCheck() ) switch(install) { case InstallType.Release: selectedPack = GetHighestVersion_Release(foundPacks); break; #if !PROTOTYPE case InstallType.Source: selectedPack = GetHighestVersion_Source(foundPacks); break; #endif } GUILayout.Label("Available " + PACKNAME + " Packs", EditorStyles.boldLabel); GUIStyle labelStyle = GUIStyle.none; if(EditorGUIUtility.isProSkin) labelStyle.normal.textColor = new Color(1f, 1f, 1f, .8f); labelStyle.normal.background = EditorGUIUtility.whiteTexture; labelStyle.alignment = TextAnchor.MiddleLeft; int CELL_HEIGHT = 18; labelStyle.contentOffset = new Vector2(2, 0f); labelStyle.margin = new RectOffset(6, 0, 0, 0); Rect r = GUILayoutUtility.GetLastRect(); if(Event.current.type == EventType.Repaint) { scrollBox = new Rect(r.x, r.y+17, Screen.width-9, Screen.height-r.y-22); scrollMaxHeight = (int)scrollBox.height-2; } GUI.Box(scrollBox, ""); scroll = EditorGUILayout.BeginScrollView(scroll, false, false, GUILayout.MinWidth(Screen.width-6), GUILayout.MaxHeight(scrollMaxHeight)); Color odd = EditorGUIUtility.isProSkin ? new Color(.3f, .3f, .3f, .1f) : new Color(.2f, .2f, .2f, .1f); Color even = EditorGUIUtility.isProSkin ? new Color(.2f, .2f, .2f, .6f) : new Color(.2f, .2f, .2f, .05f); int i = 0; for(int n = 0; n < foundPacks.Length; n++) { if(n == selectedPack) { GUI.backgroundColor = new Color(0.23f, .49f, .89f, 1f); Color oc = labelStyle.normal.textColor; labelStyle.normal.textColor = Color.white; GUILayout.Box(Path.GetFileName(foundPacks[n]), labelStyle, GUILayout.MinHeight(CELL_HEIGHT), GUILayout.MaxHeight(CELL_HEIGHT)); labelStyle.normal.textColor = oc; GUI.backgroundColor = Color.white; } else { switch(install) { case InstallType.Release: if(foundPacks[n].Contains("-source")) continue; break; #if !PROTOTYPE case InstallType.Source: if(foundPacks[n].Contains("-unity")) continue; break; #endif } GUI.backgroundColor = i++ % 2 == 0 ? odd : even; if(GUILayout.Button(Path.GetFileName(foundPacks[n]), labelStyle, GUILayout.MinHeight(CELL_HEIGHT), GUILayout.MaxHeight(CELL_HEIGHT))) selectedPack = n; GUI.backgroundColor = Color.clear; } } EditorGUILayout.EndScrollView(); labelStyle.normal.background = null; GUI.backgroundColor = oldBGC; }
public void Reset() { _type = _item.Type; }
/// <summary> /// Runs the uninstall process. /// </summary> /// <param name="type">The type of uninstallation.</param> private void RunUninstall(InstallType type) { if (string.IsNullOrEmpty(this.installOptions.WebsiteName)) { installLogger.LogErrorLine(Messages.MAIN_NoWebsiteSpecified); return; } if (type == InstallType.Standard) { this.taskManager.UninstallScheduledTasks(); } this.webManager.UninstallWeb(type); this.RemoveEntLibRegistryKey(); installLogger.LogLine(Messages.MAIN_UninstallationComplete); }
/// <summary> /// Updates XML configuration based on the installation result. /// </summary> /// <param name="type">The installation type.</param> public void UpdateXmlConfig(InstallType type) { if (type == InstallType.Api) { return; } List<string> configFiles = this.FindXmlConfigFiles(); XmlUpdater updater = new XmlUpdater(); Dictionary<string, string> xmlNamespaces = new Dictionary<string, string> { { Constants.Unity_XmlNamespacePrefix, Constants.Unity_XmlNamespaceUri } }; List<XmlReplacement> replacements = new List<XmlReplacement>(); List<XmlCreate> creates = new List<XmlCreate>(); List<XmlRemoval> removals = new List<XmlRemoval>(); if (!string.IsNullOrEmpty(this.installVariables.OrgId)) { // Update service accounts foreach (KeyValuePair<User, string> kvp in this.installVariables.ServiceAccounts) { replacements.Create(string.Format(Constants.XPath_ServiceUserFormat, kvp.Key.DisplayName), Constants.XmlAttr_Value, currentValue => kvp.Key.Username); replacements.Create(string.Format(Constants.XPath_ServicePasswordFormat, kvp.Key.DisplayName), Constants.XmlAttr_Value, currentValue => kvp.Value); } } // Update service endpoints if (!string.IsNullOrEmpty(this.installOptions.WebsiteName)) { Regex regex = new Regex(@"(?<=http://).*(?=/iSolutions)", RegexOptions.IgnoreCase); var replacementSiteName = this.installOptions.RootSite != null ? string.Format("{0}/{1}", this.installOptions.HostName, this.installOptions.WebsiteName) : this.installOptions.WebsiteName; replacements.Create(Constants.XPath_Endpoint, Constants.XmlAttr_Address, currentValue => regex.Replace(currentValue, replacementSiteName)); replacements.Create(Constants.XPath_EntLibSource, Constants.XmlAttr_Source, currentValue => this.installOptions.EnterpriseLibraryLoggingSource); } // Update SMTP if (!string.IsNullOrEmpty(this.installOptions.SmtpHost)) { if (string.IsNullOrEmpty(this.installOptions.SmtpUsername)) { removals.Add(new XmlRemoval { NodeXPath = Constants.XPath_SmtpCredsDependency }); replacements.Create(Constants.XPath_SmtpCredsUsername, Constants.XmlAttr_Value, currentValue => "Username"); replacements.Create(Constants.XPath_SmtpCredsPassword, Constants.XmlAttr_Value, currentValue => "Password"); replacements.Create(Constants.XPath_SmtpHost, Constants.XmlAttr_Value, currentValue => this.installOptions.SmtpHost); } else { creates.Add(this.CreateNode(Constants.XPath_SmtpCredsDependency)); replacements.Create(Constants.XPath_SmtpCredsDependency, Constants.XmlAttr_DependencyName, currentValue => Constants.XmlVal_SmtpCreds); replacements.Create(Constants.XPath_SmtpCredsUsername, Constants.XmlAttr_Value, currentValue => this.installOptions.SmtpUsername); replacements.Create(Constants.XPath_SmtpCredsPassword, Constants.XmlAttr_Value, currentValue => this.installOptions.SmtpPassword); replacements.Create(Constants.XPath_SmtpHost, Constants.XmlAttr_Value, currentValue => this.installOptions.SmtpHost); } } updater.Update(configFiles, xmlNamespaces, replacements, creates, removals); }
/// <summary> /// Runs the repair process. /// </summary> /// <param name="installType">The type of install.</param> public void Run(InstallType installType = InstallType.Standard) { if (!this.VerifyDatabase()) { throw new MongoException(string.Format(Messages.DB_Unreachable, this.Client.GetServer().Primary.Address.Host, this.Client.GetServer().Primary.Address.Port, this.Database.Name)); } bool dbExists = this.DatabaseExists(); Dictionary<SystemUriType, string> uris = new Dictionary<SystemUriType, string>(); if (!string.IsNullOrEmpty(this.installConfiguration.WebsiteName)) { SystemUriType uriType = installType == InstallType.Standard ? SystemUriType.BaseSite : SystemUriType.ApiSite; uris.Add(uriType, this.installConfiguration.WebsiteName); } this.InitDatabase(uris); Version dbVersion = this.GetVersionInfo(); Version assemVersion = Assembly.GetExecutingAssembly().GetName().Version; if (!dbExists) { this.SetVersionInfo(assemVersion); return; } if (dbVersion == null) { this.installLogger.LogLine(Messages.DB_UnknownVersion); this.SetVersionInfo(assemVersion); return; } if (dbVersion.CompareTo(assemVersion, 3) >= 0) { this.installLogger.LogLine(string.Format(Messages.DB_VersionUpToDate, dbVersion)); return; } this.installLogger.LogLine(string.Format(Messages.DB_VersionRequiresUpdate, dbVersion, assemVersion.ToString(3))); List<string> files = this.FindDatabasePatches(dbVersion); foreach (string file in files) { this.ExecutePatch(file); } this.SetVersionInfo(assemVersion); }
void OnGUI() { Color oldBGC = GUI.backgroundColor; if(EditorGUIUtility.isProSkin) headerStyle.normal.textColor = new Color(1f, 1f, 1f, .8f); else headerStyle.normal.textColor = Color.black; headerStyle.alignment = TextAnchor.MiddleCenter; headerStyle.fontSize = 14; headerStyle.fontStyle = FontStyle.Bold; GUILayout.Label(PACKNAME + " Install Tool", headerStyle); GUILayout.Space(10); GUI.color = Color.white; GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); int installTypeEnumWidth = (int)Mathf.Max(Screen.width/2f - 8, 96); GUILayout.Label("Install Type"); install = (InstallType)EditorGUILayout.EnumPopup(install, GUILayout.MaxWidth(installTypeEnumWidth)); GUILayout.EndVertical(); if(needsOrganized) GUI.enabled = false; GUI.backgroundColor = Color.green; if(GUILayout.Button("Install", GUILayout.MinWidth(Mathf.Min(Screen.width - installTypeEnumWidth - 8, 96)), GUILayout.MinHeight(32))) { if(probuilderExists) if(!EditorUtility.DisplayDialog("Install " + PACKNAME + " Update", "Install " + PACKNAME + "\n\nWarning! Back up your project!", "Run Update", "Cancel")) return; foreach(string str in FILES_TO_DELETE) DeleteFile(str); ImportPack( install ); this.Close(); } GUI.enabled = true; GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); TextAnchor ta = GUI.skin.box.alignment; GUI.skin.box.alignment = TextAnchor.MiddleLeft; Color oldBoxTC = GUI.skin.box.normal.textColor; if(EditorGUIUtility.isProSkin) GUI.skin.box.normal.textColor = new Color(1f, 1f, 1f, .65f); GUILayout.Space(4); if(needsOrganized) { EditorGUILayout.HelpBox("Install Script has detected ProBuilder exists in this project, but is not in the \"Assets/6by7/\" folder.\n\nTo upgrade your project without losing your work, please manually move the ProBuilder folder to \"Assets/6by7/\".\n\nClick the \"Continue\" button once you've moved ProBuilder's folders.", MessageType.Warning); if(GUILayout.Button("Continue")) { MoveOldFiles(); } } else { switch(install) { case InstallType.Release: GUILayout.Box("Release is the standard installation type. It provides pre-compiled " + PACKNAME + " libraries instead of source code, meaning Unity doesn't need to compile extra files.\n\n*Note that all " + PACKNAME + " `Actions` and example scene files are still provided as source code."); break; #if !PROTOTYPE case InstallType.Source: GUILayout.Box(PACKNAME + " will be installed with full source code. Note that you will need to remove any previous "+ PACKNAME + " \"Release\" installations prior to installing a Source version. This is not recommended for users upgrading from a prior installation, as you *will* lose all prior-built " + PACKNAME + " objects."); break; #endif } } GUILayout.Space(4); GUI.skin.box.alignment = ta; GUI.skin.box.normal.textColor = oldBoxTC; GUI.backgroundColor = oldBGC; }
/** * Always install the latest. */ private static void ImportPack(InstallType i) { string[] packs = GetProBuilderPacks(i == InstallType.Release ? "-unity" : "-source"); int tmp; int high = GetHighestVersion(packs, out tmp); LoadPack( packs[high] );//foundPacks[selectedPack]); /* nuke this installer and any other stuff */ PostInstallCleanup(); }
/// <summary> /// Runs the install process. /// </summary> /// <param name="type">The type of installation to run.</param> private void RunInstall(InstallType type) { if (string.IsNullOrEmpty(this.installOptions.WebsiteName)) { installLogger.LogErrorLine(Messages.MAIN_NoWebsiteSpecified); return; } this.dbManager.Run(type); this.webManager.InstallWeb(type); this.AddEntLibRegistryKey(); if (type != InstallType.Standard) { return; } this.taskManager.InstallScheduledTasks(); this.installOptions.SmtpHost = this.installOptions.Quiet ? Constants.DefaultSmtpServer : this.ReadInput("SMTP Server", Constants.DefaultSmtpServer); if (this.installOptions.SmtpHost == Constants.DefaultSmtpServer) { return; } this.installOptions.SmtpUsername = this.ReadInput("SMTP Username (blank for none)", null); if (!string.IsNullOrEmpty(this.installOptions.SmtpUsername)) { this.installOptions.SmtpPassword = this.ReadPassword("SMTP Password"); } }
internal static PackageId GetManifestPackageId(SdkFeatureBand featureBand, ManifestId manifestId, InstallType installType) => installType switch {
private void OnGUI() { Color oldBGC = GUI.backgroundColor; if (EditorGUIUtility.isProSkin) { headerStyle.normal.textColor = new Color(1f, 1f, 1f, .8f); } else { headerStyle.normal.textColor = Color.black; } headerStyle.alignment = TextAnchor.MiddleCenter; headerStyle.fontSize = 14; headerStyle.fontStyle = FontStyle.Bold; GUILayout.Label(PACKNAME + " Install Tool", headerStyle); GUILayout.Space(10); GUI.color = Color.white; GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Label("Current Install: " + ((currentRevision > 0) ? currentRevision.ToString() : PACKNAME + " Not Found")); GUILayout.Label("Newest Available: r" + packNo); GUILayout.EndVertical(); GUILayout.BeginVertical(); GUI.backgroundColor = Color.green; if (GUILayout.Button("Install", GUILayout.MinHeight(28))) { if (EditorUtility.DisplayDialog("Install " + PACKNAME + " Update", "Install " + Path.GetFileNameWithoutExtension(foundPacks[selectedPack]) + "\n\nWarning! Back up your project!", "Run Update or Install", "Cancel")) { LoadPack(foundPacks[selectedPack]); this.Close(); } } GUI.backgroundColor = Color.white; GUILayout.EndVertical(); GUILayout.EndHorizontal(); TextAnchor ta = GUI.skin.box.alignment; GUI.skin.box.alignment = TextAnchor.MiddleLeft; Color oldBoxTC = GUI.skin.box.normal.textColor; if (EditorGUIUtility.isProSkin) { GUI.skin.box.normal.textColor = new Color(1f, 1f, 1f, .65f); } GUILayout.Space(4); switch (install) { case InstallType.Release: GUILayout.Box("Release is the standard installation type. It provides pre-compiled " + PACKNAME + " libraries instead of source code, meaning Unity doesn't need to compile extra files.\n\n*Note that all " + PACKNAME + " `Actions` and example scene files are still provided as source code."); break; #if !PROTOTYPE case InstallType.Source: GUILayout.Box(PACKNAME + " will be installed with full source code. Note that you will need to remove any previous " + PACKNAME + " \"Release\" installations prior to installing a Source version. This is not recommended for users upgrading from a prior installation, as you *will* lose all prior-built " + PACKNAME + " objects."); break; #endif } GUILayout.Space(4); GUI.skin.box.alignment = ta; GUI.skin.box.normal.textColor = oldBoxTC; EditorGUI.BeginChangeCheck(); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Install Type"); install = (InstallType)EditorGUILayout.EnumPopup(install); GUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { switch (install) { case InstallType.Release: selectedPack = GetHighestVersion_Release(foundPacks); break; #if !PROTOTYPE case InstallType.Source: selectedPack = GetHighestVersion_Source(foundPacks); break; #endif } } GUILayout.Label("Available " + PACKNAME + " Packs", EditorStyles.boldLabel); GUIStyle labelStyle = GUIStyle.none; if (EditorGUIUtility.isProSkin) { labelStyle.normal.textColor = new Color(1f, 1f, 1f, .8f); } labelStyle.normal.background = EditorGUIUtility.whiteTexture; labelStyle.alignment = TextAnchor.MiddleLeft; int CELL_HEIGHT = 18; labelStyle.contentOffset = new Vector2(2, 0f); labelStyle.margin = new RectOffset(6, 0, 0, 0); Rect r = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.Repaint) { scrollBox = new Rect(r.x, r.y + 17, Screen.width - 9, Screen.height - r.y - 22); scrollMaxHeight = (int)scrollBox.height - 2; } GUI.Box(scrollBox, ""); scroll = EditorGUILayout.BeginScrollView(scroll, false, false, GUILayout.MinWidth(Screen.width - 6), GUILayout.MaxHeight(scrollMaxHeight)); Color odd = EditorGUIUtility.isProSkin ? new Color(.3f, .3f, .3f, .1f) : new Color(.2f, .2f, .2f, .1f); Color even = EditorGUIUtility.isProSkin ? new Color(.2f, .2f, .2f, .6f) : new Color(.2f, .2f, .2f, .05f); int i = 0; for (int n = 0; n < foundPacks.Length; n++) { if (n == selectedPack) { GUI.backgroundColor = new Color(0.23f, .49f, .89f, 1f); Color oc = labelStyle.normal.textColor; labelStyle.normal.textColor = Color.white; GUILayout.Box(Path.GetFileName(foundPacks[n]), labelStyle, GUILayout.MinHeight(CELL_HEIGHT), GUILayout.MaxHeight(CELL_HEIGHT)); labelStyle.normal.textColor = oc; GUI.backgroundColor = Color.white; } else { switch (install) { case InstallType.Release: if (foundPacks[n].Contains("-source")) { continue; } break; #if !PROTOTYPE case InstallType.Source: if (foundPacks[n].Contains("-unity")) { continue; } break; #endif } GUI.backgroundColor = i++ % 2 == 0 ? odd : even; if (GUILayout.Button(Path.GetFileName(foundPacks[n]), labelStyle, GUILayout.MinHeight(CELL_HEIGHT), GUILayout.MaxHeight(CELL_HEIGHT))) { selectedPack = n; } GUI.backgroundColor = Color.clear; } } EditorGUILayout.EndScrollView(); labelStyle.normal.background = null; GUI.backgroundColor = oldBGC; }
/// <summary> /// Initializes a new instance of the <see cref="Feature" />class. /// Missing parameters a set to default values /// </summary> /// <param name="name">The name of the feature.</param> /// <param name="instAction">The install action to be performed on the feature.</param> public Feature(string name, InstallType instAction) : this(name, "", "", true, -1, instAction, 0, false) { }
internal AndroidJavaObject ConvertToMpInstallType(InstallType installType) { return(installTypeClass.CallStatic <AndroidJavaObject>("valueOf", installType.ToString())); }
public void StartInstall( InstallType InstallType ) { }
/// <summary> /// For each product listed by the patch package as eligible to receive the patch, ApplyPatch invokes /// an installation and sets the PATCH property to the path of the patch package. /// </summary> /// <param name="patchPackage">path to the patch package</param> /// <param name="installPackage">path to the product to be patched, if installType /// is set to <see cref="InstallType.NetworkImage"/></param> /// <param name="installType">type of installation to patch</param> /// <param name="commandLine">optional command line property settings</param> /// <exception cref="InstallerException">There was an error applying the patch</exception> /// <remarks><p> /// The <see cref="RebootRequired"/> and <see cref="RebootInitiated"/> properties should be /// tested after calling this method. /// </p><p> /// Win32 MSI API: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msiapplypatch.asp">MsiApplyPatch</a> /// </p></remarks> public static void ApplyPatch(string patchPackage, string installPackage, InstallType installType, string commandLine) { uint ret = NativeMethods.MsiApplyPatch(patchPackage, installPackage, (int)installType, commandLine); Installer.CheckInstallResult(ret); }
private void InstallTypeShouldBe(InstallType expectedInstallType) { if ((Constants.InstallType & expectedInstallType) == 0) throw new ApplicationException(string.Format("{0} of '{1}' cannot be called in {2}", new StackTrace().GetFrame(2).GetMethod().Name, ProductKey, Constants.InstallType)); }
public DisIdentity(string userName, InstallType installType) { this.name = userName; this.installType = installType; }
public bool ValidateUser(string username, string password, InstallType installType) { return userProxy.ValidateUser(username, password); }