Improvements WiX UI, installed component detection, update via UI.
This commit is contained in:
parent
473fd3c3ef
commit
ce508b178c
6 changed files with 127 additions and 18 deletions
|
@ -39,6 +39,7 @@ namespace WebsitePanel.Setup
|
|||
public const string DefaultInstallPathRoot = @"C:\WebsitePanel";
|
||||
public const string LoopbackIPv4 = "127.0.0.1";
|
||||
public const string InstallerProductCode = "cfg core";
|
||||
public const string DefaultProductName = "WebsitePanel";
|
||||
|
||||
public abstract class Parameters
|
||||
{
|
||||
|
|
|
@ -170,9 +170,13 @@ namespace WebsitePanel.Setup.Internal
|
|||
}
|
||||
public static string GetComponentID(SetupVariables Ctx)
|
||||
{
|
||||
var XmlPath = string.Format("//component[.//add/@key='ComponentCode' and .//add/@value='{0}']", Ctx.ComponentCode);
|
||||
return GetComponentID(GetFullConfigPath(Ctx), Ctx.ComponentCode);
|
||||
}
|
||||
public static string GetComponentID(string Cfg, string ComponentCode)
|
||||
{
|
||||
var XmlPath = string.Format("//component[.//add/@key='ComponentCode' and .//add/@value='{0}']", ComponentCode);
|
||||
var Xml = new XmlDocument();
|
||||
Xml.Load(GetFullConfigPath(Ctx));
|
||||
Xml.Load(Cfg);
|
||||
var Node = Xml.SelectSingleNode(XmlPath) as XmlElement;
|
||||
return Node == null ? null : Node.GetAttribute("id");
|
||||
}
|
||||
|
@ -3926,20 +3930,20 @@ namespace WebsitePanel.Setup.Internal
|
|||
try
|
||||
{
|
||||
Log.WriteStart("RestoreXmlConfigs");
|
||||
var Backup = BackupRestore.Find(Ctx.InstallerFolder, "WebsitePanel", Ctx.ComponentName);
|
||||
var Backup = BackupRestore.Find(Ctx.InstallerFolder, Global.DefaultProductName, Ctx.ComponentName);
|
||||
switch(Ctx.ComponentCode)
|
||||
{
|
||||
case "server":
|
||||
case Global.Server.ComponentCode:
|
||||
{
|
||||
Backup.XmlFiles.Add("Web.config");
|
||||
}
|
||||
break;
|
||||
case "enterpriseserver":
|
||||
case Global.EntServer.ComponentCode:
|
||||
{
|
||||
Backup.XmlFiles.Add("Web.config");
|
||||
}
|
||||
break;
|
||||
case "portal":
|
||||
case Global.WebPortal.ComponentCode:
|
||||
{
|
||||
Backup.XmlFiles.Add("Web.config");
|
||||
Backup.XmlFiles.Add(@"App_Data\Countries.config");
|
||||
|
@ -3957,9 +3961,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
break;
|
||||
}
|
||||
var MainCfg = Path.Combine(Ctx.InstallerFolder, BackupRestore.MainConfig);
|
||||
var XCfg = new XmlDocument();
|
||||
XCfg.Load(MainCfg);
|
||||
if (XCfg.SelectSingleNode("//components").ChildNodes.Count == 0)
|
||||
if (!BackupRestore.HaveChild(MainCfg, "//components"))
|
||||
{
|
||||
Log.WriteInfo("Restoring main config...");
|
||||
XmlDocumentMerge.Process(Backup.BackupMainConfigFile, MainCfg);
|
||||
|
|
|
@ -8,7 +8,7 @@ using Ionic.Zip;
|
|||
|
||||
namespace WebsitePanel.Setup.Internal
|
||||
{
|
||||
class BackupRestore
|
||||
public class BackupRestore
|
||||
{
|
||||
struct DirectoryTag
|
||||
{
|
||||
|
@ -47,9 +47,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
Version BckpVersion;
|
||||
var StrVersion = VersionName.Substring(FullId.Length);
|
||||
if (Version.TryParse(StrVersion, out BckpVersion))
|
||||
{
|
||||
DirList.Add(new DirectoryTag { Name = VersionItem, Date = date, Version = BckpVersion });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +59,16 @@ namespace WebsitePanel.Setup.Internal
|
|||
}
|
||||
return Result;
|
||||
}
|
||||
public static bool HaveChild(string XmlDocPath, string XmlPath)
|
||||
{
|
||||
var Result = false;
|
||||
var XCfg = new XmlDocument();
|
||||
XCfg.Load(XmlDocPath);
|
||||
var Node = XCfg.SelectSingleNode(XmlPath);
|
||||
if (Node != null)
|
||||
Result = Node.ChildNodes.Count > 0;
|
||||
return Result;
|
||||
}
|
||||
private static string GetComponentRoot(DirectoryTag DirTag, string Id)
|
||||
{
|
||||
var Cfg = GetMainConfig(DirTag);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue